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 / False sprite collision on non-positioned sprite

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 28th Jan 2016 17:43
I've not had any time to track this down properly but if you have a sprite that has yet to have its position set via a SetSpritePosition command then it returns a false positive when you check for collisions with it under certain circumstances. It seems to use the coordinates of another (next or previous ID?) sprite when calculating sprite collisions. I'll track down the exact circumstances at some stage but thought I'd mention it as it had me fooled for a couple of hours (didn't help that I requested feedback on various variables incorrectly so was reading incorrect data whilst hunting for the bug! LOL)!

If a sprite hasn't been positioned yet, I feel it should never give a positive for collisions.
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 28th Jan 2016 22:12
When you create a sprite, it will automatically be positioned at 0,0. If your collision test intersects the sprite at that position, then you will get a hit unless there is a bug. Do you have some example code we take a look at to confirm?
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 29th Jan 2016 16:20
No example code as it's spread across a few functions but I'll see if I can pull something together...just keen to get on with the next step of my game so struggling to do that The collisions don't appear to be occurring at 0,0 - I get my code to throw up the coordinate of the sprite that collides and it's non zero.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 2nd Feb 2016 15:05
When you do reposition your sprite, it sometimes helps to set the SpriteShape again. Especially important after re-sizing or re-scaling a sprite.

Login to post a reply

Server time is: 2024-11-25 11:37:41
Your offset time is: 2024-11-25 11:37:41