home *** CD-ROM | disk | FTP | other *** search
- package core.bonuses
- {
- import Box2D.Collision.Shapes.b2Shape;
-
- public class BonusElastic extends AbstractBonus
- {
-
-
- private var normalElasticity:Number;
-
- private var highElasticity:Number;
-
- private var platformShape:b2Shape;
-
- public function BonusElastic()
- {
- super(true);
- }
-
- override protected function deactivate() : void
- {
- super.deactivate();
- platformShape.m_restitution = normalElasticity;
- }
-
- override protected function initSounds() : void
- {
- var ElasticBonusClass:Class = engine.assets.getAssetClass("SndElasticBonus");
- sndActivate = new ElasticBonusClass();
- }
-
- override public function activate(activateTime:Number) : void
- {
- super.activate(activateTime);
- platformShape.m_restitution = highElasticity;
- }
-
- override protected function init() : void
- {
- super.init();
- lifeTime = 40 * 8;
- platformShape = engine.platform.getBody().m_shapeList;
- normalElasticity = platformShape.m_restitution;
- highElasticity = 1;
- }
- }
- }
-