I'm reusing an old application (a game) so it's possible to run several games at ones. By that reason I've changed the properties to "this.propery", which are used everywhere in my application. However, the only prototype function that can access the properties is "startGame". I have tried both "this.bricks" and "Game.bricks", but both are undefined when trying to reach them in any other function that "startGame".
Any tips for me?
var game = new Game();
game.startGame();
Game = function(){
this.bricks = 2;
this.checkOddEven = 0;
...
}
Game.prototype.startGame = function() {
console.log(this.bricks) <- 2
console.log(Game.bricks) <- 2
// Code goes here...
Game.prototype.renderTiles()
}
Game.prototype.renderTiles = function() {
// code goes here...
console.log(this.bricks) <- undefined
console.log(Game.bricks) <- undefined
}
... the same goes for the other prototype functions.