Posted: Thu Mar 21, 2002 9:33 am
Restored from previous forum. Originally posted by Schlowski.
Hello again,
I began to write my own pixel-perfect collision detection (and then I saw Freds anouncement ). But as I make this for my own, pure fun, I want to continue my work.
My problem is that I don't have any idea how I get access to the real bitmap in a sprite, so for the moment I made my own 'collision masks' which are raw 8bit per pixel data streams.
But it would be nicer to use the loaded sprites so I don't have to make a mask for every sprite I use.
Has anyone (Fred ) an idea how to get a pointer to the sprite bitmap?
For the interested, I make the brutal force approach, allocating memory in size of the screen and putting bytes in for every set pixel in my masks and querying these bytes for collision detection. Echa sprite gets his own id in the range from 1 to 255, so I can directly determine with which sprite my object collides.
This seemed to me the right approach for detection collisions between hundreds of blocks and tons of balls (right, I'm writing on a breakout-clone, simple but addicting) opposed to checking every ball with every block which can grow to a large number of compares...
Björg
Hello again,
I began to write my own pixel-perfect collision detection (and then I saw Freds anouncement ). But as I make this for my own, pure fun, I want to continue my work.
My problem is that I don't have any idea how I get access to the real bitmap in a sprite, so for the moment I made my own 'collision masks' which are raw 8bit per pixel data streams.
But it would be nicer to use the loaded sprites so I don't have to make a mask for every sprite I use.
Has anyone (Fred ) an idea how to get a pointer to the sprite bitmap?
For the interested, I make the brutal force approach, allocating memory in size of the screen and putting bytes in for every set pixel in my masks and querying these bytes for collision detection. Echa sprite gets his own id in the range from 1 to 255, so I can directly determine with which sprite my object collides.
This seemed to me the right approach for detection collisions between hundreds of blocks and tons of balls (right, I'm writing on a breakout-clone, simple but addicting) opposed to checking every ball with every block which can grow to a large number of compares...
Björg