extends KinematicBody
const SPEED = 6

var velocity = Vector3(0,0,0)

onready var panel = get_node("../HUD")

func _ready():
	pass

func _input(event):
	if Input.is_action_pressed("game_pause"):
		Input.start_joy_vibration(0, 1, 1, 0.1)
		Input.vibrate_handheld(100)
		var player = AudioStreamPlayer.new()
		self.add_child(player)
		player.stream = load("res://assets/sounds/click.wav")
		player.play()
	pass

func _on_UpButton_pressed():
	velocity.z = -SPEED
	AudioStream
	pass
	
func _on_DownButton_pressed():
	velocity.z = SPEED
	pass

func _physics_process(_delta):
#	if Input.is_action_pressed("game_right") and Input.is_action_pressed("game_left"):
#		velocity.x = 0
		
	if Input.is_action_pressed("game_right"):
		velocity.x = SPEED
	elif Input.is_action_pressed("game_left"):
		velocity.x = -SPEED
	else:
		velocity.x = 0
	
	#if Input.is_action_pressed("game_up") and Input.is_action_pressed("game_down"):
	#	velocity.z = 0
	
	if Input.is_action_pressed("game_up"):
		velocity.z = -SPEED
	elif Input.is_action_pressed("game_down"):
		velocity.z = SPEED
	else:
		velocity.z = 0
		
	if Input.is_action_just_pressed("ui_hide"):
		panel.visible = !panel.visible 
	move_and_slide(velocity)





