yltang Posted December 11, 2015 Share Posted December 11, 2015 How can I set the camera-follow only when the player is moving to the right? If the player is moving to the left, don't follow. Link to comment Share on other sites More sharing options...
Kobaltic Posted December 11, 2015 Share Posted December 11, 2015 Use an if statement with the direction of travel. Then enable the camera follow if it is to the right else disable the camera follow. Link to comment Share on other sites More sharing options...
Batzi Posted December 12, 2015 Share Posted December 12, 2015 if(player.body.velocity.x>0) game.camera.follow(player); else game.camera.unfollow(player); Link to comment Share on other sites More sharing options...
Recommended Posts