|
1 | | -[gd_scene load_steps=33 format=3 uid="uid://tf7b8c64ecc0"] |
| 1 | +[gd_scene load_steps=61 format=3 uid="uid://tf7b8c64ecc0"] |
2 | 2 |
|
3 | 3 | [ext_resource type="PackedScene" uid="uid://s7enbp56f256" path="res://pong_game/paddle.tscn" id="1_1k5k2"] |
4 | 4 | [ext_resource type="Script" path="res://pong_game/pong_game.gd" id="1_bjkc8"] |
@@ -95,6 +95,210 @@ func _process(delta): |
95 | 95 |
|
96 | 96 | " |
97 | 97 |
|
| 98 | +[sub_resource type="Resource" id="Resource_w7llf"] |
| 99 | +script = ExtResource("5_wr38c") |
| 100 | +block_class = &"StatementBlock" |
| 101 | +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() |
| 102 | +VAR_DICT[{name}].name = {name} |
| 103 | +VAR_DICT[{name}].set_stream(load({file_path})) |
| 104 | +add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { |
| 105 | +"file_path": "res://pong_game/wall_hit.ogg", |
| 106 | +"name": "wall_hit" |
| 107 | +}]] |
| 108 | + |
| 109 | +[sub_resource type="Resource" id="Resource_dvwua"] |
| 110 | +script = ExtResource("4_qtggh") |
| 111 | +serialized_block = SubResource("Resource_w7llf") |
| 112 | +path_child_pairs = [] |
| 113 | + |
| 114 | +[sub_resource type="Resource" id="Resource_rrqjv"] |
| 115 | +script = ExtResource("5_wr38c") |
| 116 | +block_class = &"StatementBlock" |
| 117 | +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() |
| 118 | +VAR_DICT[{name}].name = {name} |
| 119 | +VAR_DICT[{name}].set_stream(load({file_path})) |
| 120 | +add_child(VAR_DICT[{name}])"], ["defaults", {}], ["param_input_strings", { |
| 121 | +"file_path": "res://pong_game/paddle_hit.ogg", |
| 122 | +"name": "paddle_hit" |
| 123 | +}]] |
| 124 | + |
| 125 | +[sub_resource type="Resource" id="Resource_c4ce1"] |
| 126 | +script = ExtResource("4_qtggh") |
| 127 | +serialized_block = SubResource("Resource_rrqjv") |
| 128 | +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_dvwua")]] |
| 129 | + |
| 130 | +[sub_resource type="Resource" id="Resource_r8cwo"] |
| 131 | +script = ExtResource("5_wr38c") |
| 132 | +block_class = &"EntryBlock" |
| 133 | +serialized_props = [["block_name", "ready_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(54, 47)], ["block_format", "On Ready"], ["statement", "func _ready():"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] |
| 134 | + |
| 135 | +[sub_resource type="Resource" id="Resource_pgiuj"] |
| 136 | +script = ExtResource("4_qtggh") |
| 137 | +serialized_block = SubResource("Resource_r8cwo") |
| 138 | +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_c4ce1")]] |
| 139 | + |
| 140 | +[sub_resource type="Resource" id="Resource_lkcfx"] |
| 141 | +script = ExtResource("5_wr38c") |
| 142 | +block_class = &"ParameterBlock" |
| 143 | +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", {}]] |
| 144 | + |
| 145 | +[sub_resource type="Resource" id="Resource_vne13"] |
| 146 | +script = ExtResource("4_qtggh") |
| 147 | +serialized_block = SubResource("Resource_lkcfx") |
| 148 | +path_child_pairs = [] |
| 149 | + |
| 150 | +[sub_resource type="Resource" id="Resource_mkixe"] |
| 151 | +script = ExtResource("5_wr38c") |
| 152 | +block_class = &"ParameterBlock" |
| 153 | +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", {}]] |
| 154 | + |
| 155 | +[sub_resource type="Resource" id="Resource_ja8qr"] |
| 156 | +script = ExtResource("4_qtggh") |
| 157 | +serialized_block = SubResource("Resource_mkixe") |
| 158 | +path_child_pairs = [] |
| 159 | + |
| 160 | +[sub_resource type="Resource" id="Resource_6233g"] |
| 161 | +script = ExtResource("5_wr38c") |
| 162 | +block_class = &"ParameterBlock" |
| 163 | +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", { |
| 164 | +"group": "paddles", |
| 165 | +"node": "" |
| 166 | +}]] |
| 167 | + |
| 168 | +[sub_resource type="Resource" id="Resource_ar1vw"] |
| 169 | +script = ExtResource("4_qtggh") |
| 170 | +serialized_block = SubResource("Resource_6233g") |
| 171 | +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_ja8qr")]] |
| 172 | + |
| 173 | +[sub_resource type="Resource" id="Resource_hbwws"] |
| 174 | +script = ExtResource("5_wr38c") |
| 175 | +block_class = &"StatementBlock" |
| 176 | +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} |
| 177 | +VAR_DICT[{name}].pitch_scale = {pitch} |
| 178 | +VAR_DICT[{name}].play()"], ["defaults", {}], ["param_input_strings", { |
| 179 | +"db": "0.0", |
| 180 | +"name": "paddle_hit", |
| 181 | +"pitch": "1.0" |
| 182 | +}]] |
| 183 | + |
| 184 | +[sub_resource type="Resource" id="Resource_xb342"] |
| 185 | +script = ExtResource("4_qtggh") |
| 186 | +serialized_block = SubResource("Resource_hbwws") |
| 187 | +path_child_pairs = [] |
| 188 | + |
| 189 | +[sub_resource type="Resource" id="Resource_y0dfo"] |
| 190 | +script = ExtResource("5_wr38c") |
| 191 | +block_class = &"ParameterBlock" |
| 192 | +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", {}]] |
| 193 | + |
| 194 | +[sub_resource type="Resource" id="Resource_lkc6w"] |
| 195 | +script = ExtResource("4_qtggh") |
| 196 | +serialized_block = SubResource("Resource_y0dfo") |
| 197 | +path_child_pairs = [] |
| 198 | + |
| 199 | +[sub_resource type="Resource" id="Resource_ou8eo"] |
| 200 | +script = ExtResource("5_wr38c") |
| 201 | +block_class = &"ParameterBlock" |
| 202 | +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", { |
| 203 | +"group": "walls", |
| 204 | +"node": "" |
| 205 | +}]] |
| 206 | + |
| 207 | +[sub_resource type="Resource" id="Resource_jp11d"] |
| 208 | +script = ExtResource("4_qtggh") |
| 209 | +serialized_block = SubResource("Resource_ou8eo") |
| 210 | +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_lkc6w")]] |
| 211 | + |
| 212 | +[sub_resource type="Resource" id="Resource_rer42"] |
| 213 | +script = ExtResource("5_wr38c") |
| 214 | +block_class = &"StatementBlock" |
| 215 | +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} |
| 216 | +VAR_DICT[{name}].pitch_scale = {pitch} |
| 217 | +VAR_DICT[{name}].play()"], ["defaults", {}], ["param_input_strings", { |
| 218 | +"db": "0.0", |
| 219 | +"name": "wall_hit", |
| 220 | +"pitch": "1.0" |
| 221 | +}]] |
| 222 | + |
| 223 | +[sub_resource type="Resource" id="Resource_nanxw"] |
| 224 | +script = ExtResource("4_qtggh") |
| 225 | +serialized_block = SubResource("Resource_rer42") |
| 226 | +path_child_pairs = [] |
| 227 | + |
| 228 | +[sub_resource type="Resource" id="Resource_8ljc2"] |
| 229 | +script = ExtResource("5_wr38c") |
| 230 | +block_class = &"ControlBlock" |
| 231 | +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", [{ |
| 232 | +"condition": true |
| 233 | +}]]] |
| 234 | + |
| 235 | +[sub_resource type="Resource" id="Resource_ewj1y"] |
| 236 | +script = ExtResource("4_qtggh") |
| 237 | +serialized_block = SubResource("Resource_8ljc2") |
| 238 | +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_jp11d")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_nanxw")]] |
| 239 | + |
| 240 | +[sub_resource type="Resource" id="Resource_nwfcj"] |
| 241 | +script = ExtResource("5_wr38c") |
| 242 | +block_class = &"ControlBlock" |
| 243 | +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", [{ |
| 244 | +"condition": true |
| 245 | +}]]] |
| 246 | + |
| 247 | +[sub_resource type="Resource" id="Resource_up363"] |
| 248 | +script = ExtResource("4_qtggh") |
| 249 | +serialized_block = SubResource("Resource_nwfcj") |
| 250 | +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_ar1vw")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_xb342")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_ewj1y")]] |
| 251 | + |
| 252 | +[sub_resource type="Resource" id="Resource_uuy53"] |
| 253 | +script = ExtResource("5_wr38c") |
| 254 | +block_class = &"EntryBlock" |
| 255 | +serialized_props = [["block_name", "entry_block"], ["label", "EntryBlock"], ["color", Color(0.439216, 0.501961, 0.564706, 1)], ["block_type", 1], ["position", Vector2(54, 207)], ["block_format", "On [body: NODE_PATH] entered"], ["statement", "func _on_body_entered(_body: Node): |
| 256 | + var body: NodePath = _body.get_path()"], ["defaults", {}], ["param_input_strings", { |
| 257 | +"body": "" |
| 258 | +}], ["signal_name", "body_entered"]] |
| 259 | + |
| 260 | +[sub_resource type="Resource" id="Resource_6ki5d"] |
| 261 | +script = ExtResource("4_qtggh") |
| 262 | +serialized_block = SubResource("Resource_uuy53") |
| 263 | +path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_vne13")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_up363")]] |
| 264 | + |
| 265 | +[sub_resource type="Resource" id="Resource_7j4bl"] |
| 266 | +script = ExtResource("6_ppdc3") |
| 267 | +array = Array[ExtResource("4_qtggh")]([SubResource("Resource_pgiuj"), SubResource("Resource_6ki5d")]) |
| 268 | + |
| 269 | +[sub_resource type="Resource" id="Resource_gkcqr"] |
| 270 | +script = ExtResource("7_uuuue") |
| 271 | +script_inherits = "RigidBody2D" |
| 272 | +block_trees = SubResource("Resource_7j4bl") |
| 273 | +generated_script = "extends RigidBody2D |
| 274 | +
|
| 275 | +var VAR_DICT := {} |
| 276 | +
|
| 277 | +func _ready(): |
| 278 | + VAR_DICT['paddle_hit'] = AudioStreamPlayer.new() |
| 279 | + VAR_DICT['paddle_hit'].name = 'paddle_hit' |
| 280 | + VAR_DICT['paddle_hit'].set_stream(load('res://pong_game/paddle_hit.ogg')) |
| 281 | + add_child(VAR_DICT['paddle_hit']) |
| 282 | + VAR_DICT['wall_hit'] = AudioStreamPlayer.new() |
| 283 | + VAR_DICT['wall_hit'].name = 'wall_hit' |
| 284 | + VAR_DICT['wall_hit'].set_stream(load('res://pong_game/wall_hit.ogg')) |
| 285 | + add_child(VAR_DICT['wall_hit']) |
| 286 | +
|
| 287 | +func _on_body_entered(_body: Node): |
| 288 | + var body: NodePath = _body.get_path() |
| 289 | + if get_node(body).is_in_group('paddles'): |
| 290 | + VAR_DICT['paddle_hit'].volume_db = 0.0 |
| 291 | + VAR_DICT['paddle_hit'].pitch_scale = 1.0 |
| 292 | + VAR_DICT['paddle_hit'].play() |
| 293 | + if get_node(body).is_in_group('walls'): |
| 294 | + VAR_DICT['wall_hit'].volume_db = 0.0 |
| 295 | + VAR_DICT['wall_hit'].pitch_scale = 1.0 |
| 296 | + VAR_DICT['wall_hit'].play() |
| 297 | +
|
| 298 | +func _init(): |
| 299 | + body_entered.connect(_on_body_entered) |
| 300 | +" |
| 301 | + |
98 | 302 | [sub_resource type="Resource" id="Resource_ve47i"] |
99 | 303 | script = ExtResource("5_wr38c") |
100 | 304 | block_class = &"StatementBlock" |
@@ -173,6 +377,10 @@ modulate = Color(0.511, 0.362, 0.972, 1) |
173 | 377 | position = Vector2(960, 544) |
174 | 378 | linear_velocity = Vector2(353.553, 353.553) |
175 | 379 |
|
| 380 | +[node name="BlockCode" type="Node" parent="Ball"] |
| 381 | +script = ExtResource("3_6jaq8") |
| 382 | +block_script = SubResource("Resource_gkcqr") |
| 383 | + |
176 | 384 | [node name="BallSpawnArea" parent="." groups=["ball_spawn_area"] instance=ExtResource("10_5vs1t")] |
177 | 385 | position = Vector2(960, 544) |
178 | 386 |
|
|
0 commit comments