ld-56/src/creature.gd

24 lines
453 B
GDScript3
Raw Normal View History

2024-10-07 05:05:27 +00:00
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