my sprite will only move 1 square each press.

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

hello. im new to coding and trying to learn how to code the kinematic body.
i have been able to make it move. but it will only move once each button press.
here is my code.
extends KinematicBody2D

var velocity = Vector2()

func _physics_process(delta):
velocity.y += 0

if Input.is_action_just_pressed("ui_right"):
	velocity.x = 100
elif Input.is_action_just_pressed("ui_left"):
	velocity.x = -100
	velocity.x = 0
:bust_in_silhouette: Reply From: Schweini

You have to write Input.is_action_pressed instead of Input.is_action_just_pressed

thanks :smiley: that was great help.

deezy | 2019-08-26 15:45