I’m using a tilemap made in tiled with a collides boolean for some tiles. However, when I’m checking for a keypress and the player touching the ground for a jump, it does’nt do anything. I looked into it, and my player’s “speed” property in the physics body is set to 0.4545454545454546. Does anyone know how to fix this?
The keyboard controls code:
function update () {
var cursors = this.input.keyboard.createCursorKeys();
if (cursors.left.isDown)
{
this.player.setVelocityX(-160);
}
else if (cursors.right.isDown)
{
this.player.setVelocityX(160);
}
else
{
this.player.setVelocityX(0);
}
if (cursors.up.isDown && this.player.body.touching.down)
{
this.player.setVelocityY(-330);
}
};