extends Label
func _ready():
add_to_group("score_changed")
func on_score_changed(score):
text = str(score)
#ScoreArea.gd
extends Area2D
func _ready():
connect("body_exited",self,"_on_body_exited")
func _on_body_exited(_body):
if _body.name == "Bird":
AudioManager.play("sfx_point")
GameData.score += 1
#加分以后通过SceenTree把新的分数更新给所有想接受这个消息的节点
get_tree().call_group("score_changed","on_score_changed",GameData.score)