From fab3100e82c6f00a9da5c9f09f7b8802b8ce7511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 27 Jun 2024 16:41:29 -0300 Subject: [PATCH 1/7] Add viewport value blocks To integer blocks for the viewport width and height. And one Vecto2 block for the viewport center. --- .../ui/picker/categories/category_factory.gd | 32 +++++++++++++++++++ tests/test_category_factory.gd | 1 + 2 files changed, 33 insertions(+) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index a4b19431..6b4e7798 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -43,6 +43,11 @@ const BUILTIN_PROPS: Dictionary = { "color": Color("03aa74"), "order": 60, }, + "Graphics | Viewport": + { + "color": Color("03aa74"), + "order": 61, + }, "Sounds": { "color": Color("e30fc0"), @@ -462,6 +467,33 @@ static func get_general_blocks() -> Array[Block]: b.tooltip_text = "Play the audio stream with volume and pitch" b.category = "Sounds" block_list.append(b) +#endregion +#region Graphics + + var viewport_width = ProjectSettings.get_setting("display/window/size/viewport_width") + var viewport_height = ProjectSettings.get_setting("display/window/size/viewport_height") + + b = BLOCKS["parameter_block"].instantiate() + b.variant_type = TYPE_INT + b.block_format = "viewport width" + b.statement = "%s" % viewport_width + b.category = "Graphics | Viewport" + block_list.append(b) + + b = BLOCKS["parameter_block"].instantiate() + b.variant_type = TYPE_INT + b.block_format = "viewport height" + b.statement = "%s" % viewport_height + b.category = "Graphics | Viewport" + block_list.append(b) + + b = BLOCKS["parameter_block"].instantiate() + b.variant_type = TYPE_VECTOR2 + b.block_format = "viewport center" + b.statement = "Vector2(%s, %s)" % [viewport_width / 2, viewport_height / 2] + b.category = "Graphics | Viewport" + block_list.append(b) + #endregion return block_list diff --git a/tests/test_category_factory.gd b/tests/test_category_factory.gd index f677eaf1..63b29930 100644 --- a/tests/test_category_factory.gd +++ b/tests/test_category_factory.gd @@ -31,6 +31,7 @@ func test_general_category_names(): names, [ "Lifecycle", + "Graphics | Viewport", "Sounds", "Input", "Communication | Methods", From 8c3ad6528b3bad4a57bc2bc5a7ea14c55e0a6098 Mon Sep 17 00:00:00 2001 From: manuq Date: Fri, 28 Jun 2024 09:58:04 -0300 Subject: [PATCH 2/7] Update addons/block_code/ui/picker/categories/category_factory.gd Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com> --- addons/block_code/ui/picker/categories/category_factory.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index 6b4e7798..0c13f940 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -475,7 +475,7 @@ static func get_general_blocks() -> Array[Block]: b = BLOCKS["parameter_block"].instantiate() b.variant_type = TYPE_INT - b.block_format = "viewport width" + b.block_format = "Viewport Width" b.statement = "%s" % viewport_width b.category = "Graphics | Viewport" block_list.append(b) From c29c0c199595bb567088e1ac9353c4031771aa57 Mon Sep 17 00:00:00 2001 From: manuq Date: Fri, 28 Jun 2024 09:58:18 -0300 Subject: [PATCH 3/7] Update addons/block_code/ui/picker/categories/category_factory.gd Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com> --- addons/block_code/ui/picker/categories/category_factory.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index 0c13f940..9ca88160 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -483,7 +483,7 @@ static func get_general_blocks() -> Array[Block]: b = BLOCKS["parameter_block"].instantiate() b.variant_type = TYPE_INT b.block_format = "viewport height" - b.statement = "%s" % viewport_height + b.statement = "get_viewport().get_visible_rect().size.y" b.category = "Graphics | Viewport" block_list.append(b) From 439f9da9c486c2ce55d228c9686c869877bb6da6 Mon Sep 17 00:00:00 2001 From: manuq Date: Fri, 28 Jun 2024 09:58:23 -0300 Subject: [PATCH 4/7] Update addons/block_code/ui/picker/categories/category_factory.gd Co-authored-by: wnbaum <42101167+wnbaum@users.noreply.github.com> --- addons/block_code/ui/picker/categories/category_factory.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index 9ca88160..ae495516 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -490,7 +490,7 @@ static func get_general_blocks() -> Array[Block]: b = BLOCKS["parameter_block"].instantiate() b.variant_type = TYPE_VECTOR2 b.block_format = "viewport center" - b.statement = "Vector2(%s, %s)" % [viewport_width / 2, viewport_height / 2] + b.statement = "get_viewport().get_visible_rect().get_center()" b.category = "Graphics | Viewport" block_list.append(b) From dd61f2bceb988a45c201cb8d52956581aa45bf0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 28 Jun 2024 10:36:07 -0300 Subject: [PATCH 5/7] fixup! Add viewport value blocks --- .../ui/picker/categories/category_factory.gd | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index ae495516..d30486a8 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -470,27 +470,24 @@ static func get_general_blocks() -> Array[Block]: #endregion #region Graphics - var viewport_width = ProjectSettings.get_setting("display/window/size/viewport_width") - var viewport_height = ProjectSettings.get_setting("display/window/size/viewport_height") - b = BLOCKS["parameter_block"].instantiate() - b.variant_type = TYPE_INT + b.variant_type = TYPE_FLOAT b.block_format = "Viewport Width" - b.statement = "%s" % viewport_width + b.statement = "(func (): var transform: Transform2D = get_viewport_transform(); var scale: Vector2 = transform.get_scale(); return -transform.origin.x / scale.x + get_viewport_rect().size.x / scale.x).call()" b.category = "Graphics | Viewport" block_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.variant_type = TYPE_INT - b.block_format = "viewport height" - b.statement = "get_viewport().get_visible_rect().size.y" + b.variant_type = TYPE_FLOAT + b.block_format = "Viewport Height" + b.statement = "(func (): var transform: Transform2D = get_viewport_transform(); var scale: Vector2 = transform.get_scale(); return -transform.origin.y / scale.y + get_viewport_rect().size.y / scale.y).call()" b.category = "Graphics | Viewport" block_list.append(b) b = BLOCKS["parameter_block"].instantiate() b.variant_type = TYPE_VECTOR2 - b.block_format = "viewport center" - b.statement = "get_viewport().get_visible_rect().get_center()" + b.block_format = "Viewport Center" + b.statement = "(func (): var transform: Transform2D = get_viewport_transform(); var scale: Vector2 = transform.get_scale(); return -transform.origin / scale + get_viewport_rect().size / scale / 2).call()" b.category = "Graphics | Viewport" block_list.append(b) From 0b457751a9c1388107b7cbcafd3f1d76ad5c6f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 28 Jun 2024 10:37:57 -0300 Subject: [PATCH 6/7] Add variable block to construct a Vector2 from X,Y --- addons/block_code/ui/picker/categories/category_factory.gd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index d30486a8..28405df4 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -353,6 +353,13 @@ static func get_general_blocks() -> Array[Block]: b.category = "Variables" block_list.append(b) + b = BLOCKS["parameter_block"].instantiate() + b.variant_type = TYPE_VECTOR2 + b.block_format = "Vector2 x: {x: FLOAT} y: {y: FLOAT}" + b.statement = "Vector2({x}, {y})" + b.category = "Variables" + block_list.append(b) + #endregion #region Math From c8808b93089e61f061c946ca32eacd79f63ba703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 28 Jun 2024 10:41:22 -0300 Subject: [PATCH 7/7] Pong: Update ball reset to use viewport center block --- .../examples/pong_game/pong_game.tscn | 210 ++++++++++-------- 1 file changed, 115 insertions(+), 95 deletions(-) diff --git a/addons/block_code/examples/pong_game/pong_game.tscn b/addons/block_code/examples/pong_game/pong_game.tscn index 96eae8e0..04202aae 100644 --- a/addons/block_code/examples/pong_game/pong_game.tscn +++ b/addons/block_code/examples/pong_game/pong_game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=156 format=3 uid="uid://tf7b8c64ecc0"] +[gd_scene load_steps=160 format=3 uid="uid://tf7b8c64ecc0"] [ext_resource type="PackedScene" uid="uid://cg8ibi18um3vg" path="res://addons/block_code/examples/pong_game/space.tscn" id="1_y56ac"] [ext_resource type="Script" path="res://addons/block_code/block_code_node/block_code.gd" id="3_6jaq8"] @@ -118,10 +118,10 @@ func _process(delta): " -[sub_resource type="Resource" id="Resource_5e1be"] +[sub_resource type="Resource" id="Resource_e3587"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() VAR_DICT[{name}].name = {name} VAR_DICT[{name}].set_stream(load({file_path})) add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { @@ -129,15 +129,15 @@ add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { "name": "score_sound" }]] -[sub_resource type="Resource" id="Resource_r0ypl"] +[sub_resource type="Resource" id="Resource_7iny5"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_5e1be") +serialized_block = SubResource("Resource_e3587") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_suh88"] +[sub_resource type="Resource" id="Resource_dqj2p"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() VAR_DICT[{name}].name = {name} VAR_DICT[{name}].set_stream(load({file_path})) add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { @@ -145,15 +145,15 @@ add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { "name": "wall_hit" }]] -[sub_resource type="Resource" id="Resource_7d22a"] +[sub_resource type="Resource" id="Resource_2hpvi"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_suh88") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_r0ypl")]] +serialized_block = SubResource("Resource_dqj2p") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_7iny5")]] -[sub_resource type="Resource" id="Resource_wvg7q"] +[sub_resource type="Resource" id="Resource_4i1tm"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Load file {file_path: STRING} as sound {name: STRING}"], ["statement", "VAR_DICT[{name}] = AudioStreamPlayer.new() VAR_DICT[{name}].name = {name} VAR_DICT[{name}].set_stream(load({file_path})) add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { @@ -161,25 +161,35 @@ add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { "name": "paddle_hit" }]] -[sub_resource type="Resource" id="Resource_jbs8m"] +[sub_resource type="Resource" id="Resource_cmfxm"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_wvg7q") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_7d22a")]] +serialized_block = SubResource("Resource_4i1tm") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_2hpvi")]] -[sub_resource type="Resource" id="Resource_yeod5"] +[sub_resource type="Resource" id="Resource_fxdev"] script = ExtResource("5_wr38c") block_class = &"EntryBlock" -serialized_props = [["block_name", "ready_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(49, 42)], ["block_format", "On Ready"], ["statement", "func _ready():"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] +serialized_props = [["block_name", "ready_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(49, 42)], ["scope", ""], ["block_format", "On Ready"], ["statement", "func _ready():"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] -[sub_resource type="Resource" id="Resource_oe1o1"] +[sub_resource type="Resource" id="Resource_papms"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_yeod5") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_jbs8m")]] +serialized_block = SubResource("Resource_fxdev") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_cmfxm")]] -[sub_resource type="Resource" id="Resource_vimfw"] +[sub_resource type="Resource" id="Resource_cvidu"] +script = ExtResource("5_wr38c") +block_class = &"ParameterBlock" +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.0117647, 0.666667, 0.454902, 1)], ["block_type", 3], ["position", Vector2(-59, -19)], ["scope", ""], ["block_format", "Viewport Center"], ["statement", "(func (): var transform: Transform2D = get_viewport_transform(); var scale: Vector2 = transform.get_scale(); return -transform.origin / scale + get_viewport_rect().size / scale / 2).call()"], ["defaults", {}], ["variant_type", 5], ["param_input_strings", {}]] + +[sub_resource type="Resource" id="Resource_gumfr"] +script = ExtResource("4_qtggh") +serialized_block = SubResource("Resource_cvidu") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_agq0h"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} VAR_DICT[{name}].pitch_scale = {pitch} VAR_DICT[{name}].play()"], ["defaults", { "db": "0.0", @@ -190,102 +200,112 @@ VAR_DICT[{name}].play()"], ["defaults", { "pitch": "1.0" }]] -[sub_resource type="Resource" id="Resource_gudl6"] +[sub_resource type="Resource" id="Resource_longg"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_vimfw") +serialized_block = SubResource("Resource_agq0h") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_vhqk1"] +[sub_resource type="Resource" id="Resource_utdhg"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Set Physics Position {position: VECTOR2}"], ["statement", "PhysicsServer2D.body_set_state(get_rid(),PhysicsServer2D.BODY_STATE_TRANSFORM,Transform2D.IDENTITY.translated({position}))"], ["defaults", {}], ["param_input_strings", { +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Set Physics Position {position: VECTOR2}"], ["statement", "PhysicsServer2D.body_set_state(get_rid(),PhysicsServer2D.BODY_STATE_TRANSFORM,Transform2D.IDENTITY.translated({position}))"], ["defaults", {}], ["param_input_strings", { "position": "960,544" }]] -[sub_resource type="Resource" id="Resource_qbqdv"] +[sub_resource type="Resource" id="Resource_00s4c"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_vhqk1") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_gudl6")]] +serialized_block = SubResource("Resource_utdhg") +path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_gumfr")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_longg")]] -[sub_resource type="Resource" id="Resource_6mykv"] +[sub_resource type="Resource" id="Resource_bb6gp"] script = ExtResource("5_wr38c") block_class = &"EntryBlock" -serialized_props = [["block_name", "entry_block"], ["label", "EntryBlock"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 1], ["position", Vector2(53, 718)], ["block_format", "Define method {method_name: NIL}"], ["statement", "func {method_name}():"], ["defaults", {}], ["param_input_strings", { +serialized_props = [["block_name", "entry_block"], ["label", "EntryBlock"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 1], ["position", Vector2(53, 718)], ["scope", ""], ["block_format", "Define method {method_name: NIL}"], ["statement", "func {method_name}():"], ["defaults", {}], ["param_input_strings", { "method_name": "reset" }], ["signal_name", ""]] -[sub_resource type="Resource" id="Resource_g7cuq"] +[sub_resource type="Resource" id="Resource_6euwx"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_6mykv") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_qbqdv")]] +serialized_block = SubResource("Resource_bb6gp") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_00s4c")]] -[sub_resource type="Resource" id="Resource_apjt3"] +[sub_resource type="Resource" id="Resource_ob35p"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_wcv2o"] +[sub_resource type="Resource" id="Resource_4mwit"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_apjt3") +serialized_block = SubResource("Resource_ob35p") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_e05op"] +[sub_resource type="Resource" id="Resource_cnlh2"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_ftxx4"] +[sub_resource type="Resource" id="Resource_4dkpm"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_e05op") +serialized_block = SubResource("Resource_cnlh2") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_6yr3p"] +[sub_resource type="Resource" id="Resource_p064j"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_t4ebi"] +[sub_resource type="Resource" id="Resource_dbe1g"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_6yr3p") +serialized_block = SubResource("Resource_p064j") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_kwre8"] +[sub_resource type="Resource" id="Resource_k0qcd"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_hip1e"] +[sub_resource type="Resource" id="Resource_88imm"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_kwre8") +serialized_block = SubResource("Resource_k0qcd") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_fm2pa"] +[sub_resource type="Resource" id="Resource_0jsrf"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_uyijp"] +[sub_resource type="Resource" id="Resource_6a253"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_fm2pa") +serialized_block = SubResource("Resource_0jsrf") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_pb08t"] +[sub_resource type="Resource" id="Resource_4sllx"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "Is {node: NODE_PATH} in group {group: STRING}"], ["statement", "get_node({node}).is_in_group({group})"], ["defaults", {}], ["variant_type", 1], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] + +[sub_resource type="Resource" id="Resource_3wben"] +script = ExtResource("4_qtggh") +serialized_block = SubResource("Resource_4sllx") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_pkfxn"] +script = ExtResource("5_wr38c") +block_class = &"ParameterBlock" +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Is {node: NODE_PATH} in group {group: STRING}"], ["statement", "get_node({node}).is_in_group({group})"], ["defaults", {}], ["variant_type", 1], ["param_input_strings", { "group": "paddles", "node": "" }]] -[sub_resource type="Resource" id="Resource_pix08"] +[sub_resource type="Resource" id="Resource_2jb83"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_pb08t") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_uyijp")]] +serialized_block = SubResource("Resource_pkfxn") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_3wben")]] -[sub_resource type="Resource" id="Resource_xm62d"] +[sub_resource type="Resource" id="Resource_12eqr"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} VAR_DICT[{name}].pitch_scale = {pitch} VAR_DICT[{name}].play()"], ["defaults", { "db": "0.0", @@ -296,38 +316,38 @@ VAR_DICT[{name}].play()"], ["defaults", { "pitch": "1.0" }]] -[sub_resource type="Resource" id="Resource_kl85v"] +[sub_resource type="Resource" id="Resource_o77yc"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_xm62d") +serialized_block = SubResource("Resource_12eqr") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_6dhjk"] +[sub_resource type="Resource" id="Resource_whprd"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "body"], ["statement", "body"], ["defaults", {}], ["variant_type", 22], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_b6xdu"] +[sub_resource type="Resource" id="Resource_ybc8w"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_6dhjk") +serialized_block = SubResource("Resource_whprd") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_lpr6l"] +[sub_resource type="Resource" id="Resource_pu3rf"] script = ExtResource("5_wr38c") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "Is {node: NODE_PATH} in group {group: STRING}"], ["statement", "get_node({node}).is_in_group({group})"], ["defaults", {}], ["variant_type", 1], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.941176, 0.764706, 0, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Is {node: NODE_PATH} in group {group: STRING}"], ["statement", "get_node({node}).is_in_group({group})"], ["defaults", {}], ["variant_type", 1], ["param_input_strings", { "group": "walls", "node": "" }]] -[sub_resource type="Resource" id="Resource_tpd36"] +[sub_resource type="Resource" id="Resource_4fyki"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_lpr6l") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_b6xdu")]] +serialized_block = SubResource("Resource_pu3rf") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_ybc8w")]] -[sub_resource type="Resource" id="Resource_osuwb"] +[sub_resource type="Resource" id="Resource_xc3uj"] script = ExtResource("5_wr38c") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.890196, 0.0588235, 0.752941, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_format", "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}"], ["statement", "VAR_DICT[{name}].volume_db = {db} VAR_DICT[{name}].pitch_scale = {pitch} VAR_DICT[{name}].play()"], ["defaults", { "db": "0.0", @@ -338,56 +358,56 @@ VAR_DICT[{name}].play()"], ["defaults", { "pitch": "1.0" }]] -[sub_resource type="Resource" id="Resource_m3r42"] +[sub_resource type="Resource" id="Resource_ajwvw"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_osuwb") +serialized_block = SubResource("Resource_xc3uj") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_wpohm"] +[sub_resource type="Resource" id="Resource_3itf4"] script = ExtResource("5_wr38c") block_class = &"ControlBlock" -serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_formats", ["if {condition: BOOL}"]], ["statements", ["if {condition}:"]], ["defaults", {}], ["param_input_strings_array", [{ +serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_formats", ["if {condition: BOOL}"]], ["statements", ["if {condition}:"]], ["defaults", {}], ["param_input_strings_array", [{ "condition": false }]]] -[sub_resource type="Resource" id="Resource_j7pwa"] +[sub_resource type="Resource" id="Resource_uod5v"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_wpohm") -path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_tpd36")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_m3r42")]] +serialized_block = SubResource("Resource_3itf4") +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_4fyki")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_ajwvw")]] -[sub_resource type="Resource" id="Resource_okw4k"] +[sub_resource type="Resource" id="Resource_ghlhm"] script = ExtResource("5_wr38c") block_class = &"ControlBlock" -serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_formats", ["if {condition: BOOL}"]], ["statements", ["if {condition}:"]], ["defaults", {}], ["param_input_strings_array", [{ +serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["scope", ""], ["block_formats", ["if {condition: BOOL}"]], ["statements", ["if {condition}:"]], ["defaults", {}], ["param_input_strings_array", [{ "condition": false }]]] -[sub_resource type="Resource" id="Resource_njb4u"] +[sub_resource type="Resource" id="Resource_l6y6r"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_okw4k") -path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_pix08")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_kl85v")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_j7pwa")]] +serialized_block = SubResource("Resource_ghlhm") +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_2jb83")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_o77yc")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_uod5v")]] -[sub_resource type="Resource" id="Resource_ceodt"] +[sub_resource type="Resource" id="Resource_hpekw"] script = ExtResource("5_wr38c") block_class = &"EntryBlock" -serialized_props = [["block_name", "entry_block"], ["label", "EntryBlock"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 1], ["position", Vector2(50, 275)], ["block_format", "On [body: NODE_PATH] entered"], ["statement", "func _on_body_entered(_body: Node): +serialized_props = [["block_name", "entry_block"], ["label", "EntryBlock"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 1], ["position", Vector2(50, 275)], ["scope", ""], ["block_format", "On [body: NODE_PATH] entered"], ["statement", "func _on_body_entered(_body: Node): var body: NodePath = _body.get_path()"], ["defaults", {}], ["param_input_strings", { "body": "" }], ["signal_name", "body_entered"]] -[sub_resource type="Resource" id="Resource_40j76"] +[sub_resource type="Resource" id="Resource_1pud8"] script = ExtResource("4_qtggh") -serialized_block = SubResource("Resource_ceodt") -path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_wcv2o")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_ftxx4")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_t4ebi")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_hip1e")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_njb4u")]] +serialized_block = SubResource("Resource_hpekw") +path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_4mwit")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_4dkpm")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_dbe1g")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_88imm")], [NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_6a253")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_l6y6r")]] -[sub_resource type="Resource" id="Resource_6s0mi"] +[sub_resource type="Resource" id="Resource_u421d"] script = ExtResource("6_ppdc3") -array = Array[ExtResource("4_qtggh")]([SubResource("Resource_oe1o1"), SubResource("Resource_g7cuq"), SubResource("Resource_40j76")]) +array = Array[ExtResource("4_qtggh")]([SubResource("Resource_papms"), SubResource("Resource_6euwx"), SubResource("Resource_1pud8")]) [sub_resource type="Resource" id="Resource_hnwk2"] script = ExtResource("7_uuuue") script_inherits = "RigidBody2D" -block_trees = SubResource("Resource_6s0mi") +block_trees = SubResource("Resource_u421d") generated_script = "extends RigidBody2D var VAR_DICT := {} @@ -407,7 +427,7 @@ func _ready(): add_child(VAR_DICT['score_sound']) func reset(): - PhysicsServer2D.body_set_state(get_rid(),PhysicsServer2D.BODY_STATE_TRANSFORM,Transform2D.IDENTITY.translated(Vector2(960,544))) + PhysicsServer2D.body_set_state(get_rid(),PhysicsServer2D.BODY_STATE_TRANSFORM,Transform2D.IDENTITY.translated((func (): var transform: Transform2D = get_viewport_transform(); var scale: Vector2 = transform.get_scale(); return -transform.origin / scale + get_viewport_rect().size / scale / 2).call())) VAR_DICT['score_sound'].volume_db = 0.0 VAR_DICT['score_sound'].pitch_scale = 1.0 VAR_DICT['score_sound'].play()