Author Topic: [v1.27] Emitters, Particles, and Collisions  (Read 1435 times)

Markham

  • Guest
[v1.27] Emitters, Particles, and Collisions
« on: Sun, Dec 6, 2009 »
I had problems with particles getting them to collide with the latest provided source.  I eventually figured out that it was because the emitter wasn't changing the "last" location of the sprite.  The following is how to fix it:

File: FlxEmitter.as, function "emit"
At line 113, change this block of code:
Code: [Select]
s.x = x - (s.width>>1);
if(width != 0) s.x += FlxG.random()*width;
s.y = y - (s.height>>1);
if(height != 0) s.y += FlxG.random()*height;
to this:
Code: [Select]
s.x = x - (s.width>>1);
if(width != 0) s.x += FlxG.random()*width;
s.last.x = s.x
s.y = y - (s.height>>1);
if(height != 0) s.y += FlxG.random()*height;
s.last.y = s.y;

OnionsXD

  • Guest
Re: [v1.27] Emitters, Particles, and Collisions
« Reply #1 on: Tue, Dec 8, 2009 »
I wish I could help but I don't really a\understand ANY of this coding stuff.....

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: [v1.27] Emitters, Particles, and Collisions
« Reply #2 on: Wed, Dec 9, 2009 »
ah good catch, i'll change the emitter to use the new reset() function instead of manually messing with the X and Y values!  thanks