catccaatt Posted November 1, 2014 Share Posted November 1, 2014 Recently I was trying to learn a horizontal infinite running game. I set my player speed 20 at x direction, and I also set the ground speed -20 at x direction, then whenever my player fall to the ground, the player stops moving and the ground still moving at -20. What I want is the player also still moves at 20. How do I make the two speed not canceling each other? like zero friction? Thanks Link to comment Share on other sites More sharing options...
lewster32 Posted November 3, 2014 Share Posted November 3, 2014 Have you tried constantly applying the velocity in the update function?function update() { player.body.velocity.x = 20;} Link to comment Share on other sites More sharing options...
catccaatt Posted November 4, 2014 Author Share Posted November 4, 2014 If you are talking about forcing the body's velocity, I tried " player.body.velocity.x = 20 " in the update function but it doesn't work. Apparently, it is overwritten when two object collide. Link to comment Share on other sites More sharing options...
lewster32 Posted November 4, 2014 Share Posted November 4, 2014 There isn't any friction in Arcade Physics, only collisions which will affect the velocity on the axes affected. The closest thing to friction is the body.drag property, which allows you to reduce the velocity of the object over time on either axis. Link to comment Share on other sites More sharing options...
Recommended Posts