Commits

Anonymous committed fcc8d93

sound effects roll in

  • Participants
  • Parent commits 8a0fe92

Comments (0)

Files changed (8)

 		[Embed(source = 'data/bg.png')]
 		public static const ImgBg:Class;
 		
+		[Embed(source = 'data/indicate.mp3')]
+		public static const SndIndi:Class;
+		
+		[Embed(source = 'data/playstart.mp3')]
+		public static const SndPlay:Class;
+		
+		[Embed(source = 'data/spawn.mp3')]
+		public static const SndSpawn:Class;
+		
 		public static var levelArr:Array = [
 			Level0,
 //			Fan, // most easy
 	
 	import net.flashpunk.Entity;
 	import net.flashpunk.FP;
+	import net.flashpunk.Sfx;
 	import net.flashpunk.World;
 	import net.flashpunk.debug.Console;
 	import net.flashpunk.graphics.Backdrop;
 		private var _bgstripe:Entity;
 		private var _panel:Panel;
 		private var _text:Entity;
+		private var _playsfx:Sfx;
+		private var _spawnsfx:Sfx;
 		
 		private var _phase:int;
 		private var _framecnt:int;
 			Text(_text.graphic).size = 8;
 			_text.visible = false;
 			_textcnter = 0;
+			_playsfx = new Sfx(Au.SndPlay);
+			_spawnsfx = new Sfx(Au.SndSpawn);
 			
 			add(_bgplain);
 			add(_bgstripe);
 				}
 			} else if (_phase == WAIT_PHASE) {
 				if (_framecnt == Au.WAIT_TIME) {
+					_playsfx.play();
 					switchPhase(PLAY_PHASE);
 				}
 			} else if (_phase == PLAY_PHASE) {
 			} else if (_phase == HOLD_PHASE) {
 				if (_framecnt == Au.HOLD_TIME) {
 					if (player.active == false) {
+						_spawnsfx.play();
 						player.reset(47, 47);
 					}
 					if (++_curwave < _levelwaves) {
 		private function gameover():void
 		{
 			_phase = GAME_OVER;
-			player.kill();
+			// leave player control able
+			// TODO emits
+//			if (player.active) {
+//				player.active = false;
+//				player.visible = false;
+//			}
 		}
 	}
 }
 	import net.flashpunk.Entity;
 	import net.flashpunk.Graphic;
 	import net.flashpunk.Mask;
+	import net.flashpunk.Sfx;
 	import net.flashpunk.World;
 	import net.flashpunk.graphics.Canvas;
 	import net.flashpunk.graphics.Emitter;
 		private static var _removehead:Canvas;
 		public static var pemit:Emitter;
 		private static var _indivec:Array;
+		private static var _indisfx:Sfx;
 		
 		public static function staticInit(world:World):void
 		{
 			_removehead = new Canvas(1, 1);
 			pemit = new Emitter(Au.ImgDot, 1, 1);
 			_indivec = new Array();
+			_indisfx = new Sfx(Au.SndIndi);
 			
 			_head.fill(new Rectangle(0, 0, 1, 1), Au.HEADCOLOR);
 			_removehead.fill(new Rectangle(0, 0, 1, 1), Au.REMVCOLOR);
 		{
 			for (var ix:int = 0; ix < AMOUNT; ++ix) {
 				if (!_indivec[ix].active) {
+					_indisfx.play(0.5);
 					_indivec[ix].reset(Ob);
 					return;
 				}
 	import net.flashpunk.Entity;
 	import net.flashpunk.FP;
 	import net.flashpunk.Mask;
+	import net.flashpunk.Sfx;
 	import net.flashpunk.graphics.Emitter;
 	import net.flashpunk.graphics.Spritemap;
+	import net.flashpunk.utils.Draw;
 	import net.flashpunk.utils.Input;
 	import net.flashpunk.utils.Key;
-	import net.flashpunk.utils.Draw;
 	
 	public class Player extends Entity
 	{
 		[Embed(source = 'data/ship.png')]
 		private const ImgShip:Class;
+		
+		[Embed(source = 'data/die.mp3')]
+		private const SndDie:Class;
+		
 		private const NORMVELO:Number = 1.0;
 		private const SLOWVELO:Number = 0.5;
 		
 		public var deathcount:int;
 		private var _velocity:Number;
 		private var _flickcnt:int;
+		private var _diesnd:Sfx;
 		
 		public function Player(x:Number=0, y:Number=0)
 		{
 			Input.define("slow", Key.SHIFT);
 			
 			type = "ship"; // MUST set type after super
+			
 			// init
 			deathcount = 0;
 			_flickcnt  = 0;
+			_diesnd = new Sfx(SndDie);
 		}
 		
 		override public function update():void
 			for (var ix:int = 0; ix < 40; ++ix) {
 				_pemit.emit("explode", x-originX, y-originY);
 			}
+			_diesnd.play();
 		}
 		
 		public function reset(X:Number, Y:Number):void

data/die.mp3

Binary file added.

data/indicate.mp3

Binary file added.

data/playstart.mp3

Binary file added.

data/spawn.mp3

Binary file added.