25 lines
804 B
GDScript
25 lines
804 B
GDScript
extends Node2D
|
|
class_name InteractionWheel
|
|
|
|
var interactions: Array[Interaction]
|
|
|
|
@onready var interaction_icons: Array[Node] = $Interactions.get_children()
|
|
@onready var cursor: Sprite2D = $Cursor
|
|
|
|
func initialize(interaction_location: Vector2i, interactions: Array[Interaction]) -> void:
|
|
position = Grid.grid_to_world_center(interaction_location)
|
|
self.interactions = interactions
|
|
|
|
func _ready() -> void:
|
|
for i in range(interactions.size()):
|
|
interaction_icons[i].texture = interactions[i].image
|
|
interaction_icons[i].show()
|
|
|
|
func _process(delta: float) -> void:
|
|
var selection_direction = Input.get_vector("view_left", "view_right", "view_up", "view_down")
|
|
if selection_direction:
|
|
cursor.rotation = selection_direction.angle()
|
|
cursor.show()
|
|
if Input.is_action_just_pressed("select"):
|
|
pass
|