Saturday, May 1, 2010

2D Particles: Part 4 Using the Current Engine

So short tutorial today that will cover adding in our current particle engine to a simple game. Jumping right into it all we need to declare in game1 will be a position vector and our engine.
The following code is optional and will remove the 60 frame rate limitation which shows that the engine doesn't rely on the default frame rate, I also changed the screen resolution so that it had more room to show the particles.
Next were simply going to load in our circle image that you can download from the source code at the bottom. We also set the position to the center of the screen for now.
We need to update our engine with a simple update call in the Update method.
And our final piece will be our drawing, just one line this time since our engine has its own begin and end.
Very short tutorial I know but I didn't want to make the last tutorial any longer than it was. Also I suggest playing around with the numbers from the particle engine class such as speed, rotation speed and amount to see exactly how they interact and how they look as we will be changing them and the more you know the easier it is to understand. Also I changed the speed and amount in the particle engine for the source download to make it look more interesting. Next tutorial we will start adding in variables to make our particles unique and much better looking.

You are free to use or modify this source in any way it is for learning purposes.

2 comments:

  1. I am enjoying this tutorial, thank you.

    ReplyDelete
  2. thank you, very appreciated!

    ReplyDelete