home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / Beez.swf / scripts / core / bonuses / BonusElastic.as < prev    next >
Encoding:
Text File  |  2008-09-03  |  1.2 KB  |  48 lines

  1. package core.bonuses
  2. {
  3.    import Box2D.Collision.Shapes.b2Shape;
  4.    
  5.    public class BonusElastic extends AbstractBonus
  6.    {
  7.        
  8.       
  9.       private var normalElasticity:Number;
  10.       
  11.       private var highElasticity:Number;
  12.       
  13.       private var platformShape:b2Shape;
  14.       
  15.       public function BonusElastic()
  16.       {
  17.          super(true);
  18.       }
  19.       
  20.       override protected function deactivate() : void
  21.       {
  22.          super.deactivate();
  23.          platformShape.m_restitution = normalElasticity;
  24.       }
  25.       
  26.       override protected function initSounds() : void
  27.       {
  28.          var ElasticBonusClass:Class = engine.assets.getAssetClass("SndElasticBonus");
  29.          sndActivate = new ElasticBonusClass();
  30.       }
  31.       
  32.       override public function activate(activateTime:Number) : void
  33.       {
  34.          super.activate(activateTime);
  35.          platformShape.m_restitution = highElasticity;
  36.       }
  37.       
  38.       override protected function init() : void
  39.       {
  40.          super.init();
  41.          lifeTime = 40 * 8;
  42.          platformShape = engine.platform.getBody().m_shapeList;
  43.          normalElasticity = platformShape.m_restitution;
  44.          highElasticity = 1;
  45.       }
  46.    }
  47. }
  48.