分数管理 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()

我在调试器中收到此错误

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)