My codes are not working, I'm sure that they are correct cause I copied them exactly from a tutorial but I'm gonna write them here anyway. The thing is even the print function worked at first but the second time I tried it I saw no output , so I guess they are not working. Btw, I'm new to GDscript or any game making stuff so please keep it simple :)
thank you :)
extends KinematicBody
var velocity = Vector3(0,0,0)
const SPEED = 5
func _ready():
pass
func _physics_process(delta):
if Input.is_action_pressed("ui_right") and Input.is_action_pressed("ui_left"):
velocity.x = 0
elif Input.is_action_pressed("ui_right"):
velocity.x = SPEED
elif Input.is_action_pressed("ui_left"):
velocity.x = -SPEED
else:
velocity.x = lerp(velocity.x,0,0.1)
if Input.is_action_pressed("ui_up") and Input.is_action_pressed("ui_down"):
velocity.z = 0
elif Input.is_action_pressed("ui_up"):
velocity.z = SPEED
elif Input.is_action_pressed("ui_down"):
velocity.z = -SPEED
else:
velocity.z = lerp(velocity.z,0,0.1)
move_and_slide(velocity)