-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
addons/block_code/simple_nodes/simple_sound/simple_sound.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@tool | ||
class_name SimpleSound | ||
extends AudioStreamPlayer | ||
|
||
|
||
func get_class(): | ||
return "SimpleSound" | ||
|
||
|
||
static func get_custom_blocks() -> Array[BlockCategory]: | ||
var b: Block | ||
|
||
# Play the sound | ||
var sound_list: Array[Block] = [] | ||
b = CategoryFactory.BLOCKS["statement_block"].instantiate() | ||
b.block_type = Types.BlockType.EXECUTE | ||
b.block_format = "Play the sound with Volume dB {db: FLOAT} and Pitch Scale {pitch: FLOAT}" | ||
b.statement = "volume_db={db}\npitch_scale={pitch}\n" + "play()" | ||
sound_list.append(b) | ||
|
||
var sound_cat: BlockCategory = BlockCategory.new("PlaySound", sound_list, Color("e30fc0")) | ||
|
||
return [sound_cat] |
6 changes: 6 additions & 0 deletions
6
addons/block_code/simple_nodes/simple_sound/simple_sound.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://dnea31ja51r43"] | ||
|
||
[ext_resource type="Script" path="res://addons/block_code/simple_nodes/simple_sound/simple_sound.gd" id="1_7dbg7"] | ||
|
||
[node name="SimpleSound" type="AudioStreamPlayer"] | ||
script = ExtResource("1_7dbg7") |