Created
April 9, 2016 07:13
-
-
Save zkendall/79f80db2882d2e23b5862f2091c3212e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
init: function(elevators, floors) { | |
log = function() { return console.log.apply(console, arguments); }; | |
for(i = 0; i < floors.length; i++) { | |
var floor = floors[i]; | |
log("Iterate Floor Num:" + floor.floorNum()) // I iterate as expected 1,2,3,4 | |
floor.on("up_button_pressed", function() { | |
log("floor[" + floor.floorNum() + "].up_button_pressed()") // I am always 4, what gives? | |
}); | |
} | |
}, | |
update: function(dt, elevators, floors) { | |
// We normally don't need to do anything here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment