game-programming-patterns
game-programming-patterns copied to clipboard
Object Pool / free list – Show how particles are initialized
After moving the particle's state under the live union, it should also show an updated init() method where that state is set. Something like:
void init(double x, double y,
double xVel, double yVel, int lifetime)
{
live.x = x;
live.y = y;
live.xVel = xVel;
live.yVel = yVel;
framesLeft_ = lifetime;
}