[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Collision Detection -- Part 2



thanks Guillaume (our names 'sound' alike),

i don't think this is right. i took the 5 pix not really as a margin. I just
said that the screen was 5px smaller. i did this because i have a hitbox
rect which is smaller than the sprite itself, so if the hitbox hit the wall,
a part of the sprite was already outside the screen.

does anyone have an example game somewhere which does something similar? i
couldn't really find any suitable examples in my pygame installation.


thanks,

guyon


> Hi Guyon,
>
> I read very quickly through your code, but I have a strange impression.
> That as soon as you are colliding with a wall you end up preventing any
> movement from your bot just because it is colliding. Actually I think
> your 5 pixel margin is your trouble.
> Imagine you get to the point where you are colliding with the wall. Even
> if you tried to make a movement to go back (let's say 1,2 pixels), you
> would still be in your 5 pixel margin...
> and as you reset your position to the old position, you get stuck.
>
> You should better make a collision check with 0 pixel margin.
>
> Have you already tried it?
>
> cheers,
>
> Guillaume
>
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org



____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org