In my Flashpunk-inspired framework Indigo, I have a method on my Emitter class that allows me to simulate the passage of time. It allows you to work around ugly effects like snow that doesn't start until you load the world. I'd like to integrate this functionality into Flashpunk as a way to give back. It's a really useful feature and I miss it whenever I'm not using my engine.
Here's how I use it in Indigo (C# syntax of course):
var simFrames = FP.Framerate; // simulate running the emitter for a full second
for (int frame = 0; frame < simFrames; ++frame)
emitter.Emit("type", 0, 0);
The end result is that 60 frames-worth of particles are emitted in the space of one actual frame, and they position, animate, and fade themselves appropriately.
The only notable change to the rest of the engine is the
FP.engine.interval property, a constant value which is (in the ideal case) equal to
FP.elapsed -- but with the exception that it has a non-zero value before the first frame is run. It's essentially a shortcut for
1f / FP.framerate in variable framerate mode.
So, my reason for bringing this up is to make sure the functions I'm adding make the most sense for everyone involved. Is this something that would be useful to others as a part of Flashpunk? Should
interval be on
FP.engine? Let me hear your thoughts!