home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / smashout.swf / scripts / __Packages / Engine / PongSFX.as < prev    next >
Encoding:
Text File  |  2005-11-09  |  3.6 KB  |  122 lines

  1. class Engine.PongSFX
  2. {
  3.    static var target;
  4.    static var __music;
  5.    static var __musicID;
  6.    static var __bounceSnd;
  7.    static var SND_BRICK_EXPLODE = "brick_explode";
  8.    static var SND_GOAL_CHEER = "goal_cheer";
  9.    static var SND_GOAL_OHH = "goal_ohh";
  10.    static var SND_GOAL = "goal_sound";
  11.    static var SND_ICON_REVEAL = "icon_reveal";
  12.    static var SND_ITEM_PICKUP_BAD = "item_pickup_bad";
  13.    static var SND_ITEM_PICKUP_GOOD = "item_pickup_good";
  14.    static var SND_PADDLE_ICE = "paddle_ice";
  15.    static var SND_PADDLE_TRANSFORM = "paddle_transform";
  16.    static var SND_PUCK_BOUNCE = "puck_bounce";
  17.    static var SND_PUCK_PADDLE = "puck_paddle_contact";
  18.    static var SND_PUCK_RELEASE = "puck_release";
  19.    static var SND_MISSILE_TAKEOFF = "missile_takeoff";
  20.    static var MUSIC_LOOPS = ["music1","music2","music3"];
  21.    function PongSFX()
  22.    {
  23.    }
  24.    static function setTarget(newTarget)
  25.    {
  26.       Engine.PongSFX.target = newTarget;
  27.       Engine.PongSFX.__music = new Sound(Engine.PongSFX.target);
  28.       Engine.PongSFX.__music.setVolume(120);
  29.    }
  30.    static function stopMusic()
  31.    {
  32.       Engine.PongSFX.__music.stop(Engine.PongSFX.__musicID);
  33.    }
  34.    static function startMusic()
  35.    {
  36.       Engine.PongSFX.stopMusic();
  37.       if(Engine.PongSFX.__musicID == undefined)
  38.       {
  39.          return undefined;
  40.       }
  41.       Engine.PongSFX.__music.attachSound(Engine.PongSFX.__musicID);
  42.       Engine.PongSFX.__music.start(null,20000);
  43.    }
  44.    static function setMusic(levelNum)
  45.    {
  46.       var _loc2_ = Engine.PongSFX.MUSIC_LOOPS.length;
  47.       var _loc1_ = levelNum;
  48.       while(_loc1_ >= _loc2_)
  49.       {
  50.          _loc1_ -= _loc2_;
  51.       }
  52.       Engine.PongSFX.__musicID = Engine.PongSFX.MUSIC_LOOPS[_loc1_];
  53.    }
  54.    static function playBounce()
  55.    {
  56.       if(Engine.PongSFX.__bounceSnd == undefined)
  57.       {
  58.          Engine.PongSFX.__bounceSnd = new Sound(Engine.PongSFX.target);
  59.          Engine.PongSFX.__bounceSnd.attachSound(Engine.PongSFX.SND_PUCK_BOUNCE);
  60.       }
  61.       Engine.PongSFX.__bounceSnd.start();
  62.    }
  63.    static function playSound(soundID, delay)
  64.    {
  65.       if(delay == undefined)
  66.       {
  67.          delay = 0;
  68.       }
  69.       var _loc1_ = new Sound(Engine.PongSFX.target);
  70.       _loc1_.attachSound(soundID);
  71.       _loc1_.start(delay);
  72.    }
  73.    static function playCatchGoodItem(itemID)
  74.    {
  75.       Engine.PongSFX.playSound(Engine.PongSFX.SND_ITEM_PICKUP_GOOD);
  76.    }
  77.    static function playCatchBadItem(itemID)
  78.    {
  79.       Engine.PongSFX.playSound(Engine.PongSFX.SND_ITEM_PICKUP_BAD);
  80.    }
  81.    static function playBreakBrick()
  82.    {
  83.       Engine.PongSFX.playSound(Engine.PongSFX.SND_BRICK_EXPLODE);
  84.    }
  85.    static function playPuckPaddle()
  86.    {
  87.       Engine.PongSFX.playSound(Engine.PongSFX.SND_PUCK_PADDLE);
  88.    }
  89.    static function playReleaseItem()
  90.    {
  91.       Engine.PongSFX.playSound(Engine.PongSFX.SND_ICON_REVEAL);
  92.    }
  93.    static function playMissileTakeOff()
  94.    {
  95.       Engine.PongSFX.playSound(Engine.PongSFX.SND_MISSILE_TAKEOFF);
  96.    }
  97.    static function playPuckRelease()
  98.    {
  99.       Engine.PongSFX.playSound(Engine.PongSFX.SND_PUCK_RELEASE);
  100.    }
  101.    static function playPaddleChange()
  102.    {
  103.       Engine.PongSFX.playSound(Engine.PongSFX.SND_PADDLE_TRANSFORM);
  104.    }
  105.    static function playPaddleFreeze()
  106.    {
  107.       Engine.PongSFX.playSound(Engine.PongSFX.SND_PADDLE_ICE);
  108.    }
  109.    static function playGoal()
  110.    {
  111.       Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL);
  112.    }
  113.    static function playGoalCheer()
  114.    {
  115.       Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL_CHEER);
  116.    }
  117.    static function playGoalOhh()
  118.    {
  119.       Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL_OHH);
  120.    }
  121. }
  122.