Initial commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
@tool
|
||||
|
||||
class_name Hotspot extends DialogueActionable2D
|
||||
|
||||
var inside = false
|
||||
func _enter_tree() -> void:
|
||||
#Input.set_custom_mouse_cursor(preload("res://helpers/pointers/arrow.svg"))
|
||||
#Input.set_custom_mouse_cursor(preload("res://helpers/pointers/target.svg"), Input.CURSOR_POINTING_HAND)
|
||||
#
|
||||
#mouse_entered.connect(_on_mouse_entered)
|
||||
#mouse_exited.connect(_on_mouse_exited)
|
||||
#
|
||||
input_event.connect(_on_input_event)
|
||||
body_entered.connect(_on_body_entered)
|
||||
body_exited.connect(_on_body_exited)
|
||||
|
||||
|
||||
#region Signals
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
$Label.visible = true
|
||||
inside = true
|
||||
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
$Label.visible = false
|
||||
inside = true
|
||||
|
||||
#func _on_mouse_entered() -> void:
|
||||
#Input.set_custom_mouse_cursor(preload("res://helpers/pointers/target.svg"))
|
||||
#
|
||||
#
|
||||
#func _on_mouse_exited() -> void:
|
||||
#Input.set_custom_mouse_cursor(preload("res://helpers/pointers/arrow.svg"))
|
||||
#
|
||||
#
|
||||
func _input(event):
|
||||
if inside and Input.is_action_just_pressed("interact"):
|
||||
$Label.visible = false
|
||||
action()
|
||||
|
||||
func _on_input_event(_view_port: Node, event: InputEvent, _shape_idx: int) -> void:
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
$Label.visible = false
|
||||
action()
|
||||
|
||||
|
||||
#endregion
|
||||
Reference in New Issue
Block a user