PDA

View Full Version : Exploding sprites - turbopixels?



nzo2
04-01-2005, 12:16 AM
I would like to explode sprites using something like the TurboPixels unit.
Trouble is, I would need to reference the original sprite image, not the item on the surface (somewhere for the GetPixels() function to reference) and then render the result to the surface using PutPixels().
What would be the best place to use as the source? or more specifically, what would be the best way to copy pixels from an image to the surface?

thanks

Traveler
04-01-2005, 08:56 AM
At the moment I'm cleaning up sourcecode of my game Pop the Balloon. In that game I let balloons explode into pixels, when you click on them. It pretty much covers what you ask.
When the 'Making of' is ready, somewhere later this week, I'll release it all on my website, so you can take a peek.

http://www.gameprogrammer.net/pics/outside/st4_l3.jpg

In the meantime, here are a few tips.
Take your origional image and loop through its surface. Check for each pixel, if its the transparant color, do nothing, if its no transparant pixel, create, copy, mark, whatever, a new pixel.

I'm not sure how large your sprite is, and how many of these sprites have to explode at the same time, but I would advice to go easy on the number. DelphiX, isn't the fastest engine in the world.

nzo2
04-01-2005, 12:40 PM
Thanks for that. I looked at your site the other day, and it's very good - the tutorials are excellent.
I have been planning to make a version of Robotron (what - another one!) but only now - after quite a time playing with DelphiX - am ready to try. I can sympathise with you regarding having time to spend on this kind of thing, and the issues of collaboration and graphics production.

I managed to find a way of doing this already, but modifying the turbopixels unit to get and put to/from different surfaces, and it works just fine. I originally used the original pixels[x,y] but this was horrendously slow. Thankfully, turbopixels is sufficiently faster.
Some exploding sprites (in robotron) can be "exploded" by row (so maybe I can use scanline or something here to save time). I am not using large sprites as I aim to have up to 1000 robots at any one time.

With all of the info I have gathered regarding collision issues (previously my biggest concern) I am looking forward to making some headway with this project at long last!

cheers