On Aug 1, 11:30 am, George Oliver <[email protected]> wrote:

> in Player.collide, there's this:
>
>                 pr = self.right - self.dx
>                 pl = self.left - self.dx
>                 pt = self.top - self.dy
>                 pb = self.bottom - self.dy
>
> Do you want to subtract self.dx from right -and- left?


Also, sorry, I meant to paste in one more thing:


def rect_collide(sp1, sp2):
        if sp1.left > sp2.right: return False
        if sp1.right < sp2.left: return False
        if sp1.bottom > sp2.top: return False
        if sp1.top < sp2.bottom: return False
        return True


What if you have a situation like this:

        ---------
        |  sp2  |
        |       |
    ----|----   |
    |   ----|-----
    |       |
    |  sp1  |
    ---------

These boxes are colliding, but your first test returns false. Instead
of returning false, pass the check through to the next condition.
--~--~---------~--~----~------------~-------~--~----~
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