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 / Sprite Collision

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 19th Aug 2011 18:58
Hello, I have been messing about with AppGameKit and noticed that sprite collision is as bad as DB's . By that I mean the fact it collides even on the transparent parts of the sprite. I never used DB's collision because of this, and relied on colour collision commands to improve the accuracy. I cannot use this method in AppGameKit because it has no commands to do it ,at least in tier 1.
I know I could probably use the physics to improve collision, but I really want to leave that for when I feel more comfortable with the basics. Is it so hard to get proper sprite collision working? AMOS had it and that was on the Amiga, which by today's standards is rather slow.
I'll probably try to use the circular collision commands for now, but that will probably make the collision a little too good for the player.
I really would like to see this improved in future updates. We need pixel perfect sprite collision!

http://s6.bitefight.org/c.php?uid=103081
Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 19th Aug 2011 21:19
Sprites can either have a box or circle shape assigned to them, or if you need extra accuracy go with a convex hull. You don't really need to mess with any physics commands - just assign your sprites a shape using the SetSpriteShape (http://www.appgamekit.com/documentation/Reference/Sprite/SetSpriteShape.htm) command. This screen shows the differences between shapes and how this impacts collisions:



Give your sprites a convex shape and you end up with very accurate collisions that will be more than acceptable for most circumstances.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 19th Aug 2011 23:00
Ah, I didn't think it would affect the sprites without enabling the physics as it was in the under physics in the manual. Works way better now, thanks for the heads up! I am using the poly option, will this slow things down if I use a lot of sprites?

http://s6.bitefight.org/c.php?uid=103081
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Aug 2011 00:20
Circle would be by far the fastest option, box is really just handled as a 4 sided polygon, with higher point polygons being the slowest, but I haven't stress tested how slow they are compared to each other.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 20th Aug 2011 01:58
Ok, that's fair enough, I will keep it in mind if I use a lot of sprites. Thanks for the info.

http://s6.bitefight.org/c.php?uid=103081

Login to post a reply

Server time is: 2024-04-20 16:25:07
Your offset time is: 2024-04-20 16:25:07