this is my first day in phaser and in js, I’m trying to make my player move but I don’t even see the image, this is the code:
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
scene: {
preload: preload,
create: create,
update: update
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('player', 'player.png');
}
function create ()
{player = this.add.image(52, 35, 'player');
}
function update ()
{cursors = this.input.keyboard.createCursorKeys();
if (cursors.left.isDown)
{
player.setVelocityX(-160);
}
else if (cursors.right.isDown)
{
player.setVelocityX(160);
}
else
{
player.setVelocityX(0);
}
}
THANKS