home *** CD-ROM | disk | FTP | other *** search
- class Engine.PongSFX
- {
- static var target;
- static var __music;
- static var __musicID;
- static var __bounceSnd;
- static var SND_BRICK_EXPLODE = "brick_explode";
- static var SND_GOAL_CHEER = "goal_cheer";
- static var SND_GOAL_OHH = "goal_ohh";
- static var SND_GOAL = "goal_sound";
- static var SND_ICON_REVEAL = "icon_reveal";
- static var SND_ITEM_PICKUP_BAD = "item_pickup_bad";
- static var SND_ITEM_PICKUP_GOOD = "item_pickup_good";
- static var SND_PADDLE_ICE = "paddle_ice";
- static var SND_PADDLE_TRANSFORM = "paddle_transform";
- static var SND_PUCK_BOUNCE = "puck_bounce";
- static var SND_PUCK_PADDLE = "puck_paddle_contact";
- static var SND_PUCK_RELEASE = "puck_release";
- static var SND_MISSILE_TAKEOFF = "missile_takeoff";
- static var MUSIC_LOOPS = ["music1","music2","music3"];
- function PongSFX()
- {
- }
- static function setTarget(newTarget)
- {
- Engine.PongSFX.target = newTarget;
- Engine.PongSFX.__music = new Sound(Engine.PongSFX.target);
- Engine.PongSFX.__music.setVolume(120);
- }
- static function stopMusic()
- {
- Engine.PongSFX.__music.stop(Engine.PongSFX.__musicID);
- }
- static function startMusic()
- {
- Engine.PongSFX.stopMusic();
- if(Engine.PongSFX.__musicID == undefined)
- {
- return undefined;
- }
- Engine.PongSFX.__music.attachSound(Engine.PongSFX.__musicID);
- Engine.PongSFX.__music.start(null,20000);
- }
- static function setMusic(levelNum)
- {
- var _loc2_ = Engine.PongSFX.MUSIC_LOOPS.length;
- var _loc1_ = levelNum;
- while(_loc1_ >= _loc2_)
- {
- _loc1_ -= _loc2_;
- }
- Engine.PongSFX.__musicID = Engine.PongSFX.MUSIC_LOOPS[_loc1_];
- }
- static function playBounce()
- {
- if(Engine.PongSFX.__bounceSnd == undefined)
- {
- Engine.PongSFX.__bounceSnd = new Sound(Engine.PongSFX.target);
- Engine.PongSFX.__bounceSnd.attachSound(Engine.PongSFX.SND_PUCK_BOUNCE);
- }
- Engine.PongSFX.__bounceSnd.start();
- }
- static function playSound(soundID, delay)
- {
- if(delay == undefined)
- {
- delay = 0;
- }
- var _loc1_ = new Sound(Engine.PongSFX.target);
- _loc1_.attachSound(soundID);
- _loc1_.start(delay);
- }
- static function playCatchGoodItem(itemID)
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_ITEM_PICKUP_GOOD);
- }
- static function playCatchBadItem(itemID)
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_ITEM_PICKUP_BAD);
- }
- static function playBreakBrick()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_BRICK_EXPLODE);
- }
- static function playPuckPaddle()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_PUCK_PADDLE);
- }
- static function playReleaseItem()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_ICON_REVEAL);
- }
- static function playMissileTakeOff()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_MISSILE_TAKEOFF);
- }
- static function playPuckRelease()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_PUCK_RELEASE);
- }
- static function playPaddleChange()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_PADDLE_TRANSFORM);
- }
- static function playPaddleFreeze()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_PADDLE_ICE);
- }
- static function playGoal()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL);
- }
- static function playGoalCheer()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL_CHEER);
- }
- static function playGoalOhh()
- {
- Engine.PongSFX.playSound(Engine.PongSFX.SND_GOAL_OHH);
- }
- }
-