made 'worlds' a local variable inside init, instead of global

This commit is contained in:
Richard Harrington 2013-09-03 20:28:08 -04:00
parent 1d9f712980
commit fa7e132b71
1 changed files with 5 additions and 8 deletions

View File

@ -8,10 +8,6 @@
var SHELL_RADIUS = 2;
var SHELL_COLOR = "#ffffff";
// The only real global variable.
// TODO: Get rid of this.
var worlds;
var Geom = (function() {
var degreesToRadians = function(angle) {
return angle * Math.PI / 180;
@ -244,7 +240,7 @@
})(Date.now());
}
function startGame(gameInfo) {
function startGame(worlds, gameInfo) {
var debugAnimationCounter = 0;
var debugSimulationCounter = 0;
var debugSecondsCounter = 0;
@ -293,8 +289,9 @@
}
function init() {
// Text and keyboard event listeners for sending program names to
// server
var worlds;
// Text and keyboard event listeners for sending program names to server
$('#programsInput').bind('keydown', function(event) {
if (event.which === 13) {
@ -314,7 +311,7 @@
setTimeout(function() {
$('#canvas').css({opacity: 1});
setTimeout(function() {
startGame(gameInfo);
startGame(worlds, gameInfo);
}, 500);
}, 500);
$(this).blur();