I have a problem updating a sprite.
I created a function to change clothes. This should work like:
// Something like this.
pet = pet_with_hat
There is code at https://github.com/futer/pandachii in in js/main.js, line 387.
When I write this:
this.pet = this.game.add.sprite(90,90, 'pet_black_hat')
There is an error:
Uncaught TypeError: Cannot read property 'health' of undefined GameState.update @ main.js:194 Phaser.StateManager.update @ phaser.js:16628 Phaser.Game.update @ phaser.js:23092 Phaser.RequestAnimationFrame.updateRAF @ phaser.js:41421 _onLoop @ phaser.js:41407
How do I change the sprite image for this pet to another?
I will be grateful.