View difference between Paste ID: S3A5jqGw and VqvQXt2x
SHOW: | | - or go back to the newest paste.
1
package  {
2
	import flash.media.SoundChannel;
3
	import flash.media.Sound;
4
	import flash.events.Event;
5
	
6
	public class SoundManager {
7
		
8-
		var mainClass:Main;
8+
		var mainClass; // this would be whatever class instantiates your game.
9
		
10-
		var battleLoop:Sound = new BattleLoop1();
10+
		[Embed(source = "../Sounds/GunshotSelect.mp3")]
11
        protected static const gunShotClass:Class;
12-
		var blockDamage:Sound = new BlockDamage();
12+
        var gunShotSound:Sound = new gunShotClass;	
13-
		var blockCrumble:Sound = new BlockCrumble();
13+
14-
		var blockRebound:Sound = new BlockRebound();
14+
		/*[Embed(source = "../Music/MusicLoop.mp3")]
15-
		var ballBounce:Sound = new BallBounce();
15+
        protected static const mainMusicClass:Class;
16
        var mainMusicLoop:Sound = new mainMusicClass;	
17-
		var explosion1:Sound = new Explosion1();
17+
		*/
18-
		var explosion2:Sound = new Explosion2();
18+
19-
		var explosion3:Sound = new Explosion3();
19+
20-
		var explosion4:Sound = new Explosion4();
20+
		var musicChannel:SoundChannel; // not used for sound effects, ignore it for now
21-
		var explosion5:Sound = new Explosion5();
21+
22
		public function SoundManager(mClass) {
23-
		var laser1:Sound = new Laser1();
23+
24-
		var laser2:Sound = new Laser2();
24+
25
		}
26-
		var powerup1:Sound = new Powerup1();
26+
27-
		var powerup2:Sound = new Powerup2();
27+
		/*
28-
		var powerup3:Sound = new Powerup3();
28+
		function startMusic(){
29-
		var powerup4:Sound = new Powerup4();
29+
30-
		var powerup5:Sound = new Powerup5();
30+
31-
		var powerup6:Sound = new Powerup6();
31+
32-
				
32+
		musicChannel = mainMusicLoop.play();
33-
		var musicChannel:SoundChannel;
33+
		musicChannel.addEventListener(Event.SOUND_COMPLETE,loopMusic)
34-
		var victoryChannel:SoundChannel;
34+
35
		
36
		function loopMusic(e:Event){
37
		startMusic();
38
		}
39
		*/
40
41-
		function startBattleMusic(){
41+
42
		switch(soundName){
43
		
44
		case "gunshot":
45-
		musicChannel = battleLoop.play();
45+
		gunShotSound.play();
46-
		musicChannel.addEventListener(Event.SOUND_COMPLETE,loopBattleMusic)
46+
		break;
47
48
49-
		function loopBattleMusic(e:Event){
49+
50-
		startBattleMusic();
50+
51
		
52
		}
53-
		function finishBattle(){
53+
54
	}
55-
		victoryChannel = victoryJingle.play();
55+
56-
		victoryChannel.addEventListener(Event.SOUND_COMPLETE,finishJingle)
56+