Search the Community
Showing results for tags 'walk'.
-
Hi, I'm programming a simple platformer game, and I'm programming and setting the movement of the player. Here's my update function: update: function () { game.physics.arcade.collide(this.player, this.platform); game.camera.follow(this.player); if(this.cursor.right.isDown){ this.player.body.velocity.x= 200; this.player.animations.play('correr', 5, true); this.player.scale.x=1; } else if(this.cursor.left.isDown){ this.player.body.velocity.x= -200; this.player.animations.play('correr', 5, true); this.player.scale.x=-1; } else if(this.jump.isDown && this.player.body.wasTouching.down) { this.player.body.velocity.y= -400 } else if((this.cursor.right.isDown || this.cursor.left.isDown) && this.jump.isDown){ this.player.body.velocity.x= 200; this.player.body.velocity.y=-200; } else{ this.player.body.velocity.x = 0; this.player.animations.stop(); this.player.frame = 4; } } Everything works fine, but in my last else if is suppose that the player should jump and walk, but it doesn't work! My intention is the player could jump while walking pressing the jump key + left or right key, for now I just can jump first and then walk. I don't know why this las if else it isn't being executed, because I tried to move it in the first if clause and it worked perfectly, but I can't realise about the error. Thanks for helping.
-
Can any help me ,how to make our FPS Camera (Free camera) to walk on steps