Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com
Add new instance variable
This 1 line calls DisplayGemsCount()
Drag gem into Gem Icon Texture
Run See your score on the top left!
You can add it to the bottom of the class, just before the class ends
Add a call to DisplayRestartButton()
Run What happens when the cat touches a laser?
You can now restart the game, with the new button!
a)Go to b)Add a laser sound. c)Click “Play” on the right to hear it. d)Click Export Wav to download the file. b a c d
Click Save
Verify
In Prefabs folder, select “laser” prefab
For the laser object, click Add Component “Audio” Click “Audio” Click “Audio Source”
For the laser object in Prefabs… … verify “Audio Source”
With laser prefab selected…
… click Prefabs folder, then drag your Laser sound into Audio Clip under Audio Source Also, uncheck “Play on Awake” checkbox
Add if statement to play laser sound
Run You should hear the laser sound on collision with the laser!
Repeat steps a-b-c-d for Pickup/Coin Explosion Hit/Hurt a)Go to b)Add a sound. c)Click “Play” on the right to hear it. d)Click Export Wav to download the file. b a c d
Click Save New Sounds Pickup/Coin Explosion Hit/Hurt
Click “Apply” for each Uncheck 3D Sound for each sound clip
1.Select “Cat” in Hierarchy 2.Click “Add Component”
Click “Audio” Click “Audio Source”
Verify 2 Audio Sources for Cat!
Drag “Explosion” and “Hit_Hurt” into each empty Audio Clip
For both Audio Sources, enable: Play on Awake Loop
Add 2 new instance variables
Add this 1 line at the end of FixedUpdate()
Drag “Explosion” Audio Source into JetPack Audio under Cat’s Script Component
Drag “Hit_Hurt” Audio Source into Footsteps Audio under Cat’s Script Component
Add 1 new instance variable
Add 1 new line to play sound
Drag Pickup_Coin audio file into “Gem Collec Sound” under Cat’s script
Run Do you hear the sounds?
For the Main Camera… Click “Audio Source”… click Add Component “Audio”
Verify Audio Source in Inspector
Drag music audio to Camera’s audio clip Enable Play on awake Loop
Click File Build Settings…
Choose one of many platforms!