Hi guys,
I'm a new student and I knew Phaser since 5 days and it's fantastic. So I'm a beginner.
I'm trying to create one simple platform game, I have one issue but I don't know how to solve it. I'll appreciate your help.
I need that when the animation hit the wall he changes the direction, right or left and keep running.
Here's the part of the code that I think is necessary for analyses:
// Collide the player with the walls
var hitWalls = game.physics.arcade.collide(player, walls);
game.physics.arcade.collide(stars, walls)
//My animation starts running to right and I want it
player.body.velocity.x = 200;
player.animations.play('right',15,true);
if (hitWalls) ????
{
//Here I tried: player.body.velocity.x = -150; but the animation is crazy now
}
Thanks and have a good day!