Skip to content

Commit

Permalink
Clear particles when we die.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChickenProp committed Jul 27, 2012
1 parent f54ec1d commit 6281add
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/BreakoutWorld.hx
Expand Up @@ -121,6 +121,7 @@ class BreakoutWorld extends World {
paddle = G.paddle = new Paddle();
add(paddle);
placeBall();
MyParticle.clear();

var seed:Int = 0;
if (level < seeds.length)
Expand Down
9 changes: 9 additions & 0 deletions src/MyParticle.hx
Expand Up @@ -85,4 +85,13 @@ class MyParticle {
for (i in 0...particles.length)
particles[i].render();
}

public static function clear () : Void {
for (i in 0...particles.length) {
particles[i].recycleNext = recycleFirst;
recycleFirst = particles[i];
}

particles = [];
}
}

0 comments on commit 6281add

Please sign in to comment.