Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | sphixy011 |
hello i am trying to make a character using a ridgidbody2d and i made this script
extends RigidBody2D
func _integrate_forces(state: Physics2DDirectBodyState) -> void:
if Input.is_action_just_pressed("ui_up"):
add_force(Vector2(1 , 1), Vector2(0,-14000))
elif Input.is_action_pressed("ui_right"):
add_force(Vector2(1 , 1), Vector2(50,00))
elif Input.is_action_pressed("ui_left"):
add_force(Vector2(1 , 1), Vector2(-50,0))
else:
set_applied_force(Vector2(0 , 0))
if get_applied_force() > Vector2(1000, 0):
set_applied_force(Vector2(1000, 0 ))
if get_applied_force() <= Vector2(-1000, 0):
set_applied_force(Vector2(-1000, 0 ))
pass
but when i try to jump when i am moving it dont work
thank you in advance for your help