[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Rect collision by direction



Sounds like you aren't canceling the downward vector of motion. Make sure that all vectors, left, right, down, etc, are made zero when a collision happens, THEN set them to the proper values if you want a bounce response.

On Sat, Jun 6, 2009 at 8:41 AM, pymike <pymike93@xxxxxxxxx> wrote:
Hi, I wrote a tutorial on this:
http://pymike.pynguins.com/?page=tutorials&id=1

HTH


On Sat, Jun 6, 2009 at 1:33 PM, Skizzaltix <waterflight@xxxxxxxxxxxxx> wrote:
Hello,
I've been trying to find a way to, when detecting collisions between two sprites, determine which side of one sprite is colliding with the other. Basically, I want to make it so that when a character walking to the left collides with a block to his/her left, he/she stops moving, but if the character is moving slightly downwards, he/she will continue moving down, but stop moving to the left.
I'm sure there's some simple solution to this, which I have been missing entirely.
Thanks!
--Skizzaltix



--
- pymike



--
Visit my blog at http://oddco.ca/zeroth/zblog