distance challenge n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Distance Challenge PowerPoint Presentation
Download Presentation
Distance Challenge

Loading in 2 Seconds...

  share
play fullscreen
1 / 7
barr

Distance Challenge - PowerPoint PPT Presentation

97 Views
Download Presentation
Distance Challenge
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. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Distance Challenge By: Chris Brown Under the direction of Prof. Susan Rodger Duke University, January 2013

  2. Problem • It’s Jimmy’s first time in a new city, and we need to help him find his way around! He knows where he is located in the center at (0, 0) to start, and he also knows the coordinates of each place he wants to visit. Your job will be to fill in the distance function, to calculate the distance from Jimmy to his destination. You can move around the city by clicking on the different places of interest that you want to visit. • 1 unit = 1 meter

  3. Problem We want to calculate this distance! (0, 0) (9, -4)

  4. Problem • Now, Jimmy wants to go from the theme park to the museum… (9, -4) (-6, -6)

  5. world.distance • Each time the distance function is called, four parameters are passed in with information you will need. It provides you with Jimmy’s x value, Jimmy’s y value, the destination’s x value, and the destination’s y value. It is your job to correctly return the distance from Jimmy to his destination in this function. • Hint: What is the distance formula? It can be derived from Pythagorean’s Theorem.

  6. world.distance Fill this in!

  7. Bonus Challenge! • Go into the Alice Object Gallery to add new places, with an original animation every time Jimmy visits that place. Make sure to create variables for your location’s x and y position to be passed into your distance function later on.