-
Notifications
You must be signed in to change notification settings - Fork 320
Challenge # 3 solution
raulco1 edited this page May 29, 2020
·
1 revision
This is my initial solution up to challenge 3. it seems to work well confused about elevator.goToFloor(0,true); I am trying to understand this before i move on.
{
init: function(elevators, floors) { var elevator = elevators[0]; // Let's use the first elevator
// Whenever the elevator is idle (has no more queued destinations) ... elevator.on("idle", function() { // let's go to all the floors (or did we forget one?) elevator.goToFloor(0,true); elevator.goToFloor(1); elevator.goToFloor(2); elevator.goToFloor(3); elevator.goToFloor(4); }); }, update: function(dt, elevators, floors) { // We normally don't need to do anything here }
}
Play it yourself at play.elevatorsaga.com