var ITW = (function(itw) {
"use strict";
var managers;
itw.managers = itw.managers || Object.create(null);
managers = itw.managers;
// CONST
var DEBUG = false;
var START_SPEED = 200;
var TOP_SPEED = 360;
// privates
var speed, score;
var paused, gameOver;
//ADDED
var loops;
managers.GameManager = (function(){
return{
init: function(){
score = 0;
speed = START_SPEED;
paused = false;
gameOver = false;
loops = {bg: true,
player: true,
air: true,
obstacle: true,
wave: true}
},
getDebug: function(){
return DEBUG;
},
increaseSpeed: function(){
if( speed >= TOP_SPEED ){
speed = TOP_SPEED;
return;
}
speed += ( TOP_SPEED - START_SPEED ) / 10;
},
getSpeed: function(){
return speed;
},
setScore: function( amount ){
score = amount;
},
getScore: function(){
return score;
},
setPaused: function( status ){
paused = status;
},
getPaused: function(){
return paused;
},
/**
* @param (STRING) key - values:
* bg, player, air, obstacle, wave
* @param (bool) BOOL
*/
setLoop: function (key, bool){
if(loops.hasOwnProperty(key)){
loops[key] = bool;
}
},
getLoop: function(key){
if(loops.hasOwnProperty(key)){
return loops[key];
}
},
setGameOver: function( status ){
gameOver = status;
},
getGameOver: function(){
return gameOver;
}
}
}());
return itw;
}(ITW || Object.create(null)));