class_name LactasePill extends Area2D @onready var animation_player := $AnimationPlayer as AnimationPlayer @onready var timer := $Timer as Timer @export var LACTASE_RESPAWN_TIME : int = 1 var picked :bool = false func _on_body_entered(body: Node2D) -> void: if not picked: animation_player.play(&"picked") (body as Princess).you_got_lactase() picked = true # Le fromage peut être à utilisation unique if LACTASE_RESPAWN_TIME > 0: timer.start(LACTASE_RESPAWN_TIME) func _on_timer_timeout() -> void: timer.stop() animation_player.play(&"RESET") func _on_animation_player_animation_finished(anim_name: StringName) -> void: if anim_name == "RESET": animation_player.play(&"lactase") picked = false