24 lines
453 B
GDScript3
24 lines
453 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
var key
|
||
|
|
||
|
@onready var data = Data.data.creatures[key]
|
||
|
@onready var image = Data.data.images[key]
|
||
|
|
||
|
@onready var sprite_2d: Sprite2D = $Sprite2D
|
||
|
|
||
|
var grabbed = false
|
||
|
|
||
|
func _ready() -> void:
|
||
|
sprite_2d.texture = image
|
||
|
|
||
|
|
||
|
func _process(delta: float) -> void:
|
||
|
if Input.is_action_just_released("left_click"):
|
||
|
grabbed = false
|
||
|
|
||
|
|
||
|
func _on_mouse_handler_clicked() -> void:
|
||
|
Triggerer.trigger("grab_creature", {"creature": self})
|
||
|
grabbed = true
|