1 / 7

Boat Racing Game Challenge #3

Boat Racing Game Challenge #3. By Chris Brown Under the direction of Professor Susan Rodger Duke University, January 2013 Based off of the Boat Racing Game by Jenna Hayes. Boat Race.

wattan
Download Presentation

Boat Racing Game Challenge #3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Boat Racing GameChallenge #3 By Chris Brown Under the direction of Professor Susan Rodger Duke University, January 2013 Based off of the Boat Racing Game by Jenna Hayes

  2. Boat Race • In this world, you must control a boat to travel through the 10 arches in the race course in order to win the game. The faster your time, the better you will do! We want you to add to this game, so that in the end you will know the speed your boat travelled throughout the race.

  3. Challenge • In this challenge, you will need to complete the “average” function to calculate the speed of the boat over time in meters per second, and then modify the “win” method to display the speed to the user once they have completed the game.

  4. world.average • When you play the game, we’ve already written the code to complete the total time and collected the distances between each pair of arches in a list. You will need to fill in the average function to compute the speed. In this function, you are given the total time that the game took and a list of the distances in meters between each hoop as parameters.

  5. world.average • First you will need to sum up the values in the list to calculate the total distance*, then divide that by the time it took to complete the run through the arches. *Hint: Use a loop and create a new variable to find the sum of the values in a list! This means that your function will return a number!

  6. world.win • Now, modify this method so that at the end of the game, the text that once displayed the timer displays the speed (meters/second) the boat travelled throughout the game. Feel free to use other Alice methods to creatively show the data after the game has been won, for example, making the boat do a backflip!

  7. world.win • world.gameOn is just a variable that is true whenever the game is running and false when the game is over. To display a number as text, you will need to use the “what as a string” function under the string section of the Alice world functions.

More Related