> If there is a collision,
> move the sprite back towards the original position (in a loop,
> pixel-by-pixel) until no collision occurs.


I am not sure how to do this, if the sprite did not move in a straight
line.

I stumbled on to this today:  
http://en.wikipedia.org/wiki/Bresenham's_line_algorithm

I have not had a chance to really grok it yet, but it looks like a
step in the right direction.  Has anyone done anything like this in
Python?  Are there other ways to accomplish this?


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 using an algorithm like the one I
listed above, until I collide with something. That would solve the
"moving through objects because I was going fast" problem.  I think
that would also solve the "what side did I hit?" issue.  But it seems
like this would be very slow...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to