extends KinematicBody2D

signal sent_speed(paddle_speed)

var move_direction = Vector2(0,0)
var velocity = 0
var speed = 2000



func _physics_process(delta):
	move_direction.x = int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left"))
	move_direction.y = (int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up"))) / float(2)
	var motion = move_direction.normalized() * speed
	velocity = motion
	move_and_slide(velocity)

func _on_Area2D_body_entered(body):
		if body.name == "ball":
			emit_signal("sent_speed", speed)
		print("hit detected")

