如何解决分数管理 godot (pong)
你好,我的乒乓球游戏中有一个可以生成球的电源。我想确保当一个球得分并且屏幕上有多个球时,游戏不必一直重新开始。这是我的代码:
func score_keeper(victor,name):
if(victor == 1&&find_parent('SpawnManager').find_node('BallSpawn').get_child_count()<0&&name=='Ball'):
$Ball.position = Vector2(640,360)
Opponentscore += 1
get_tree().call_group('BallGroup','stop_ball')
$CountdownTimer.start()
$TimerLabel.visible = true
$scoreSound.play()
elif(victor == 0&&find_parent('SpawnManager').find_node('BallSpawn').get_child_count()<0&&name=='Ball'):
$Ball.position = Vector2(640,360)
PlayerSore += 1
get_tree().call_group('BallGroup','stop_ball')
$CountdownTimer.start()
$TimerLabel.visible = true
$scoreSound.play()
elif(victor == 0&&find_parent('SpawnManager').find_node('BallSpawn').get_child_count()>0):
Opponentscore += 1
$scoreSound.play()
elif(victor == 1&&find_parent('SpawnManager').find_node('BallSpawn').get_child_count()>0):
Opponentscore += 1
$scoreSound.play()
我在调试器中收到此错误:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。