From d88cae73eb5efb371a0446bb562537a56076e43f Mon Sep 17 00:00:00 2001 From: vanessa-chang Date: Fri, 1 Nov 2024 18:02:01 +0800 Subject: [PATCH] Add switch_scene resource This is a basic scene-switching block using a string. If we have time later, we can make further improvements by adding a block for loading a scene and using that as the argument to the switch_scene block to implement PackedScene. https://phabricator.endlessm.com/T35706 --- .../blocks/communication/switch_scene.tres | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 addons/block_code/blocks/communication/switch_scene.tres diff --git a/addons/block_code/blocks/communication/switch_scene.tres b/addons/block_code/blocks/communication/switch_scene.tres new file mode 100644 index 00000000..cf1bfe7e --- /dev/null +++ b/addons/block_code/blocks/communication/switch_scene.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://dnc2555wnobks"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_rnqd5"] + +[resource] +script = ExtResource("1_rnqd5") +name = &"switch_scene" +target_node_class = "" +description = "Stop playing the current scene, and switch to a different one. You might use this to switch to a new level." +category = "Communication | Methods" +type = 2 +variant_type = 0 +display_template = "switch the scene to {file_path: STRING}" +code_template = "get_tree().change_scene_to_file({file_path}) +" +defaults = {} +signal_name = "" +scope = ""