|
| 1 | +[gd_scene load_steps=37 format=3 uid="uid://cbgxxdewi6gld"] |
| 2 | + |
| 3 | +[ext_resource type="Script" path="res://addons/block_code/simple_spawner/simple_spawner.gd" id="1_g2l2s"] |
| 4 | +[ext_resource type="PackedScene" uid="uid://c7l70grmkauij" path="res://addons/block_code/examples/spawner/ball.tscn" id="2_d0h86"] |
| 5 | +[ext_resource type="PackedScene" uid="uid://c8hrliwojohal" path="res://addons/block_code/examples/spawner/volatile_ball.tscn" id="3_tt12o"] |
| 6 | +[ext_resource type="Script" path="res://addons/block_code/block_code_node/block_code.gd" id="4_e0fbh"] |
| 7 | +[ext_resource type="Script" path="res://addons/block_code/serialization/block_serialization_tree.gd" id="5_g4h7g"] |
| 8 | +[ext_resource type="Script" path="res://addons/block_code/serialization/block_serialization.gd" id="6_dv2kl"] |
| 9 | +[ext_resource type="Script" path="res://addons/block_code/serialization/value_block_serialization.gd" id="7_cykhe"] |
| 10 | +[ext_resource type="Script" path="res://addons/block_code/serialization/block_script_serialization.gd" id="8_tovvd"] |
| 11 | +[ext_resource type="Script" path="res://addons/block_code/code_generation/variable_definition.gd" id="9_m8g1j"] |
| 12 | + |
| 13 | +[sub_resource type="Resource" id="Resource_1x252"] |
| 14 | +script = ExtResource("6_dv2kl") |
| 15 | +name = &"simplespawner_start_spawning" |
| 16 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 17 | +arguments = {} |
| 18 | + |
| 19 | +[sub_resource type="Resource" id="Resource_1j04f"] |
| 20 | +script = ExtResource("6_dv2kl") |
| 21 | +name = &"ready" |
| 22 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_1x252")]) |
| 23 | +arguments = {} |
| 24 | + |
| 25 | +[sub_resource type="Resource" id="Resource_jiosv"] |
| 26 | +script = ExtResource("5_g4h7g") |
| 27 | +root = SubResource("Resource_1j04f") |
| 28 | +canvas_position = Vector2(54, 47) |
| 29 | + |
| 30 | +[sub_resource type="Resource" id="Resource_uan44"] |
| 31 | +script = ExtResource("7_cykhe") |
| 32 | +name = &"is_input_actioned" |
| 33 | +arguments = { |
| 34 | +"action": "just_pressed", |
| 35 | +"action_name": &"ui_right" |
| 36 | +} |
| 37 | + |
| 38 | +[sub_resource type="Resource" id="Resource_uv0fo"] |
| 39 | +script = ExtResource("7_cykhe") |
| 40 | +name = &"simplespawner_get_spawn_frequency" |
| 41 | +arguments = {} |
| 42 | + |
| 43 | +[sub_resource type="Resource" id="Resource_l45hk"] |
| 44 | +script = ExtResource("7_cykhe") |
| 45 | +name = &"subtract" |
| 46 | +arguments = { |
| 47 | +"a": SubResource("Resource_uv0fo"), |
| 48 | +"b": 0.1 |
| 49 | +} |
| 50 | + |
| 51 | +[sub_resource type="Resource" id="Resource_6g0ng"] |
| 52 | +script = ExtResource("6_dv2kl") |
| 53 | +name = &"simplespawner_set_spawn_frequency" |
| 54 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 55 | +arguments = { |
| 56 | +"new_frequency": SubResource("Resource_l45hk") |
| 57 | +} |
| 58 | + |
| 59 | +[sub_resource type="Resource" id="Resource_ke4bk"] |
| 60 | +script = ExtResource("6_dv2kl") |
| 61 | +name = &"if" |
| 62 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_6g0ng")]) |
| 63 | +arguments = { |
| 64 | +"condition": SubResource("Resource_uan44") |
| 65 | +} |
| 66 | + |
| 67 | +[sub_resource type="Resource" id="Resource_67w0v"] |
| 68 | +script = ExtResource("7_cykhe") |
| 69 | +name = &"is_input_actioned" |
| 70 | +arguments = { |
| 71 | +"action": "just_pressed", |
| 72 | +"action_name": &"ui_left" |
| 73 | +} |
| 74 | + |
| 75 | +[sub_resource type="Resource" id="Resource_ih8lj"] |
| 76 | +script = ExtResource("7_cykhe") |
| 77 | +name = &"simplespawner_get_spawn_frequency" |
| 78 | +arguments = {} |
| 79 | + |
| 80 | +[sub_resource type="Resource" id="Resource_rfxul"] |
| 81 | +script = ExtResource("7_cykhe") |
| 82 | +name = &"add" |
| 83 | +arguments = { |
| 84 | +"a": SubResource("Resource_ih8lj"), |
| 85 | +"b": 0.1 |
| 86 | +} |
| 87 | + |
| 88 | +[sub_resource type="Resource" id="Resource_2rqfa"] |
| 89 | +script = ExtResource("6_dv2kl") |
| 90 | +name = &"simplespawner_set_spawn_frequency" |
| 91 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 92 | +arguments = { |
| 93 | +"new_frequency": SubResource("Resource_rfxul") |
| 94 | +} |
| 95 | + |
| 96 | +[sub_resource type="Resource" id="Resource_movu5"] |
| 97 | +script = ExtResource("6_dv2kl") |
| 98 | +name = &"else_if" |
| 99 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_2rqfa")]) |
| 100 | +arguments = { |
| 101 | +"condition": SubResource("Resource_67w0v") |
| 102 | +} |
| 103 | + |
| 104 | +[sub_resource type="Resource" id="Resource_aoehr"] |
| 105 | +script = ExtResource("7_cykhe") |
| 106 | +name = &"is_input_actioned" |
| 107 | +arguments = { |
| 108 | +"action": "just_pressed", |
| 109 | +"action_name": &"ui_up" |
| 110 | +} |
| 111 | + |
| 112 | +[sub_resource type="Resource" id="Resource_tuny8"] |
| 113 | +script = ExtResource("7_cykhe") |
| 114 | +name = &"simplespawner_is_spawning" |
| 115 | +arguments = {} |
| 116 | + |
| 117 | +[sub_resource type="Resource" id="Resource_v1c1o"] |
| 118 | +script = ExtResource("6_dv2kl") |
| 119 | +name = &"simplespawner_stop_spawning" |
| 120 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 121 | +arguments = {} |
| 122 | + |
| 123 | +[sub_resource type="Resource" id="Resource_6dkv5"] |
| 124 | +script = ExtResource("6_dv2kl") |
| 125 | +name = &"if" |
| 126 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_v1c1o")]) |
| 127 | +arguments = { |
| 128 | +"condition": SubResource("Resource_tuny8") |
| 129 | +} |
| 130 | + |
| 131 | +[sub_resource type="Resource" id="Resource_xtxo1"] |
| 132 | +script = ExtResource("6_dv2kl") |
| 133 | +name = &"simplespawner_start_spawning" |
| 134 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 135 | +arguments = {} |
| 136 | + |
| 137 | +[sub_resource type="Resource" id="Resource_0f8d8"] |
| 138 | +script = ExtResource("6_dv2kl") |
| 139 | +name = &"else" |
| 140 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_xtxo1")]) |
| 141 | +arguments = {} |
| 142 | + |
| 143 | +[sub_resource type="Resource" id="Resource_ecrx1"] |
| 144 | +script = ExtResource("6_dv2kl") |
| 145 | +name = &"else_if" |
| 146 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_6dkv5"), SubResource("Resource_0f8d8")]) |
| 147 | +arguments = { |
| 148 | +"condition": SubResource("Resource_aoehr") |
| 149 | +} |
| 150 | + |
| 151 | +[sub_resource type="Resource" id="Resource_5s4db"] |
| 152 | +script = ExtResource("7_cykhe") |
| 153 | +name = &"is_input_actioned" |
| 154 | +arguments = { |
| 155 | +"action": "just_pressed", |
| 156 | +"action_name": &"ui_down" |
| 157 | +} |
| 158 | + |
| 159 | +[sub_resource type="Resource" id="Resource_umo5i"] |
| 160 | +script = ExtResource("6_dv2kl") |
| 161 | +name = &"simplespawner_spawn_once" |
| 162 | +children = Array[ExtResource("6_dv2kl")]([]) |
| 163 | +arguments = {} |
| 164 | + |
| 165 | +[sub_resource type="Resource" id="Resource_xar12"] |
| 166 | +script = ExtResource("6_dv2kl") |
| 167 | +name = &"else_if" |
| 168 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_umo5i")]) |
| 169 | +arguments = { |
| 170 | +"condition": SubResource("Resource_5s4db") |
| 171 | +} |
| 172 | + |
| 173 | +[sub_resource type="Resource" id="Resource_psdqc"] |
| 174 | +script = ExtResource("6_dv2kl") |
| 175 | +name = &"process" |
| 176 | +children = Array[ExtResource("6_dv2kl")]([SubResource("Resource_ke4bk"), SubResource("Resource_movu5"), SubResource("Resource_ecrx1"), SubResource("Resource_xar12")]) |
| 177 | +arguments = {} |
| 178 | + |
| 179 | +[sub_resource type="Resource" id="Resource_0lc7n"] |
| 180 | +script = ExtResource("5_g4h7g") |
| 181 | +root = SubResource("Resource_psdqc") |
| 182 | +canvas_position = Vector2(50, 200) |
| 183 | + |
| 184 | +[sub_resource type="Resource" id="Resource_trjwk"] |
| 185 | +script = ExtResource("8_tovvd") |
| 186 | +script_inherits = "SimpleSpawner" |
| 187 | +block_serialization_trees = Array[ExtResource("5_g4h7g")]([SubResource("Resource_jiosv"), SubResource("Resource_0lc7n")]) |
| 188 | +variables = Array[ExtResource("9_m8g1j")]([]) |
| 189 | +generated_script = "extends SimpleSpawner |
| 190 | +
|
| 191 | +
|
| 192 | +func _ready(): |
| 193 | + spawn_start() |
| 194 | +
|
| 195 | +func _process(delta): |
| 196 | + if (Input.is_action_just_pressed('ui_right')): |
| 197 | + do_set_spawn_frequency(((spawn_frequency) - 0.1)) |
| 198 | + elif (Input.is_action_just_pressed('ui_left')): |
| 199 | + do_set_spawn_frequency(((spawn_frequency) + 0.1)) |
| 200 | + elif (Input.is_action_just_pressed('ui_up')): |
| 201 | + if (is_spawning()): |
| 202 | + spawn_stop() |
| 203 | + else: |
| 204 | + spawn_start() |
| 205 | + elif (Input.is_action_just_pressed('ui_down')): |
| 206 | + spawn_once() |
| 207 | +
|
| 208 | +" |
| 209 | +version = 0 |
| 210 | + |
| 211 | +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_c5n1h"] |
| 212 | + |
| 213 | +[node name="Node2D" type="Node2D"] |
| 214 | + |
| 215 | +[node name="SimpleSpawner" type="Node2D" parent="."] |
| 216 | +position = Vector2(103, 128) |
| 217 | +script = ExtResource("1_g2l2s") |
| 218 | +scenes = Array[PackedScene]([ExtResource("2_d0h86"), ExtResource("3_tt12o")]) |
| 219 | +spawn_frequency = 0.6 |
| 220 | +spawn_limit = 5 |
| 221 | + |
| 222 | +[node name="BlockCode" type="Node" parent="SimpleSpawner"] |
| 223 | +script = ExtResource("4_e0fbh") |
| 224 | +block_script = SubResource("Resource_trjwk") |
| 225 | + |
| 226 | +[node name="StaticBody2D" type="StaticBody2D" parent="."] |
| 227 | + |
| 228 | +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] |
| 229 | +position = Vector2(64, 648) |
| 230 | +shape = SubResource("WorldBoundaryShape2D_c5n1h") |
| 231 | + |
| 232 | +[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"] |
| 233 | +position = Vector2(24, 0) |
| 234 | +rotation = -3.14159 |
| 235 | +shape = SubResource("WorldBoundaryShape2D_c5n1h") |
| 236 | + |
| 237 | +[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D"] |
| 238 | +position = Vector2(0, 128) |
| 239 | +rotation = -4.71238 |
| 240 | +shape = SubResource("WorldBoundaryShape2D_c5n1h") |
| 241 | + |
| 242 | +[node name="CollisionShape2D4" type="CollisionShape2D" parent="StaticBody2D"] |
| 243 | +position = Vector2(1152, 320) |
| 244 | +rotation = -7.85397 |
| 245 | +shape = SubResource("WorldBoundaryShape2D_c5n1h") |
| 246 | + |
| 247 | +[node name="CanvasLayer" type="CanvasLayer" parent="."] |
| 248 | + |
| 249 | +[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer"] |
| 250 | +anchors_preset = 15 |
| 251 | +anchor_right = 1.0 |
| 252 | +anchor_bottom = 1.0 |
| 253 | +offset_right = -781.0 |
| 254 | +grow_horizontal = 2 |
| 255 | +grow_vertical = 2 |
| 256 | +theme_override_constants/margin_left = 15 |
| 257 | +theme_override_constants/margin_top = 15 |
| 258 | + |
| 259 | +[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/MarginContainer"] |
| 260 | +layout_mode = 2 |
| 261 | +bbcode_enabled = true |
| 262 | +text = "[b]Up arrow:[/b] Start/stop spawning. |
| 263 | +[b]Down arrow:[/b] Spawn once. |
| 264 | +[b]Left arrow:[/b] Reduce spawn frequency. |
| 265 | +[b]Right arrow:[/b] Increase spawn frequency. |
| 266 | +
|
| 267 | +From the Inspector: Try changing spawn limit and spawn limit behavior. |
| 268 | +
|
| 269 | +Color balls remove themselves after 3 seconds. While uncolored balls are only removed by the SimpleSpawner node according to the limit setings." |
0 commit comments