The player character in ping pong don't move continously

Godot Version

godot version 4

Question

as the title suggests, whenever I press up and down to make the player move, instead of running continuously, it only runs one step and I must press again to make the player move again

here’s the code

extends StaticBody2D

@export var speed = 1000

var win_hight : int
var p_hight : int

# Called when the node enters the scene tree for the first time.
func _ready():
	win_hight = get_viewport_rect().size.y
	p_hight = $ColorRect.get_size().y

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	if Input.is_action_just_pressed("ui_up"):
		position.y -= get_parent().Paddle_Speed * delta
	elif Input.is_action_just_pressed("ui_down"):
		position.y += get_parent().Paddle_Speed * delta

1 Like

Use Input.is_action_pressed instead of Input.is_action_just_pressed,
Here is the codes:

func _process(delta):
	if Input.is_action_pressed("ui_up"):
		position.y -= get_parent().Paddle_Speed * delta
	elif Input.is_action_pressed("ui_down"):
		position.y += get_parent().Paddle_Speed * delta
1 Like

Thanks Buddy

1 Like