Welcome to Phrogram Sign in | Join | Help


Re: Collision Coding

  •  12-28-2006, 9:16 AM

    Re: Collision Coding

    What we really need is a sprite.Intersects() variant that returns either the actual point where the intersection occurs or the offset into the sprite of the intersection point.  The collision detection feature is very nice, but if you need to know exactly where the sprite hit its difficult. 

    For example, in a road racing game you might want to change the sprite to display an image of a damaged car if it crashes into a wall.  But, you'd need to know which part of the car crashed to be able to display the correct damage. This is relatively straightforward if the road is an oval but what if it's irregular.  If the front of the car crashes into the outer wall on a hairpin turn just the act of rotating away from the wall will likely cause another interaction between the wall and the rear of the car.  It would be helpful to know which point within the sprite actually made contact rather than trying to figure it out myself... especially since the intersects() function already knows it.

    Filed under: ,
View Complete Thread