I made it into a addon so I could share it seperately once I'm done with this project. Will probably add more stuff to it once I do that too I liked Awesome Input Icons, but it only had a PlayStation icon face by default that couldn't be easily changed at runtime, so I just made my own.
16 lines
501 B
GDScript
16 lines
501 B
GDScript
extends Node2D
|
|
|
|
var current_interaction_area = null
|
|
|
|
func _ready() -> void:
|
|
print(Input.get_joy_name(0))
|
|
|
|
func _process(delta: float) -> void:
|
|
if current_interaction_area:
|
|
$UI/Control/Interact.visible = true
|
|
$UI/Control/Interact/End.text = "TO " + (current_interaction_area.interact_text)
|
|
|
|
if Input.is_action_just_pressed("interact"):
|
|
if "_interact" in current_interaction_area.get_parent(): current_interaction_area.get_parent()._interact()
|
|
else:
|
|
$UI/Control/Interact.visible = false
|