Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * void
- * points()
- *
- * displays points updates
- */
- function points()
- {
- // if not all passengers have been dropped off
- if (POINTS < POPULATION)
- document.getElementById("announcements").innherHTML =
- "Successful dropoff! You now have " + POINTS + " dropoff points!";
- // if all passengers have been dropped off, announce
- else
- document.getElementById("announcements").innerHTML =
- "Congratulations, you have dropped off all the passengers!";
- }
- /*
- * void
- * dropoff()
- *
- * Drops up passengers if their stop is nearby.
- */
- function dropoff()
- {
- // so far no one has gotten off
- var anyoneOff = false;
- // for every passenger on the shuttle
- for (var person in SEATING)
- {
- if (SEATING[person] != "empty")
- {
- // calculate the distance to passenger's house
- var distance = shuttle.distance(HOUSES[SEATING[person].house].lat,
- HOUSES[SEATING[person].house].lng);
- // if anyone's house is within 30.0m
- if (distance <= 30.0)
- {
- // someone is getting off
- anyoneOff = true;
- // clear that person's seat
- SEATING[person] = "empty";
- /* update the seating display
- note: I chose not to re-order the seating list and to leave
- 'empty seats' interspersed to reflect real life seating */
- seatDisplayUpdate();
- // add points to the players' total
- POINTS++;
- // announces points update
- points();
- }
- }
- }
- if (anyoneOff == false)
- document.getElementById("announcements").innerHTML =
- "No one to drop off here...";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement