|
1 | | -[gd_scene load_steps=165 format=3 uid="uid://tf7b8c64ecc0"] |
| 1 | +[gd_scene load_steps=166 format=3 uid="uid://tf7b8c64ecc0"] |
2 | 2 |
|
3 | | -[ext_resource type="PackedScene" uid="uid://s7enbp56f256" path="res://addons/block_code/examples/pong_game/paddle.tscn" id="1_1k5k2"] |
4 | 3 | [ext_resource type="Script" path="res://addons/block_code/examples/pong_game/pong_game.gd" id="1_bjkc8"] |
5 | 4 | [ext_resource type="PackedScene" uid="uid://cg8ibi18um3vg" path="res://addons/block_code/examples/pong_game/space.tscn" id="1_y56ac"] |
6 | 5 | [ext_resource type="Script" path="res://addons/block_code/block_code_node/block_code.gd" id="3_6jaq8"] |
| 6 | +[ext_resource type="PackedScene" uid="uid://ddx1cd5q6t61o" path="res://addons/block_code/simple_nodes/simple_character/simple_character.tscn" id="3_hjpbs"] |
7 | 7 | [ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block_tree_node.gd" id="4_qtggh"] |
| 8 | +[ext_resource type="Texture2D" uid="uid://tplpgtnfeda0" path="res://addons/block_code/examples/pong_game/assets/paddle.png" id="4_ra7bh"] |
8 | 9 | [ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block.gd" id="5_wr38c"] |
9 | 10 | [ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block_tree_node_array.gd" id="6_ppdc3"] |
10 | 11 | [ext_resource type="Script" path="res://addons/block_code/block_script_data/block_script_data.gd" id="7_uuuue"] |
|
13 | 14 | [ext_resource type="PackedScene" uid="uid://1ownc3rikn2k" path="res://addons/block_code/examples/pong_game/ball_spawn_area.tscn" id="10_5vs1t"] |
14 | 15 | [ext_resource type="PackedScene" uid="uid://fhoapg3anjsu" path="res://addons/block_code/examples/pong_game/goal_area.tscn" id="12_nqmxu"] |
15 | 16 |
|
16 | | -[sub_resource type="Resource" id="Resource_2ownr"] |
| 17 | +[sub_resource type="Resource" id="Resource_02fc8"] |
17 | 18 | script = ExtResource("5_wr38c") |
18 | 19 | block_class = &"StatementBlock" |
19 | | -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.290196, 0.52549, 0.835294, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Move with player 2 buttons, speed {speed: VECTOR2}"], ["statement", "velocity = Input.get_vector(\"player_2_left\", \"player_2_right\", \"player_2_up\", \"player_2_down\")*{speed} |
| 20 | +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", "Move with player 1 buttons, speed {speed: VECTOR2}"], ["statement", "var dir = Vector2() |
| 21 | +dir.x += float(Input.is_key_pressed(KEY_D)) |
| 22 | +dir.x -= float(Input.is_key_pressed(KEY_A)) |
| 23 | +dir.y += float(Input.is_key_pressed(KEY_S)) |
| 24 | +dir.y -= float(Input.is_key_pressed(KEY_W)) |
| 25 | +dir = dir.normalized() |
| 26 | +velocity = dir*{speed} |
20 | 27 | move_and_slide()"], ["defaults", {}], ["param_input_strings", { |
21 | | -"speed": "0, 1000" |
| 28 | +"speed": "0,1000" |
22 | 29 | }]] |
23 | 30 |
|
24 | | -[sub_resource type="Resource" id="Resource_lt7l7"] |
| 31 | +[sub_resource type="Resource" id="Resource_hofsq"] |
25 | 32 | script = ExtResource("4_qtggh") |
26 | | -serialized_block = SubResource("Resource_2ownr") |
| 33 | +serialized_block = SubResource("Resource_02fc8") |
27 | 34 | path_child_pairs = [] |
28 | 35 |
|
29 | | -[sub_resource type="Resource" id="Resource_lp80u"] |
| 36 | +[sub_resource type="Resource" id="Resource_ijy7o"] |
30 | 37 | script = ExtResource("5_wr38c") |
31 | 38 | block_class = &"EntryBlock" |
32 | | -serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(36, 43)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] |
| 39 | +serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(82, 24)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] |
33 | 40 |
|
34 | | -[sub_resource type="Resource" id="Resource_0j1nn"] |
| 41 | +[sub_resource type="Resource" id="Resource_wlov0"] |
35 | 42 | script = ExtResource("4_qtggh") |
36 | | -serialized_block = SubResource("Resource_lp80u") |
37 | | -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_lt7l7")]] |
| 43 | +serialized_block = SubResource("Resource_ijy7o") |
| 44 | +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_hofsq")]] |
38 | 45 |
|
39 | | -[sub_resource type="Resource" id="Resource_t1ec3"] |
| 46 | +[sub_resource type="Resource" id="Resource_frqvp"] |
40 | 47 | script = ExtResource("6_ppdc3") |
41 | | -array = Array[ExtResource("4_qtggh")]([SubResource("Resource_0j1nn")]) |
| 48 | +array = Array[ExtResource("4_qtggh")]([SubResource("Resource_wlov0")]) |
42 | 49 |
|
43 | | -[sub_resource type="Resource" id="Resource_t7nl4"] |
| 50 | +[sub_resource type="Resource" id="Resource_qmak3"] |
44 | 51 | script = ExtResource("7_uuuue") |
45 | | -script_inherits = "Paddle" |
46 | | -block_trees = SubResource("Resource_t1ec3") |
47 | | -generated_script = "extends Paddle |
| 52 | +script_inherits = "SimpleCharacter" |
| 53 | +block_trees = SubResource("Resource_frqvp") |
| 54 | +generated_script = "extends SimpleCharacter |
48 | 55 |
|
49 | 56 | var VAR_DICT := {} |
50 | 57 |
|
51 | 58 | func _process(delta): |
52 | | - velocity = Input.get_vector(\"player_2_left\", \"player_2_right\", \"player_2_up\", \"player_2_down\")*Vector2(0, 1000) |
| 59 | + var dir = Vector2() |
| 60 | + dir.x += float(Input.is_key_pressed(KEY_D)) |
| 61 | + dir.x -= float(Input.is_key_pressed(KEY_A)) |
| 62 | + dir.y += float(Input.is_key_pressed(KEY_S)) |
| 63 | + dir.y -= float(Input.is_key_pressed(KEY_W)) |
| 64 | + dir = dir.normalized() |
| 65 | + velocity = dir*Vector2(0,1000) |
53 | 66 | move_and_slide() |
54 | 67 |
|
55 | 68 | " |
56 | 69 |
|
57 | | -[sub_resource type="Resource" id="Resource_lf6va"] |
| 70 | +[sub_resource type="Resource" id="Resource_wvsmi"] |
58 | 71 | script = ExtResource("5_wr38c") |
59 | 72 | block_class = &"StatementBlock" |
60 | | -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.290196, 0.52549, 0.835294, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Move with player 1 buttons, speed {speed: VECTOR2}"], ["statement", "velocity = Input.get_vector(\"ui_left\", \"ui_right\", \"ui_up\", \"ui_down\")*{speed} |
| 73 | +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", "Move with player 2 buttons, speed {speed: VECTOR2}"], ["statement", "var dir = Vector2() |
| 74 | +dir.x += float(Input.is_key_pressed(KEY_RIGHT)) |
| 75 | +dir.x -= float(Input.is_key_pressed(KEY_LEFT)) |
| 76 | +dir.y += float(Input.is_key_pressed(KEY_DOWN)) |
| 77 | +dir.y -= float(Input.is_key_pressed(KEY_UP)) |
| 78 | +dir = dir.normalized() |
| 79 | +velocity = dir*{speed} |
61 | 80 | move_and_slide()"], ["defaults", {}], ["param_input_strings", { |
62 | | -"speed": "0, 1000" |
| 81 | +"speed": "0,1000" |
63 | 82 | }]] |
64 | 83 |
|
65 | | -[sub_resource type="Resource" id="Resource_5obqu"] |
| 84 | +[sub_resource type="Resource" id="Resource_v80v0"] |
66 | 85 | script = ExtResource("4_qtggh") |
67 | | -serialized_block = SubResource("Resource_lf6va") |
| 86 | +serialized_block = SubResource("Resource_wvsmi") |
68 | 87 | path_child_pairs = [] |
69 | 88 |
|
70 | | -[sub_resource type="Resource" id="Resource_hhevk"] |
| 89 | +[sub_resource type="Resource" id="Resource_3qglq"] |
71 | 90 | script = ExtResource("5_wr38c") |
72 | 91 | block_class = &"EntryBlock" |
73 | | -serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(34, 50)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] |
| 92 | +serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(57, 27)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["defaults", {}], ["param_input_strings", {}], ["signal_name", ""]] |
74 | 93 |
|
75 | | -[sub_resource type="Resource" id="Resource_ipx1e"] |
| 94 | +[sub_resource type="Resource" id="Resource_gnrty"] |
76 | 95 | script = ExtResource("4_qtggh") |
77 | | -serialized_block = SubResource("Resource_hhevk") |
78 | | -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_5obqu")]] |
| 96 | +serialized_block = SubResource("Resource_3qglq") |
| 97 | +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_v80v0")]] |
79 | 98 |
|
80 | | -[sub_resource type="Resource" id="Resource_iqrk3"] |
| 99 | +[sub_resource type="Resource" id="Resource_2qfet"] |
81 | 100 | script = ExtResource("6_ppdc3") |
82 | | -array = Array[ExtResource("4_qtggh")]([SubResource("Resource_ipx1e")]) |
| 101 | +array = Array[ExtResource("4_qtggh")]([SubResource("Resource_gnrty")]) |
83 | 102 |
|
84 | | -[sub_resource type="Resource" id="Resource_52r02"] |
| 103 | +[sub_resource type="Resource" id="Resource_lxj2y"] |
85 | 104 | script = ExtResource("7_uuuue") |
86 | | -script_inherits = "Paddle" |
87 | | -block_trees = SubResource("Resource_iqrk3") |
88 | | -generated_script = "extends Paddle |
| 105 | +script_inherits = "SimpleCharacter" |
| 106 | +block_trees = SubResource("Resource_2qfet") |
| 107 | +generated_script = "extends SimpleCharacter |
89 | 108 |
|
90 | 109 | var VAR_DICT := {} |
91 | 110 |
|
92 | 111 | func _process(delta): |
93 | | - velocity = Input.get_vector(\"ui_left\", \"ui_right\", \"ui_up\", \"ui_down\")*Vector2(0, 1000) |
| 112 | + var dir = Vector2() |
| 113 | + dir.x += float(Input.is_key_pressed(KEY_RIGHT)) |
| 114 | + dir.x -= float(Input.is_key_pressed(KEY_LEFT)) |
| 115 | + dir.y += float(Input.is_key_pressed(KEY_DOWN)) |
| 116 | + dir.y -= float(Input.is_key_pressed(KEY_UP)) |
| 117 | + dir = dir.normalized() |
| 118 | + velocity = dir*Vector2(0,1000) |
94 | 119 | move_and_slide() |
95 | 120 |
|
96 | 121 | " |
@@ -1020,21 +1045,25 @@ script = ExtResource("1_bjkc8") |
1020 | 1045 |
|
1021 | 1046 | [node name="Space" parent="." instance=ExtResource("1_y56ac")] |
1022 | 1047 |
|
1023 | | -[node name="PaddleLeft" parent="." instance=ExtResource("1_1k5k2")] |
1024 | | -modulate = Color(0.511, 0.362, 0.972, 1) |
| 1048 | +[node name="PaddleLeft" parent="." instance=ExtResource("3_hjpbs")] |
| 1049 | +modulate = Color(0.509804, 0.360784, 0.972549, 1) |
1025 | 1050 | position = Vector2(64, 544) |
| 1051 | +collision_mask = 5 |
| 1052 | +texture = ExtResource("4_ra7bh") |
1026 | 1053 |
|
1027 | 1054 | [node name="BlockCode" type="Node" parent="PaddleLeft"] |
1028 | 1055 | script = ExtResource("3_6jaq8") |
1029 | | -block_script = SubResource("Resource_t7nl4") |
| 1056 | +block_script = SubResource("Resource_qmak3") |
1030 | 1057 |
|
1031 | | -[node name="PaddleRight" parent="." instance=ExtResource("1_1k5k2")] |
1032 | | -modulate = Color(0.511, 0.362, 0.972, 1) |
| 1058 | +[node name="PaddleRight" parent="." instance=ExtResource("3_hjpbs")] |
| 1059 | +modulate = Color(0.509804, 0.360784, 0.972549, 1) |
1033 | 1060 | position = Vector2(1856, 544) |
| 1061 | +collision_mask = 5 |
| 1062 | +texture = ExtResource("4_ra7bh") |
1034 | 1063 |
|
1035 | 1064 | [node name="BlockCode" type="Node" parent="PaddleRight"] |
1036 | 1065 | script = ExtResource("3_6jaq8") |
1037 | | -block_script = SubResource("Resource_52r02") |
| 1066 | +block_script = SubResource("Resource_lxj2y") |
1038 | 1067 |
|
1039 | 1068 | [node name="Ball" parent="." instance=ExtResource("9_xrqll")] |
1040 | 1069 | modulate = Color(0.511, 0.362, 0.972, 1) |
|
0 commit comments