project-dung/scripts/item_balloon.gd

26 lines
627 B
GDScript

extends Spatial
class_name ItemBalloon
const ItemScene = preload("res://scenes/item.tscn")
onready var anim_tree : AnimationTree = $"%AnimationTree"
onready var attached_item = $"%attached_item"
var anim_playback : AnimationNodeStateMachinePlayback = null
var is_bouncing : bool = false
# Called when the node enters the scene tree for the first time.
func _ready():
anim_playback = anim_tree["parameters/playback"]
anim_playback.travel("idle")
func attach_item(item : Resource):
attached_item.set_item_type(item)
func bounce():
anim_playback.travel("bounce")
func _on_item_dump_player_failed_interact():
bounce()