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 / SetSpriteActive() does not affect GetSpriteHitTest() ?

Author
Message
jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 27th Jul 2020 14:44
I've added some sounds to my project and have just discovered that with SetSpriteActive(mySprite, 0) and SetSpriteVisible(mySprite, 0) I'm still getting results from a GetSpriteHitTest(). In my program I was adding sound to a menu and ended up getting mouse-over sounds with it hidden.

Not a big deal for me to add a check to make sure its visible when I'm looking for the GetSpriteHitTest(), but can I ask is this expected and GetSpriteHitTest() will always return a result regardless of active or visible? Thanks!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Jul 2020 21:41
Try SetSpriteShapeBox( id, 0, 0, 0, 0, 0 )
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th Jul 2020 08:17 Edited at: 28th Jul 2020 08:19
Quote: " is this expected"

yes, where:
Quote: "SetSpriteActive
Sets whether this sprite updates its animation and physics every frame, the sprite may be visible or not, which is controlled by SetSpriteVisible. "

so, not sure you need to use that at all.

then:
Quote: "GetSpriteHitTest
Returns 1 if the point x,y in world coordinates lies within the sprite, 0 if not."

and, that's all it does - determines whether or not a point lies within a sprite's shape, rotated or not, whether its visible or not, etc.
[My Itch.io Home]
[CODE lang=AGK] Your Code Here [/CODE]
[VIDEO=youtube] VideoID [/VIDEO]

Login to post a reply

Server time is: 2024-04-18 20:10:07
Your offset time is: 2024-04-18 20:10:07