Sound effects
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://brugqnquwjrkt"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://brugqnquwjrkt"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://fxf6wd4317fb" path="res://Assets/Towers/4.png" id="1_1544k"]
|
||||
[ext_resource type="Script" uid="uid://dil41a1ymo0ua" path="res://Game/Towers/towers.gd" id="1_ssiuv"]
|
||||
[ext_resource type="AudioStream" uid="uid://c4f4xbghas1qn" path="res://Assets/Sounds/Arrow shoot.mp3" id="3_be2t6"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ssiuv"]
|
||||
atlas = ExtResource("1_1544k")
|
||||
@ -90,3 +91,6 @@ autostart = true
|
||||
position = Vector2(0, 17)
|
||||
shape = SubResource("CapsuleShape2D_ssiuv")
|
||||
debug_color = Color(0.862152, 0.144907, 0.800391, 0.42)
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("3_be2t6")
|
||||
|
@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://uqxd2lii1xba"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://uqxd2lii1xba"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dil41a1ymo0ua" path="res://Game/Towers/towers.gd" id="1_bhlym"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkgih7tl654v1" path="res://Assets/Towers/Mortar part (3).png" id="1_sq58r"]
|
||||
[ext_resource type="Texture2D" uid="uid://cm33n3xc81rpj" path="res://Assets/Towers/Mortar part (2).png" id="2_bhlym"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxtluaplpd8hg" path="res://Assets/Towers/Mortar part (1).png" id="3_82ftk"]
|
||||
[ext_resource type="AudioStream" uid="uid://ml4th2ybf7dg" path="res://Assets/Sounds/mortar shoot.mp3" id="5_82ftk"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_cfdf4"]
|
||||
radius = 29.0
|
||||
@ -57,3 +58,6 @@ autostart = true
|
||||
position = Vector2(0, 17)
|
||||
shape = SubResource("CapsuleShape2D_bhlym")
|
||||
debug_color = Color(0.862152, 0.144907, 0.800391, 0.42)
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("5_82ftk")
|
||||
|
@ -7,6 +7,9 @@ var hitpoint = 0
|
||||
var follower = false
|
||||
var target = null
|
||||
|
||||
var SFX_loudness = 1.0
|
||||
var master_volume = 1.0
|
||||
|
||||
const ARROW = preload("res://Game/Bullets/arrow.tscn")
|
||||
const MAGIC = preload("res://Game/Bullets/magic.tscn")
|
||||
const ROCK = preload("res://Game/Bullets/rock.tscn")
|
||||
@ -20,6 +23,13 @@ func _ready() -> void:
|
||||
get_node("Timer").timeout.connect(shoot)
|
||||
set_process_input(true)
|
||||
set_properties()
|
||||
var config = ConfigFile.new()
|
||||
var err = config.load("user://settings.cfg")
|
||||
if err == OK:
|
||||
var master_volume_raw = config.get_value("audio", "master_volume", 100.0)
|
||||
master_volume = clamp(master_volume_raw / 100.0, 0.0, 1.0)
|
||||
var sfx_volume_raw = config.get_value("audio", "sfx_volume", 100.0)
|
||||
SFX_loudness = clamp(sfx_volume_raw / 100.0, 0.0, 1.0)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if follower:
|
||||
@ -120,4 +130,7 @@ func shoot() -> void:
|
||||
rock.set_hitpoint(hitpoint)
|
||||
get_parent().add_child(rock)
|
||||
lifter = true
|
||||
pass
|
||||
|
||||
self.get_node("AudioStreamPlayer2D").volume_db = linear_to_db(master_volume * SFX_loudness)
|
||||
self.get_node("AudioStreamPlayer2D").playing = true
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b4e605q60lde4"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://b4e605q60lde4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dil41a1ymo0ua" path="res://Game/Towers/towers.gd" id="1_grwc8"]
|
||||
[ext_resource type="Texture2D" uid="uid://dngrpwmj4oedg" path="res://Assets/Towers/S_Fly.png" id="2_grwc8"]
|
||||
[ext_resource type="AudioStream" uid="uid://1kv8ioeghh5u" path="res://Assets/Sounds/wizard shoot.mp3" id="3_35u2c"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_35u2c"]
|
||||
atlas = ExtResource("2_grwc8")
|
||||
@ -98,3 +99,6 @@ autostart = true
|
||||
position = Vector2(0, 17)
|
||||
shape = SubResource("CapsuleShape2D_grwc8")
|
||||
debug_color = Color(0.862152, 0.144907, 0.800391, 0.42)
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("3_35u2c")
|
||||
|
Reference in New Issue
Block a user