diff --git a/code/CandyFucker.js b/code/CandyFucker.js index 06663dc..7a95932 100644 --- a/code/CandyFucker.js +++ b/code/CandyFucker.js @@ -1,6 +1,6 @@ window.Images = new ImageLoader(); - +window.Sounds = new SoundLoader(); ///////////////////////////////////////// @@ -69,6 +69,7 @@ CandyEntity.prototype = { this.Game.GameScreen.AddEntity(frag); } this.GameEntity.Delete(); + window.Sounds.PlaySound("Explosion"); }, SetOffset: function(x, y){ this.GameEntity.UpdatePosition({ @@ -112,21 +113,38 @@ var CandyFucker = function(idScreen, idInfoDisplay){ this.MaxSwapDistance = 32; - window.Images.LoadImages( - [ - {Name: "Red", Url: "gfx/Red.png"}, - {Name: "Blue", Url: "gfx/Blue.png"}, - {Name: "Cyan", Url: "gfx/Cyan.png"}, - {Name: "Green", Url: "gfx/Green.png"}, - {Name: "Yellow", Url: "gfx/Yellow.png"}, - ], - function(){ - self.GameScreen.Start(); - } - ); - + this.LoadImages(); }; CandyFucker.prototype = { + LoadImages: function(){ + var self = this; + + window.Images.LoadImages( + [ + {Name: "Red", Url: "gfx/Red.png"}, + {Name: "Blue", Url: "gfx/Blue.png"}, + {Name: "Cyan", Url: "gfx/Cyan.png"}, + {Name: "Green", Url: "gfx/Green.png"}, + {Name: "Yellow", Url: "gfx/Yellow.png"}, + ], + function(){ + self.LoadSounds(); + } + ); + }, + LoadSounds: function(){ + var self = this; + + window.Sounds.LoadSounds( + [ + {Name: "Explosion", Url: "sfx/explosion1.wav"}, + {Name: "PickCandy", Url: "sfx/pickcandy.wav"}, + ], + function(){ + self.GameScreen.Start(); + } + ); + }, Init: function(gameScreen){ this.BuildGrid(12, 12); this.UpdateInfoDisplay(); @@ -380,6 +398,7 @@ CandyFucker.prototype = { this.CancelSwap(); }else{ this.StartSwap(candies[0]); + window.Sounds.PlaySound("PickCandy"); } } if(this.SwapDirection!=null){ diff --git a/sfx/explosion1.wav b/sfx/explosion1.wav new file mode 100644 index 0000000..373fea7 Binary files /dev/null and b/sfx/explosion1.wav differ diff --git a/sfx/pickcandy.wav b/sfx/pickcandy.wav new file mode 100644 index 0000000..59f4b1c Binary files /dev/null and b/sfx/pickcandy.wav differ