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

Re: [pygame] My take on platform collision detection



> First off, the method of collision detection where you are always
> checking if you overlap a platform is faulty-
> Because when you are moving fast eg. falling, you can move many pixels
> in one frame, meaning that in one frame you are above a platform and
> the next you are below it,  When I was making my first platform I had
> this problem, so If I was falling from a height the guy could build up
> enough speed to fall through the floor.
> You can work around this problem by capping the maximum moving speed,
> but it can look like you are floating when you are falling
> and still leaves room for error (jumping on to a moving platform) BTW
> all console platform games I have seen cap the fall speed and some
> even the jump speed.
> 

Yeah, that's the strategy I've used.  You cap the fall speed at X, and
then you have to make sure all of your platforms have a rect at least X
pixels in height.

I think you really MUST cap your fall speed, no matter what strategy you
employ.  If the charactor falls at anything over his height per frame, I
don't think he'd be controllable.

-- 
+-------------------------------------------------------------+
| Shandy Brown                               Digital Thinkery |
| shandy@geeky.net             http://www.digitalthinkery.com |
+-------------------------------------------------------------+

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