June 2013
Beginner
352 pages
9h 5m
English
Let's look at a code sample where the user's mouse click triggers a gunshot. The click also triggers related attack actions, such as identifying the target and determining the damage, which we already covered in previous chapters.
This is how you play a gunshot sound after a click:
Main.java and name the class AudioTrigger.java. Remember to also refactor the first line of the main() method to AudioTrigger app = new AudioTrigger();.Sounds/Effects/Gun.wav into your project's Sounds/Effects/ directory.private AudioNode gunAudio;
simpleInitApp() method. You want it to play the Gun.wav ...Read now
Unlock full access