Game: Pick Up all the Buoys

profileEducator2
 (Not rated)
 (Not rated)
Chat

KINDLY INFORM ME  IF YOU NEED  SOLUTION FOR THE BELOW PAPER

 

Chapter 9 Page 283-4, #8 Game: Pick Up all the Buoys In this game, the player is to pick up seven buoys that are floating in the ocean. The player uses keyboard arrows to steer the sailboat to a buoy using the appropriate event(s). When the sailboat is close enough to a buoy, that buoy is picked up and it rides on the sailboat for the rest of the game. When all seven buoys have been picked up, the game is over. To create the world for the game, use the water template and add a sailboat (Vehicles). Add seven bottles (Objects) and resize them so they realistically look like buoys on the surface of the water. Also, set the texture of the bottles to none and then change their color. To create a fog effect such that the fog increases in the distance, set the world’s fog style to distance, fogNearDistance to zero, and fogFarDistance to 100. To create a sunset effect, choose a red/orange color for the world’s atmosphereColor. The screen capture below shows the sailboat in the distance and two of the buoys floating in the water. Five other buoys are located off to the right in the scene below but are currently out of view of the camera. To animate the floating action of all seven buoys, create a world-level list named allBuoys and add each of the seven buoys to the list. Then create a method named sway. In the sway method, use the allBuoys list to roll all the buoys right and left. Create an event that continues to call sway while the world is running. Create an event that allows the player to steer the boat using the arrow keys. Have the camera follow the sailboat to always keep it in view. To determine when the boat gets close enough to pick up a buoy, create a world-level method named checkIfClose-ToBuoy that checks whether the sailboat is within 3 meters of any one of the buoys in the allBuoys list. Create another method named pickUpBuoy, having an object parameter named whichBuoy. The whichBuoy parameter represents the buoy to be picked up. The picked up buoy should be moved to the back of the boat, where it will ride until the game ends (see picture below). To keep the buoy in place, put some object on the back of the boat. Set its opacity to 0 so that it is not visible to the naked eye. When the sailboat is within 3 meters of any buoy, checkIfCloseToBuoy calls pickUpBuoy. The buoy will move into the container on the boat. To keep the buoy there, change its ‘vehicle’ to the container. Use an event that continuously calls checkIfCloseToBuoy while the world is running. To determine when the game is over, you need a way to know when all the buoys have been picked up. To track the buoys that have been picked up, create a second world-level list, this one named pickedUpBuoys and leave it empty. In the pickUpBuoy method, create a statement that adds the picked up buoy to the pickedUpBuoys list. Create a world-level method named checkIfGameIsOver and call it every time a buoy is picked up. When the size of pickedUpBuoys is equal to seven, the player wins the game and a 3D text object is used to display “You did it!”.

    • 9 years ago