Sign in to follow this  

Simple 2D Particle Effects?

This topic is 3932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this