• Content Count

  • Joined

  • Last visited

Everything posted by Nicotico

  1. Hello samme, I also did not have luck with that option, it keeps throwing "Can not read property 'sprite' of undefined"
  2. Hello Aguacero, I had already tried that, if I add "game" as function in the function it keeps throwing me "Can not read the property 'sprite' of undefined" if it is not available or is not acceptable game as I throw the following error: game is not defined
  3. Good morning everyone, I hope the translator is as accurate as possible to make me understand. The problem I have is the following, I have an object (vaso) that falls through the screen (soltarVaso), when I click, the event onInputDown executes another function (agarraVaso), I want a sprite (heart) to appear on the screen that I won a Extra life (vidaExtra) but the following error appears: Uncaught TypeError: Can not read property 'sprite' of undefined and I can not understand where I have the error. Could you give me a hand please, thank you very much! soltarVaso: function(game){ var dropPos = Math.floor(Math.random()*Juego.GAME_WIDTH); var vaso = game.add.sprite(dropPos, 0, 'vaso'); game.physics.arcade.enable(vaso); vaso.inputEnabled = true;, this); vaso.checkWorldBounds = true; vaso.anchor.setTo(0.5, 0.5); vaso.rotateMe = (Math.random()*2)-2; game._vasoGroup.add(vaso); vaso.body.gravity.y = Juego.gravedadVaso; }, agarraVaso: function(vaso){ vaso.kill(); Juego._vidas += 1; Juego._vidasText.setText(Juego._vidas); this.vidaExtra = this.add.sprite(vaso.body.x, vaso.body.y, 'vidaExtra'); //here shows me the error this.vidaExtra.animations.add('mas_vida', [0,1,2,3,4], 10, false);'mas_vida'); this.physics.arcade.enable(this.vidaExtra); this.vidaExtra.body.velocity.y -= 100; }