[手把手带你Godot游戏开发]FlappyBird:8 让数据说话(显示分数)(未完)

Kenisha ·
更新时间:2024-09-21
· 529 次阅读

在这里插入图片描述

在这里插入图片描述

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)
作者:开发游戏的老王



godot 数据

需要 登录 后方可回复, 如果你还没有账号请 注册新账号