Character is not moving continuously.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ouch_Bird

The character is only moving on tick before it stops. Where did I bugger up the code?

extends KinematicBody

var gravity = Vector3.DOWN * 12
var speed = 4
var jump_speed = 6

var velocity = Vector3()

func _physics_process(delta):
	velocity += gravity * delta
	velocity = move_and_slide(velocity, Vector3.UP)
func get_input():
	velocity.x = 0
	velocity.z = 0
	if Input.is_action_just_pressed("move_forward"):
		velocity.z -= speed
	if Input.is_action_just_pressed("move_back"):
		velocity.z += speed
	if Input.is_action_just_pressed("strafe_right"):
		velocity.x += speed
	if Input.is_action_just_pressed("strafe_left"):
		velocity.x -= speed
:bust_in_silhouette: Reply From: timothybrentwood

You want to check Input.is_action_pressed() for continuous actions such as movement and Input.is_action_just_pressed() for singular actions such as using an item or jumping.

Thank-you! Simple mistake as always, but I am learning.

Ouch_Bird | 2021-06-29 20:22