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

Re: [pygame] Question about .bmp files and transparency



Erlend Strømsvik wrote:
Next goal will be the terrain. -One must have some terrain which one
can blow sky high! :)
Most likely I will have to use pixel comparison here (with 'Numeric
wizardry' ;) and the fastest thing might be to test on the terrains
alpha layer? I'm not sure but it doesn't seem too stupid... :-|
When a bullet is fired, I could calculate the trajectory at once, so
I'll know where the bullet -should- explode and not having to do pixel
tests inside the bullet update loop.
not sure how your terrain is going to work. another option is creating a second hidden surface with just a few colors and using that to determine which pixels are passable, plus with the colors you can control other effects, like which pixels are unexplodable, etc.

use an 8bit image for this and its easy to work on with Numeric. remember to apply changes to either image to both.

i remember someone recently in the #pygame irc chatroom was doing a driving game with this technique. the collision test code is out there.