Skip to content

Instantly share code, notes, and snippets.

@glcoder
Created April 21, 2012 15:45
Show Gist options
  • Save glcoder/2437885 to your computer and use it in GitHub Desktop.
Save glcoder/2437885 to your computer and use it in GitHub Desktop.
Patch for Flixel's FlxEmitter
diff -Bbwur AdamAtomic-flixel-8989e50/org/flixel/FlxEmitter.as AdamAtomic-flixel-8989e50-new/org/flixel/FlxEmitter.as
--- AdamAtomic-flixel-8989e50/org/flixel/FlxEmitter.as 2011-08-22 09:03:52 +0400
+++ AdamAtomic-flixel-8989e50-new/org/flixel/FlxEmitter.as 2012-04-21 19:11:42 +0400
@@ -123,7 +123,7 @@
minRotation = -360;
maxRotation = 360;
gravity = 0;
- particleClass = null;
+ particleClass = FlxParticle;
particleDrag = new FlxPoint();
frequency = 0.1;
lifespan = 3;
@@ -177,9 +177,6 @@
var i:uint = 0;
while(i < Quantity)
{
- if(particleClass == null)
- particle = new FlxParticle();
- else
particle = new particleClass();
if(Multiple)
{
@@ -290,7 +287,7 @@
*/
public function emitParticle():void
{
- var particle:FlxParticle = recycle(FlxParticle) as FlxParticle;
+ var particle:FlxParticle = recycle(particleClass) as FlxParticle;
particle.lifespan = lifespan;
particle.elasticity = bounce;
particle.reset(x - (particle.width>>1) + FlxG.random()*width, y - (particle.height>>1) + FlxG.random()*height);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment