File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
addons/block_code/ui/picker/categories Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,23 @@ static func get_general_categories() -> Array[BlockCategory]:
235235 var input_list : Array [Block ] = _get_input_blocks ()
236236 var input_category : BlockCategory = BlockCategory .new ("Input" , input_list , Color .SLATE_GRAY )
237237
238+ # Sound
239+ var sound_list : Array [Block ] = []
240+
241+ b = BLOCKS ["statement_block" ].instantiate ()
242+ b .block_type = Types .BlockType .EXECUTE
243+ b .block_format = "Load file {file_path: STRING} as sound {name: STRING} "
244+ b .statement = "var sound = AudioStreamPlayer.new()\n sound.name = {name} \n sound.set_stream(load({file_path} ))\n add_child(sound)\n sound.set_owner(self)"
245+ sound_list .append (b )
246+
247+ b = BLOCKS ["statement_block" ].instantiate ()
248+ b .block_type = Types .BlockType .EXECUTE
249+ b .block_format = "Play the sound {name: STRING} with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT} "
250+ b .statement = "var sound = find_child({name} )\n sound.volume_db = {db} \n sound.pitch_scale = {pitch} \n sound.play()"
251+ sound_list .append (b )
252+
253+ var sound_category : BlockCategory = BlockCategory .new ("Sound" , sound_list , Color ("e30fc0" ))
254+
238255 return [
239256 lifecycle_category ,
240257 signal_category ,
@@ -244,6 +261,7 @@ static func get_general_categories() -> Array[BlockCategory]:
244261 logic_category ,
245262 variable_category ,
246263 input_category ,
264+ sound_category ,
247265 ]
248266
249267
You can’t perform that action at this time.
0 commit comments