[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Background and collision detection in Lunar Lander game
Leonardo Santagada wrote:
> You can look in the pygame ftp, there is a file named petephysics.tar.gz.
> It has an example of this kind of collision detection that you need. I
> don't know who did it but you won't need to copy the code because it is
> based in a gamasutra article, from there you could do your own
> implementation. I would like to see this code in the pcr if the
> author give us permission.
heh, it's not quite in the pcr, i'd want to clean it up a little before
submitting it. it is in the pygame 'contrib' directory in the ftp area.
the code does "ball" to "line" collision detection. for a lunar lander game
it could work really well. the only limitation is the collision is really
based on a sphere, so your ship would need to be "roundish". (hmm,
something like the ET spaceship)
i've written the code to do a very cool sidescroller, but that day may
never come. you'll need to get into the physics module to change the
collision reactions a bit. currently they are set to "bounce and slide".
the example code has a bitmap image of the background, then in gimp i
created a "vector" shape around the surfaces. the program reads those
exported vectors and that is what the player interacts with.
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org