Godot Version
4.5
Question
i am making a top down 2d game and want to make a roll but it feels slow. can anyone tell me how to make it feel faster? the roll looks like im just sliding around on ice.
the rollDistance is a float 50.0
if Input.is_action_just_pressed("Roll") and !Rolling:
Rolling = true
if Input.is_action_pressed("Up"):
velocity.y = rollDistance * -1
elif Input.is_action_pressed("Down"):
velocity.y = rollDistance
elif Input.is_action_pressed("Right"):
velocity.x = rollDistance
elif Input.is_action_pressed("Left"):
velocity.x = rollDistance * -1
await get_tree().create_timer(1).timeout
Rolling = false
else:
pass
move_and_slide()
I think you need to introduce the idea of friction.
When I am not pressing up or down, the y value needs to tend to 0 based on a friction value.
So if I am moving up and press left, there should be some upward movement that slows to 0.
The same for the other directions.
Changing the friction value will change the ‘icy’ feel. I use a similar thing on a tank in a tank game, so on different surfaces I change the value so on Ice I slide a lot, on mud a little, and on grass virtually nothing.
Hope that helps. (Sorry no code examples, I am about to get offline and have no time.)
EDIT oh on reading @dragonforge-dev answer I realised I might have got the wrong end of the stick. Sorry. This is an abrupt ‘roll a certain distance’. Your ‘icy’ description confused me. Sorry.
1 Like
@pauldrewett is right, adding friction would help as well, but without something visual to indicate rolling it’s still going to feel off to your brain.