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 Classic Chat / GetSpriteHit not always returning a value?

Author
Message
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 23rd Mar 2016 13:41
Okay so I've got some sprites.. I'm using GetSpriteHit to check for if a certain sprite has been pressed, and then returning a value based on the sprite.

Code looks like this for the check:



It will work most of the time, but sometimes when I press around on the buttons, nothing happens and I have to click a few times for it to do the check correctly. I've tried using GetSpriteHitTest() and it does the same thing. Behind these buttons I have a background sprite, but I don't think that is causing the issue. But maybe? I've also used SetSpriteShape to ensure they're all boxes, but nothing makes a different.. tried commenting out SetWindowSize/SetDisplayAspect/FixSpriteToScreen all sorts of things all still end with the same result. Help please!
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 23rd Mar 2016 13:47
Nevermind - I think I figured what the deal was.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 23rd Mar 2016 16:16
Care to share for everyone else? Sharing is caring!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 24th Mar 2016 07:49
I like to use setspritegroup and getspritehitgroup for sprite buttons. It helps avoid false positives on other sprites.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-11-25 08:30:02
Your offset time is: 2024-11-25 08:30:02