1 decade ago by Attanar
In my player.js file I have this:
In my main.js I have this:
The game starts without any errors or warnins. Yet, when I do something that calls the jump, I get this error:
How can player be undefined, if I already referenced it? In the code examples that seems to work fine.
init: function(x,y,settings){
this.parent(x,y,settings);
this.addAnim('idle',0.1,[0]);
this.vel.x = 300;
// Referencia para acceder a la instancia desde el juego
ig.game.player = this;
In my main.js I have this:
this.player.jump();
The game starts without any errors or warnins. Yet, when I do something that calls the jump, I get this error:
Uncaught TypeError: Cannot call method 'jump' of undefined
How can player be undefined, if I already referenced it? In the code examples that seems to work fine.
