19 lines
421 B
GDScript
19 lines
421 B
GDScript
extends Area2D
|
|
|
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
|
|
|
var game_manager: Node
|
|
|
|
func _ready() -> void:
|
|
add_to_group("coin")
|
|
if not game_manager:
|
|
game_manager = get_tree().get_first_node_in_group("game_manager")
|
|
|
|
func popup() -> void:
|
|
animation_player.play("popup")
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if game_manager:
|
|
game_manager.add_point()
|
|
animation_player.play("pickup")
|