【问题标题】:Godot - Changing the scene戈多——改变场景
【发布时间】:2017-09-05 18:41:50
【问题描述】:

我正在开发一个突破游戏,当球撞到墙上时,我需要重新加载场景。 代码如下:

extends RigidBody2D

func _ready():
    set_fixed_process(true)

func _fixed_process(delta):
    var caramizi = get_colliding_bodies()

    for caramida in caramizi:
        if caramida.is_in_group("caramida"):
            caramida.queue_free()
        elif caramida.is_in_group("die"):
            #reload the scene
            pass

如何重新加载场景?

【问题讨论】:

    标签: scene godot gdscript


    【解决方案1】:

    SceneTree 有一个 reload_current_scene 方法。你应该可以使用它:

    get_tree().reload_current_scene()
    

    http://docs.godotengine.org/en/stable/classes/class_scenetree.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-25
      • 1970-01-01
      • 2015-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多