extends StaticBody2D
@export var speed = 5000
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_pressed("ui_up"):
position.y -= get_parent().Paddle_Speed * delta
if Input.is_action_pressed("ui_down"):
position.y += get_parent().Paddle_Speed * delta
position.y = clamp(position.y, p_hight/2, win_hight - p_hight/2)