Simple 2D Particle Effects?

Started by
0 comments, last by hereticprophecy 17 years, 1 month ago
Hey all! I was just wondering, what would be the best way to get started on playing with very simple 2D particle effects in a 2D sidescrolling game? The game uses all ascii art and is done by printing all screen objects to a buffer, and then printing this buffer to the screen. I'm trying to make some function that will allow me to pass an x and y position and then at that spot, spawn several '.' characters that shoot out in random directions each time, and fall at rates that mimic basic gravity. Any suggestions/ideas on how to get started? I would really appreciate any input. Thanks all, in advance!
Advertisement
Sounds like your best bet would be to create a 2d array sized as your screen and use that to mimic a Cartesian plane. Each member of the array can be drawn directly to the screen with the proper library, but if you're not into that, you can load the 2d array into your buffer and draw from there. That should help you stay organized with the basic layout.

For the random period fountain, you can add a vector (or array, whatever floats you) that contains pointers to the different object on your screen that are in motion. Iterate through the vector and move each object one by one after checking for collisions. Making them move according to simple gravity shouldn't be that difficult. If you don't want the fountain to emit periods ever loop, you can either put a timer on it or put a delay into it.

This topic is closed to new replies.

Advertisement