Godot version:
v4.3.stable.
So i’ve been following a youtube tutorial and got an error on the player movement script.
This is the code and the highlightet part is causing the trauble (I think so):
func _physics_process(delta: float) → void:
var on_floor = is_on_floor()
if !is_dying:
if !on_floor:
vertial_velocity += Vector3.DOWNgravitiy2delta
else:
vertial_velocity = Vector3.DOWNgravitiy/10
if Input.is_action_just_pressed(“jump”) and (!is_attacking) and on_floor:
vertial_velocity = Vector3.UP*jump_force
angular_acceleration = 10
movement_speed = 15
acceleration = 15
var h_rot = camrot_h.global_transform.basis.get_euler().y
if (Input.is_action_pressed(“forward”) || Input.is_action_pressed(“backward”) || Input.is_action_pressed(“left”) || Input.is_action_pressed(“right”)):
direction = Vector3(Input.get_action_strength(“left”) - Input.get_action_strength(“right”),
0,
Input.get_action_strength(“forward”) - Input.get_action_strength(“backward”))
direction = direction.rotated(Vector3.UP, h_rot).normalized()
if Input.is_action_pressed(“sprint”) and (is_walking):
movement_speed = run_speed
is_running = true
else:
is_walking = true
movement_speed = walk_speed
else:
is_walking = false
is_running = false