Amusement parks have many variations of the horse race in whichyour horse moves in response to your

Question:

Amusement parks have many variations of the horse race in whichyour horse moves in response to your rolling balls into a hole, hitting a target with a water gun, etc.

Modify the SpotOn game in Exercise 22.34 to move an ImageView containing a horse image across the screen. The horse should move only when the user successfully clicks a spot. If the user clicks the screen but misses a spot, the horse should move backward. Use a PathAnimation to move the horse in response to each successful click. You can also play a RotateAnimation in parallel to rock the horse back and forth as it moves. Locate online a public domain, downloadable audio clip of the William Tell Overture (such as the one at https://archive.org/details/WilliamTellOverture_ 414) and play it in the background during the race.

Exercise 22.34

The SpotOn game tests a user’s reflexes by requiring the user to click moving spots before they disappear (Fig. 22.19 ). All of the required images and sounds for this exercise are located in the exerciseResources folder with this chapter’s examples, though you also can use free images and sounds from many websites or create your own.

Fig. 22.19

High score and current score High Score: 5665 Score: 640 KG 000 Lives remaining G Spots to click Current

In this game, the spots shrink as they move, making them harder to click. The game begins on level one, and the user reaches each higher level by clicking 10 spots. The higher the level, the faster the spots move—making the game increasingly challenging. When the user clicks a spot, the app plays a “hit” sound (hit.mp3) and the spot disappears. Points are awarded for each clicked spot—10 times the current level. Accuracy is important—any click that isn’t on a spot plays a “miss” sound (miss.mp3) and decreases the score by 15 times the current level.

The user begins the game with three additional lives, which are displayed in the bottom-left corner of the app. If a spot disappears before the user clicks it, the app plays a “flushing” sound (disappear.mp3) sound and the user loses a life. The user gains a life for reaching each new level, up to a maximum of seven lives. When no lives remain and a spot’s animation ends before the spot is clicked, the game ends and displays an Alert dialog (package javafx.scene.control).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: