Ryan wrote: > Right now, I am thinking this: Instead of changing a moving sprite's > X/Y, then doing collision checking, I should loop forward from its > starting point, 1 "step" at a time
If the collision shapes are assumed to be rectangles, and the objects are moving in a straight line with constant speed, then you don't need to move it a step at a time -- you can directly calculate the time at which the two rectangles begin to touch. Do this twice, once for the x direction and once for the y direction. Whichever of these gives you the earliest collision time tells you which side they collided on. This technique can also help you deal with the problem of objects passing through each other due to large time steps. Find all the objects that the sprite could possibly collide with (perhaps using a bounding rectangle) and calculate the collision time with each one. The object having the earliest collision time is the one that gets hit. -- Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
