Hi Guys,
I’m starting to invest some time into learning Phaser and i was able to play a little already.
I came up with some tutorials and i wanted to use the atlas feature for my character Sprite, for some reason even if it looks like the Sprite sheet is being loaded correctly and the generateFrameNames method seems to return something as soon as i want to play that animation i’m getting
TypeError: t is undefined
I’m guessing the issue is simple but i can’t seem to find it. if you guys have any directions or suggestions I’ll be much appreciated. (see the source attached, npm start should do the trick to run it locally with gulp)
Animation definition src/animations/guyhat.js
scene.anims.create({
key: 'walk',
frames: scene.anims.generateFrameNames(spriteKey, {
prefix: 'walk_',
start: 0,
end: 15
}),
frameRate: 10
// repeat: -1
});
scene.anims.create({
key: 'stand',
frames: scene.anims.generateFrameNumbers(spriteKey, {
prefix: 'idle_',
start: 0,
end: 15
}),
frameRate: 10
// repeat: -1
});
Attempt to play animation src/sprites/player.js
update(activeInput, time, delta) {
if (activeInput.left.isDown || activeInput.a.isDown) {
this.setVelocityX(-160);
this.flipX = true;
//this.play('walk', true);
} else if (activeInput.right.isDown || activeInput.d.isDown) {
this.setVelocityX(160);
this.flipX = false;
//this.play('walk', true);
} else {
this.setVelocityX(0);
this.play('stand', true);
}
if (
(activeInput.up.isDown || activeInput.w.isDown) &&
this.body.onFloor()
) {
this.jump();
}
}
See source on github:
Thanks in advance!
Edit:
The full stack-trace of the exception
TypeError: t is undefinedphaser.min.js:1:543095
setCurrentFrame phaser.min.js:1
updateFrame phaser.min.js:1
load phaser.min.js:1
load phaser.min.js:1
load phaser.min.js:1
_startAnimation phaser.min.js:1
play phaser.min.js:1
play phaser.min.js:1
update player.js:32
update stage.js:54
step phaser.min.js:1
update phaser.min.js:1
step phaser.min.js:1
step self-hosted:1023
step phaser.min.js:1
step self-hosted:1019
e phaser.min.js:1