1- [gd_scene load_steps =75 format =3 uid ="uid://tf7b8c64ecc0" ]
1+ [gd_scene load_steps =78 format =3 uid ="uid://tf7b8c64ecc0" ]
22
33[ext_resource type ="PackedScene" uid ="uid://cg8ibi18um3vg" path ="res://addons/block_code/examples/pong_game/space.tscn" id ="1_y56ac" ]
44[ext_resource type ="Script" path ="res://addons/block_code/block_code_node/block_code.gd" id ="3_6jaq8" ]
@@ -146,58 +146,20 @@ func _process(delta):
146146"
147147version = 0
148148
149- [sub_resource type ="Resource" id ="Resource_6jqfj" ]
150- script = ExtResource ("4_qtggh" )
151- name = &"load_sound"
152- children = Array[ExtResource ("4_qtggh" )]([])
153- arguments = {
154- "file_path" : "res://addons/block_code/examples/pong_game/assets/paddle_hit.ogg" ,
155- "name" : "paddle_hit"
156- }
157-
158- [sub_resource type ="Resource" id ="Resource_27m4u" ]
159- script = ExtResource ("4_qtggh" )
160- name = &"load_sound"
161- children = Array[ExtResource ("4_qtggh" )]([])
162- arguments = {
163- "file_path" : "res://addons/block_code/examples/pong_game/assets/wall_hit.ogg" ,
164- "name" : "wall_hit"
165- }
166-
167- [sub_resource type ="Resource" id ="Resource_avkfr" ]
168- script = ExtResource ("4_qtggh" )
169- name = &"load_sound"
170- children = Array[ExtResource ("4_qtggh" )]([])
171- arguments = {
172- "file_path" : "res://addons/block_code/examples/pong_game/assets/score.ogg" ,
173- "name" : "score_sound"
174- }
175-
176- [sub_resource type ="Resource" id ="Resource_l70er" ]
177- script = ExtResource ("4_qtggh" )
178- name = &"ready"
179- children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_6jqfj" ), SubResource ("Resource_27m4u" ), SubResource ("Resource_avkfr" )])
180- arguments = {}
181-
182- [sub_resource type ="Resource" id ="Resource_w8omx" ]
183- script = ExtResource ("5_omlge" )
184- root = SubResource ("Resource_l70er" )
185- canvas_position = Vector2 (25 , 0 )
186-
187- [sub_resource type ="Resource" id ="Resource_evnyh" ]
149+ [sub_resource type ="Resource" id ="Resource_r6bda" ]
188150script = ExtResource ("11_yafka" )
189151name = &"rigidbody2d_on_entered:something"
190152arguments = {}
191153
192- [sub_resource type ="Resource" id ="Resource_u6uv2 " ]
154+ [sub_resource type ="Resource" id ="Resource_ce25h " ]
193155script = ExtResource ("11_yafka" )
194156name = &"is_node_in_group"
195157arguments = {
196158"group" : "paddles" ,
197- "node" : SubResource ("Resource_evnyh " )
159+ "node" : SubResource ("Resource_r6bda " )
198160}
199161
200- [sub_resource type ="Resource" id ="Resource_wiphk " ]
162+ [sub_resource type ="Resource" id ="Resource_46k5t " ]
201163script = ExtResource ("4_qtggh" )
202164name = &"play_sound"
203165children = Array[ExtResource ("4_qtggh" )]([])
@@ -207,28 +169,28 @@ arguments = {
207169"pitch" : 1.0
208170}
209171
210- [sub_resource type ="Resource" id ="Resource_nma3q " ]
172+ [sub_resource type ="Resource" id ="Resource_wjess " ]
211173script = ExtResource ("4_qtggh" )
212174name = &"if"
213- children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_wiphk " )])
175+ children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_46k5t " )])
214176arguments = {
215- "condition" : SubResource ("Resource_u6uv2 " )
177+ "condition" : SubResource ("Resource_ce25h " )
216178}
217179
218- [sub_resource type ="Resource" id ="Resource_yt6ib " ]
180+ [sub_resource type ="Resource" id ="Resource_km5gt " ]
219181script = ExtResource ("11_yafka" )
220182name = &"rigidbody2d_on_entered:something"
221183arguments = {}
222184
223- [sub_resource type ="Resource" id ="Resource_ywck6 " ]
185+ [sub_resource type ="Resource" id ="Resource_dg5ee " ]
224186script = ExtResource ("11_yafka" )
225187name = &"is_node_in_group"
226188arguments = {
227189"group" : "walls" ,
228- "node" : SubResource ("Resource_yt6ib " )
190+ "node" : SubResource ("Resource_km5gt " )
229191}
230192
231- [sub_resource type ="Resource" id ="Resource_ai74x " ]
193+ [sub_resource type ="Resource" id ="Resource_y0sh0 " ]
232194script = ExtResource ("4_qtggh" )
233195name = &"play_sound"
234196children = Array[ExtResource ("4_qtggh" )]([])
@@ -238,70 +200,70 @@ arguments = {
238200"pitch" : 1.0
239201}
240202
241- [sub_resource type ="Resource" id ="Resource_rfg43 " ]
203+ [sub_resource type ="Resource" id ="Resource_x2htf " ]
242204script = ExtResource ("4_qtggh" )
243205name = &"if"
244- children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_ai74x " )])
206+ children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_y0sh0 " )])
245207arguments = {
246- "condition" : SubResource ("Resource_ywck6 " )
208+ "condition" : SubResource ("Resource_dg5ee " )
247209}
248210
249- [sub_resource type ="Resource" id ="Resource_0yy2j " ]
211+ [sub_resource type ="Resource" id ="Resource_vq2uo " ]
250212script = ExtResource ("4_qtggh" )
251213name = &"rigidbody2d_on_entered"
252- children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_nma3q " ), SubResource ("Resource_rfg43 " )])
214+ children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_wjess " ), SubResource ("Resource_x2htf " )])
253215arguments = {}
254216
255- [sub_resource type ="Resource" id ="Resource_121qg " ]
217+ [sub_resource type ="Resource" id ="Resource_7ydb5 " ]
256218script = ExtResource ("5_omlge" )
257- root = SubResource ("Resource_0yy2j " )
219+ root = SubResource ("Resource_vq2uo " )
258220canvas_position = Vector2 (25 , 450 )
259221
260- [sub_resource type ="Resource" id ="Resource_iwf5j " ]
222+ [sub_resource type ="Resource" id ="Resource_k085k " ]
261223script = ExtResource ("11_yafka" )
262224name = &"viewport_center"
263225arguments = {}
264226
265- [sub_resource type ="Resource" id ="Resource_ck8x6 " ]
227+ [sub_resource type ="Resource" id ="Resource_0q78u " ]
266228script = ExtResource ("4_qtggh" )
267229name = &"rigidbody2d_physics_position"
268230children = Array[ExtResource ("4_qtggh" )]([])
269231arguments = {
270- "position" : SubResource ("Resource_iwf5j " )
232+ "position" : SubResource ("Resource_k085k " )
271233}
272234
273- [sub_resource type ="Resource" id ="Resource_pxfyd " ]
235+ [sub_resource type ="Resource" id ="Resource_wmwo5 " ]
274236script = ExtResource ("11_yafka" )
275237name = &"randf_range"
276238arguments = {
277239"from" : 0.0 ,
278240"to" : 6.28
279241}
280242
281- [sub_resource type ="Resource" id ="Resource_3p8ft " ]
243+ [sub_resource type ="Resource" id ="Resource_har8s " ]
282244script = ExtResource ("11_yafka" )
283245name = &"from_angle"
284246arguments = {
285- "angle" : SubResource ("Resource_pxfyd " )
247+ "angle" : SubResource ("Resource_wmwo5 " )
286248}
287249
288- [sub_resource type ="Resource" id ="Resource_fqd50 " ]
250+ [sub_resource type ="Resource" id ="Resource_r2jq1 " ]
289251script = ExtResource ("11_yafka" )
290252name = &"vector_multiply"
291253arguments = {
292254"number" : 600.0 ,
293- "vector" : SubResource ("Resource_3p8ft " )
255+ "vector" : SubResource ("Resource_har8s " )
294256}
295257
296- [sub_resource type ="Resource" id ="Resource_wm52c " ]
258+ [sub_resource type ="Resource" id ="Resource_uapoe " ]
297259script = ExtResource ("4_qtggh" )
298260name = &"RigidBody2D_set_linear_velocity"
299261children = Array[ExtResource ("4_qtggh" )]([])
300262arguments = {
301- "value" : SubResource ("Resource_fqd50 " )
263+ "value" : SubResource ("Resource_r2jq1 " )
302264}
303265
304- [sub_resource type ="Resource" id ="Resource_jnqks " ]
266+ [sub_resource type ="Resource" id ="Resource_3748g " ]
305267script = ExtResource ("4_qtggh" )
306268name = &"play_sound"
307269children = Array[ExtResource ("4_qtggh" )]([])
@@ -311,49 +273,90 @@ arguments = {
311273"pitch" : 1.0
312274}
313275
314- [sub_resource type ="Resource" id ="Resource_hy3qr " ]
276+ [sub_resource type ="Resource" id ="Resource_krp6r " ]
315277script = ExtResource ("4_qtggh" )
316278name = &"define_method"
317- children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_ck8x6 " ), SubResource ("Resource_wm52c " ), SubResource ("Resource_jnqks " )])
279+ children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_0q78u " ), SubResource ("Resource_uapoe " ), SubResource ("Resource_3748g " )])
318280arguments = {
319281"method_name" : &"reset"
320282}
321283
322- [sub_resource type ="Resource" id ="Resource_7gd06 " ]
284+ [sub_resource type ="Resource" id ="Resource_3h40j " ]
323285script = ExtResource ("5_omlge" )
324- root = SubResource ("Resource_hy3qr " )
286+ root = SubResource ("Resource_krp6r " )
325287canvas_position = Vector2 (25 , 225 )
326288
289+ [sub_resource type ="Resource" id ="Resource_tv0hx" ]
290+ script = ExtResource ("11_yafka" )
291+ name = &"get_resource_file_path"
292+ arguments = {
293+ "file_path" : "res://addons/block_code/examples/pong_game/assets/paddle_hit.ogg"
294+ }
295+
296+ [sub_resource type ="Resource" id ="Resource_ia7i5" ]
297+ script = ExtResource ("4_qtggh" )
298+ name = &"load_sound"
299+ children = Array[ExtResource ("4_qtggh" )]([])
300+ arguments = {
301+ "file_path" : SubResource ("Resource_tv0hx" ),
302+ "name" : "paddle_hit"
303+ }
304+
305+ [sub_resource type ="Resource" id ="Resource_y62st" ]
306+ script = ExtResource ("11_yafka" )
307+ name = &"get_resource_file_path"
308+ arguments = {
309+ "file_path" : "res://addons/block_code/examples/pong_game/assets/wall_hit.ogg"
310+ }
311+
312+ [sub_resource type ="Resource" id ="Resource_dumkh" ]
313+ script = ExtResource ("4_qtggh" )
314+ name = &"load_sound"
315+ children = Array[ExtResource ("4_qtggh" )]([])
316+ arguments = {
317+ "file_path" : SubResource ("Resource_y62st" ),
318+ "name" : "wall_hit"
319+ }
320+
321+ [sub_resource type ="Resource" id ="Resource_0eh8h" ]
322+ script = ExtResource ("11_yafka" )
323+ name = &"get_resource_file_path"
324+ arguments = {
325+ "file_path" : "res://addons/block_code/examples/pong_game/assets/score.ogg"
326+ }
327+
328+ [sub_resource type ="Resource" id ="Resource_cpa6m" ]
329+ script = ExtResource ("4_qtggh" )
330+ name = &"load_sound"
331+ children = Array[ExtResource ("4_qtggh" )]([])
332+ arguments = {
333+ "file_path" : SubResource ("Resource_0eh8h" ),
334+ "name" : "score_sound"
335+ }
336+
337+ [sub_resource type ="Resource" id ="Resource_4xh8x" ]
338+ script = ExtResource ("4_qtggh" )
339+ name = &"ready"
340+ children = Array[ExtResource ("4_qtggh" )]([SubResource ("Resource_ia7i5" ), SubResource ("Resource_dumkh" ), SubResource ("Resource_cpa6m" )])
341+ arguments = {}
342+
343+ [sub_resource type ="Resource" id ="Resource_6txnc" ]
344+ script = ExtResource ("5_omlge" )
345+ root = SubResource ("Resource_4xh8x" )
346+ canvas_position = Vector2 (25 , -75 )
347+
327348[sub_resource type ="Resource" id ="Resource_6m2mk" ]
328349script = ExtResource ("7_uuuue" )
329350script_inherits = "RigidBody2D"
330- block_serialization_trees = Array[ExtResource ("5_omlge" )]([SubResource ("Resource_w8omx " ), SubResource ("Resource_121qg " ), SubResource ("Resource_7gd06 " )])
351+ block_serialization_trees = Array[ExtResource ("5_omlge" )]([SubResource ("Resource_7ydb5 " ), SubResource ("Resource_3h40j " ), SubResource ("Resource_6txnc " )])
331352variables = Array[ExtResource ("9_lo3p1" )]([])
332353generated_script = "extends RigidBody2D
333354
334355
335356func _init():
336357 body_entered.connect(_on_body_entered)
337358
338- func _ready():
339- var __sound_1 = AudioStreamPlayer.new()
340- __sound_1.name = 'paddle_hit'
341- __sound_1.set_stream(load('res://addons/block_code/examples/pong_game/assets/paddle_hit.ogg'))
342- add_child(__sound_1)
343-
344- var __sound_2 = AudioStreamPlayer.new()
345- __sound_2.name = 'wall_hit'
346- __sound_2.set_stream(load('res://addons/block_code/examples/pong_game/assets/wall_hit.ogg'))
347- add_child(__sound_2)
348-
349- var __sound_3 = AudioStreamPlayer.new()
350- __sound_3.name = 'score_sound'
351- __sound_3.set_stream(load('res://addons/block_code/examples/pong_game/assets/score.ogg'))
352- add_child(__sound_3)
353-
354-
355359func _on_body_entered(something: Node2D):
356-
357360 if ((something).is_in_group('paddles')):
358361 var __sound_node_1 = get_node('paddle_hit')
359362 __sound_node_1.volume_db = 0
@@ -381,6 +384,23 @@ func reset():
381384 __sound_node_1.play()
382385
383386
387+ func _ready():
388+ var __sound_1 = AudioStreamPlayer.new()
389+ __sound_1.name = 'paddle_hit'
390+ __sound_1.set_stream(load(('res://addons/block_code/examples/pong_game/assets/paddle_hit.ogg')))
391+ add_child(__sound_1)
392+
393+ var __sound_2 = AudioStreamPlayer.new()
394+ __sound_2.name = 'wall_hit'
395+ __sound_2.set_stream(load(('res://addons/block_code/examples/pong_game/assets/wall_hit.ogg')))
396+ add_child(__sound_2)
397+
398+ var __sound_3 = AudioStreamPlayer.new()
399+ __sound_3.name = 'score_sound'
400+ __sound_3.set_stream(load(('res://addons/block_code/examples/pong_game/assets/score.ogg')))
401+ add_child(__sound_3)
402+
403+
384404"
385405version = 0
386406
0 commit comments