Guest User

Untitled

a guest
Feb 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function releaseChips(X:Number, Y:Number):void
  2.         {
  3.            
  4.             var particles:int = 5;
  5.            
  6.             for (var i:int; i < particles; i++)
  7.             {
  8.                 chip = recycle(ChipSprite) as ChipSprite; //You will want to only set up some of this stuff once, so extend FlxSprite
  9.                 //chip.loadGraphic(chipsPNG, true, false, 16, 16, false); //do these 3 lines inside the ChipSprite
  10.                 //chip.addAnimation("Default", [0, 1, 2, 3, 4, 5], 20, true);
  11.                 //chip.play("Default");
  12.                 chip.x = X + 8; //This stuff still needs to get set after recycling, so leave it here
  13.                 chip.y = Y + 8;
  14.                 chip.velocity.x = FlxMath.rand(-50, 50) ; //This will have to be set using FPT, not sure how to use that.
  15.                 chip.velocity.y = FlxMath.rand(-50, 50) ;
  16.                 chip.acceleration.y = 50; //Do you still want this?
  17.                 chip.exists = true; //Need to make sure you set this to false when you're done with them
  18.                 //expGrp.add(chip); //This is taken care of by recycling
  19.                
  20.                 distance = FlxVelocity.distanceBetween(chip, Registry.player);
  21.                
  22.                 //chipTimer.reset(3000);
  23.                
  24.                 //trace(chipTimer);
  25.             }
  26.                        
  27.             //add(expGrp); //Don't add new groups, instead recycle the chips
  28.            
  29.         }
Add Comment
Please, Sign In to add comment