a guest Feb 19th, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public function releaseChips(X:Number, Y:Number):void
- var particles:int = 5;
- for (var i:int; i < particles; i++)
- chip = recycle(ChipSprite) as ChipSprite; //You will want to only set up some of this stuff once, so extend FlxSprite
- //chip.loadGraphic(chipsPNG, true, false, 16, 16, false); //do these 3 lines inside the ChipSprite
- //chip.addAnimation("Default", [0, 1, 2, 3, 4, 5], 20, true);
- chip.x = X + 8; //This stuff still needs to get set after recycling, so leave it here
- chip.y = Y + 8;
- chip.velocity.x = FlxMath.rand(-50, 50) ; //This will have to be set using FPT, not sure how to use that.
- chip.velocity.y = FlxMath.rand(-50, 50) ;
- chip.acceleration.y = 50; //Do you still want this?
- chip.exists = true; //Need to make sure you set this to false when you're done with them
- //expGrp.add(chip); //This is taken care of by recycling
- distance = FlxVelocity.distanceBetween(chip, Registry.player);
- //add(expGrp); //Don't add new groups, instead recycle the chips
RAW Paste Data