This commit is contained in:
17
entities/plants/scripts/plant_sprite.gd
Normal file
17
entities/plants/scripts/plant_sprite.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user