I'm new dev - problem code error

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

extends CharacterBody2D

var velocity : Vector2

@export var speed : int = 1000
@export var gravity: float = 55
@export var jump_force : int = 1600

func _physics_process(delta):
if not is_on_floor():
velocity.y += gravity
if velocity.y >2000:
velocity.y = 2000

if Input.is_action_just_pressed("ui_right"):
	velocity.x = speed
	$Sprite.flip_h = false
elif Input.is_action_just_pressed("ui_left"):
	velocity.x = -speed
	$Sprite.flip_h = true
	velocity.x = 0
if Input.is_action_just_pressed("ui_select"):
	if is_on_floor():
		velvelociy.y = -jump_force

velocity = move_and_slide (velocity, Vector2.UP)

:bust_in_silhouette: Reply From: Mustafalou

What is the error ?
İ wd have used is_action_pressed for left and right, so it will always go left or right when pressing continuously.
İnstead of is_action_just_pressed.