Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / GetSpriteHit return invisile sprites

Author
Message
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 15th Mar 2020 22:41
How can I get the code to ignore invisible sprites?

m_obj=GetSpriteHit(x,y)
if GetSpriteVisible(m_obj)=0
m_obj=0
endif

This works, but it leaves out the option to detect sprites below the invisible one...
Dutch
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Mar 2020 22:58
I wonder if SetSpriteActive() might do that, or you could add invisible sprites to a group that isn't in the hittest
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 16th Mar 2020 04:41
Two solutions that I've used were either moving hidden sprites out of the scene temporarily (ex: SetSpritePosition(1,-200,-400) or sorting sprites into different groups. More on that second one can be found here:

https://www.appgamekit.com/documentation/examples/input/6_hitting_sprite_groups.htm


Login to post a reply

Server time is: 2024-04-19 12:14:22
Your offset time is: 2024-04-19 12:14:22