Renanfgs Posted May 24, 2017 Share Posted May 24, 2017 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! Quote Link to comment Share on other sites More sharing options...
SeelenGeier Posted June 9, 2017 Share Posted June 9, 2017 I know the topic is about 2 weeks old but maybe still relevant (and sorry for digging up that other post ^^). If you only move on the x-axis, you can simply invert the velocity for by using this: player.body.velocity.x = player.body.velocity.x * -1; To flip the sprite animation when moving in the other direction, you can either have an individual animation frame for this or invert the sprite by setting the scale for its x-axis to -1. // Set Anchor to the center of your sprite yourSprite.anchor.setTo(.5,.5); // Invert scale.x to flip left/right yourSprite.scale.x *= -1; This however also inverts the width and might cause other problems (you might want to use absolute values for width and height then). See this post for examples and more insight into sprite flipping: Quote Link to comment Share on other sites More sharing options...
TammySmith Posted June 15, 2017 Share Posted June 15, 2017 I need your help. I'm a student of The University of Illinois at Chicago. I got the task to create a presentation "Interrelation of Higher Mathematics and Informatics". I need to show the students that the modern stage of science is characterized by the interconnection of mathematics, physics, informatics and other branches of knowledge. With the search for the text for my report, there were no problems, I turned to the specialists of the Essayshark.com company. But I have a problem with in finding the right images for my presentation. Do you know some good resources? Thank you! Quote Link to comment Share on other sites More sharing options...
Jammy Posted June 17, 2017 Share Posted June 17, 2017 On 15/06/2017 at 11:40 AM, TammySmith said: I need your help. I'm a student of The University of Illinois at Chicago. I got the task to create a presentation "Interrelation of Higher Mathematics and Informatics". I need to show the students that the modern stage of science is characterized by the interconnection of mathematics, physics, informatics and other branches of knowledge. With the search for the text for my report, there were no problems, I turned to the specialists of the Essayshark.com company. But I have a problem with in finding the right images for my presentation. Do you know some good resources? Thank you! is this some really weird bot? TammySmith 1 Quote Link to comment Share on other sites More sharing options...
TammySmith Posted June 29, 2017 Share Posted June 29, 2017 who is a bot? Quote Link to comment Share on other sites More sharing options...
Jammy Posted July 1, 2017 Share Posted July 1, 2017 On 29/06/2017 at 10:21 AM, TammySmith said: who is a bot? you? Quote Link to comment Share on other sites More sharing options...
TammySmith Posted September 29, 2017 Share Posted September 29, 2017 no! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.