2.2.5 Cycle 5 - Adding Sound
Design
Objectives
In this cycle I aim to add different sounds to different things I may implement into the game such as picking up health or the enemy being destroyed. I will also add a background track to the game so that the game is more emersive and fun.
Usability Features
Key Variables
backgroundSoundTrack
This is the variable that gets played for the background music
Pseudocode
procedure preload
load backgroundSong
end procedure
procedure create
backgroundSoundTrack = backgroundSong
backgroundSountTrack loop = true
play(backgroundSoundTrack) at 50% vol
end procedure
Development
Outcome
preload(){
...
game.load.audio('laserBlast', 'assets/laserNoise.wav');
game.load.audio('enemySplode', 'assets/enemyExplode.wav');
game.load.audio('healthGet', 'assets/healthSound.wav');
game.load.audio('playerDie', 'assets/playerDie.wav');
game.load.audio('gamePlay', 'assets/GamePlaySoundTrack.mp3');
}
create(){
...
backgroundSoundTrack = game.sound.add('gamePlay');
backgroundSoundTrack.play();
backgroundSoundTrack.loopFull();
backgroundSoundTrack.volume = 0.5;
...
}
Challenges
In this cycle there were no issues at all with adding and playing songs or sound.
Testing
In my testing I used the webpack software to keep making small changes to the speed constant to be able to find a speed that I thought would be slow enough for the player to react to it and yet fast enough for it to be challenging to hit.
Tests
Background music
Simply load into the game.
Music begins as soon as the game starts
As expected
Evidence

What next?
Adding lasers to shoot out of the spaceship
Adding animations when the lasers hit the enemies
Adding an animation when the player get killed
Last updated