[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Collision detection
On Wed, 5 Oct 2005, Matt Bailey wrote:
> The time has come in my current game to work on collision
> detection. Always before I've done basic detection....like, a simple
> rect colliding with another rect that always moves by a discrete XY
> displacement, no rotation, no physics, etc. Right now I'm doing a
> simple (haww....well, it's supposed to be) top-down racer. The car
> turns and goes where it's pointed, as opposed to simply "sliding" in
> the style of the old arcade racers.
So are you saying you want to start doing real
physics? If so, you might take a look at pyODE.
We used it in our pyweek entry (which didn't get
finished) and it was pretty helpful.
Basically we just built 3d physics world for
ODE to play with and then watched that model
to figure out where to put the 2D sprites. So
when you want to move your car(s) around, you
just apply the appropriate force to the car
object(s)...
The code is here:
https://blazeofglory.org/
under cvs... see room.py for how the room world
is built; physics.py and roomphysics.py and
hero.py for the collision and motion stuff... then
render.py for how to show the stuff on
the screen...
Sincerely,
Michal J Wallace
Sabren Enterprises, Inc.
-------------------------------------
contact: michal@xxxxxxxxxx
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
-------------------------------------