seeding-planets/entities/plants/scripts/plant_sprite.gd

17 lines
436 B
GDScript

extends Node2D
class_name PlantSprite
signal harvest_animation_finished
@onready var sprite = $Sprite2D
func apply_texture_to_sprite(texture, with_animation = true):
if with_animation:
$AnimationPlayer.play("bump")
await $AnimationPlayer.animation_finished
sprite.texture = texture
func start_harvest_animation():
$AnimationPlayer.play("harvest")
await $AnimationPlayer.animation_finished
harvest_animation_finished.emit()