2020-08-20 14:45:54 +02:00
|
|
|
extends AnimatedSprite
|
|
|
|
|
|
|
|
const press_a = preload("res://images/Controls/PressA.tres")
|
|
|
|
const press_space = preload("res://images/Controls/PressSpace.tres")
|
|
|
|
|
|
|
|
const press_down = preload("res://images/Controls/PressDown.tres")
|
|
|
|
const press_left = preload("res://images/Controls/PressLeft.tres")
|
|
|
|
const press_up = preload("res://images/Controls/PressUp.tres")
|
|
|
|
const press_right = preload("res://images/Controls/PressRight.tres")
|
|
|
|
|
|
|
|
var last_is_joy = false
|
|
|
|
|
|
|
|
func show_press(action : String):
|
2020-08-20 16:19:53 +02:00
|
|
|
if action == 'ui_accept' || action == 'interact':
|
2020-08-20 14:45:54 +02:00
|
|
|
frames = press_a if last_is_joy else press_space
|
|
|
|
if action == 'right':
|
|
|
|
frames = press_right
|
|
|
|
if action == 'left':
|
|
|
|
frames = press_left
|
|
|
|
if action == 'down':
|
|
|
|
frames = press_down
|
|
|
|
if action == 'up':
|
|
|
|
frames = press_up
|
|
|
|
play('default')
|
|
|
|
show()
|
|
|
|
|
2020-08-20 19:40:24 +02:00
|
|
|
func _input(_event):
|
2020-08-20 14:45:54 +02:00
|
|
|
last_is_joy = false
|
|
|
|
for b in [
|
|
|
|
JOY_XBOX_A,
|
|
|
|
JOY_XBOX_B,
|
|
|
|
JOY_XBOX_X,
|
|
|
|
JOY_XBOX_Y,
|
|
|
|
JOY_DPAD_UP,
|
|
|
|
JOY_DPAD_LEFT,
|
|
|
|
JOY_DPAD_RIGHT,
|
|
|
|
JOY_DPAD_DOWN,
|
|
|
|
]:
|
|
|
|
if Input.is_joy_button_pressed(-1, b):
|
|
|
|
last_is_joy = true
|
|
|
|
break
|