News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Particle Demo

Started by Makeii Runoru, October 15, 2008, 11:48:06 AM

Previous topic - Next topic

Makeii Runoru

This is a little sample of me creating a small particle demo using animated bitmaps. I actually did not use any animation commands to create the particles partly because I am taking it a little slow. Attached is the folder for using the particle demo.

One of the problems I encountered while making this was that i was having a hard time sorting used array cells to the lowest elements (0+) and resizing the array so that it fits the current cells used when particles were deleted when their lifespan <= 0.

I solved the problem temporarily by using a particle counter integer that scrolls between 1 and 100 and resets back to 0 if it goes over 100. However, this means that only 100 particles can be defined on the screen simultaneously, unless I increased the array to something more and allowed the counter to move up to that array's max.

EDIT: CONTROLS:

Just hold down the mouse button to spawn random particles close to the mouse's cursor. the particles will appear randomly -20 to 20 pixels from the mouse's point. Because I didn't do image handling, the particles' topleft corner indicates their hotspot, so it may seem that when you hold down the button, they are spawning under the arrow itself and notthe arrow's actual point.
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

Juha Kämäräinen

Nice job man :)
I just tested it.  You could create some nice basic 2D blaster game effect with that
Check out my comic - Bujercon 1

kevin

#2
 Didn't notice this demo was here,  looks good, you've done well.

I've re-arranged you're example a little to use lists,  this way there's no fixed particle limit or allocation / release issues.  see attached.



Related Examples:

     Particles Demo Using Sprites


Original Example Attached