srikarg Posted May 29, 2014 Share Posted May 29, 2014 Hello everyone, Is there any way to adjust the drag of a sprite in the air (I know you can do it on the ground)? Right now, when the character in my game jumps into the air off of the ground, it can move horizontally very easily. In other words, the horizontal movement sensitivity is extremely high. Is there any way to reduce this sensitivity and add some sort of drag to the sprite's body when it is in NO contact with any obstacles (i.e. no collisions)? Thanks in advance,srig99 Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 The body.drag value reduces the velocity, whether it's in the air or not - it simply reduces the velocity constantly so that the velocity sooner or later returns to 0. You could either disable the ability to change velocity entirely when the character is in the air (remove air control) or you could increase the body.drag.x value when the character is in the air by an amount that feels natural while giving a bit of air control. I guess you could also set the body.maxVelocity.x value to something lower when the character is in the air. srikarg 1 Link to comment Share on other sites More sharing options...
srikarg Posted May 30, 2014 Author Share Posted May 30, 2014 Thanks for the suggestions @lewster32! Link to comment Share on other sites More sharing options...
1p0 Posted December 29, 2016 Share Posted December 29, 2016 you can also do the following and set drag to zero, to manually simulate drag when the character is touching down. You can negate the if, or use an else to have separate friction for the air and surfaces, or do a more complex checking if there are different type of surfaces with different friction like ice, grass, air with or without changing wind if (player.body.touching.down) { player.body.velocity.x = player.body.velocity.x / 1.1; } Link to comment Share on other sites More sharing options...
Recommended Posts