Adding sound and music

This commit is contained in:
Zacharie Guet 2024-09-01 18:16:06 +02:00
parent dfade2fc63
commit 78921a780c
35 changed files with 355 additions and 17 deletions

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://djfqv2eo5jdi1"
path="res://.godot/imported/Stade désertique et menu principal.mp3-1b13a3916faffaf0c456675fed18953f.mp3str"
[deps]
source_file="res://assets/musics/Stade désertique et menu principal.mp3"
dest_files=["res://.godot/imported/Stade désertique et menu principal.mp3-1b13a3916faffaf0c456675fed18953f.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://5lysviffy1di"
path="res://.godot/imported/Stade forestier.mp3-4e8a9f756c9abba7e1f248be5e84e663.mp3str"
[deps]
source_file="res://assets/musics/Stade forestier.mp3"
dest_files=["res://.godot/imported/Stade forestier.mp3-4e8a9f756c9abba7e1f248be5e84e663.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c0nkxfyebnbwv"
path="res://.godot/imported/Stade intermédiaire.mp3-89e057ad67b016feccd750e7d1f39452.mp3str"
[deps]
source_file="res://assets/musics/Stade intermédiaire.mp3"
dest_files=["res://.godot/imported/Stade intermédiaire.mp3-89e057ad67b016feccd750e7d1f39452.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://chj1wssgktreb"
path="res://.godot/imported/Clic bouton.mp3-c694b66c9b1337a1a8283d0e02ff0592.mp3str"
[deps]
source_file="res://assets/sounds/Actions/Clic bouton.mp3"
dest_files=["res://.godot/imported/Clic bouton.mp3-c694b66c9b1337a1a8283d0e02ff0592.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c1jt77fyb2lx4"
path="res://.godot/imported/Déplacement.mp3-9dbb38867989e9bda5febf405978b5cc.mp3str"
[deps]
source_file="res://assets/sounds/Actions/Déplacement.mp3"
dest_files=["res://.godot/imported/Déplacement.mp3-9dbb38867989e9bda5febf405978b5cc.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cb4ouq4awiyri"
path="res://.godot/imported/Planter.mp3-d0bfa1efed1955f0436eda13af5b0e8a.mp3str"
[deps]
source_file="res://assets/sounds/Actions/Planter.mp3"
dest_files=["res://.godot/imported/Planter.mp3-d0bfa1efed1955f0436eda13af5b0e8a.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://g4ro05oyetto"
path="res://.godot/imported/Arbre qui naît 2.mp3-ba760053935bbae76b9ce29c1044a619.mp3str"
[deps]
source_file="res://assets/sounds/Plantes/Arbre qui naît 2.mp3"
dest_files=["res://.godot/imported/Arbre qui naît 2.mp3-ba760053935bbae76b9ce29c1044a619.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dyjov38m6s5yn"
path="res://.godot/imported/Arbre qui naît.mp3-999e58dd5e4c91f33b1ff96e398577f6.mp3str"
[deps]
source_file="res://assets/sounds/Plantes/Arbre qui naît.mp3"
dest_files=["res://.godot/imported/Arbre qui naît.mp3-999e58dd5e4c91f33b1ff96e398577f6.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://be15j1o8vsq22"
path="res://.godot/imported/Evolution 1.1.mp3-1649069d70c39945181fd0831d189362.mp3str"
[deps]
source_file="res://assets/sounds/Plantes/Evolution 1.1.mp3"
dest_files=["res://.godot/imported/Evolution 1.1.mp3-1649069d70c39945181fd0831d189362.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c6k7okgjhxlgs"
path="res://.godot/imported/Evolution 2.1.mp3-a219b5c3c9d32619920a3825ea2064af.mp3str"
[deps]
source_file="res://assets/sounds/Plantes/Evolution 2.1.mp3"
dest_files=["res://.godot/imported/Evolution 2.1.mp3-a219b5c3c9d32619920a3825ea2064af.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bnssmx4nolln1"
path="res://.godot/imported/Herbe 6.mp3-83cf288a809ce8f154f020ce4442a2f9.mp3str"
[deps]
source_file="res://assets/sounds/Plantes/Herbe 6.mp3"
dest_files=["res://.godot/imported/Herbe 6.mp3-83cf288a809ce8f154f020ce4442a2f9.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://de81tdearo84u"
path="res://.godot/imported/sol_gamejam_fleurs_transp.png-a90818c15b209684d9b99456a6129892.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/texture/sol_gamejam_fleurs_transp.png"
dest_files=["res://.godot/imported/sol_gamejam_fleurs_transp.png-a90818c15b209684d9b99456a6129892.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c48gqsunv5wv3"
path="res://.godot/imported/sol_gamejam_pollution_transparent.png-931250579fef1b3f0cce6b45f384b131.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/texture/sol_gamejam_pollution_transparent.png"
dest_files=["res://.godot/imported/sol_gamejam_pollution_transparent.png-931250579fef1b3f0cce6b45f384b131.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

21
objects/Music.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=5 format=3 uid="uid://cl7c1l5cg4djm"]
[ext_resource type="Script" path="res://scripts/music.gd" id="1_bsdw2"]
[ext_resource type="AudioStream" uid="uid://djfqv2eo5jdi1" path="res://assets/musics/Stade désertique et menu principal.mp3" id="2_b6qy2"]
[ext_resource type="AudioStream" uid="uid://c0nkxfyebnbwv" path="res://assets/musics/Stade intermédiaire.mp3" id="3_34g3y"]
[ext_resource type="AudioStream" uid="uid://5lysviffy1di" path="res://assets/musics/Stade forestier.mp3" id="4_bw5e5"]
[node name="Music" type="Node"]
script = ExtResource("1_bsdw2")
[node name="Stade Désertique" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_b6qy2")
volume_db = -15.0
[node name="Stade Intermédiaire" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_34g3y")
volume_db = -15.0
[node name="Stade Forestier" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_bw5e5")
volume_db = -15.0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=52 format=3 uid="uid://bp3c63qgkmi6o"]
[gd_scene load_steps=54 format=3 uid="uid://bp3c63qgkmi6o"]
[ext_resource type="Script" path="res://scripts/robot.gd" id="1_4eix8"]
[ext_resource type="PackedScene" uid="uid://dyuqq8v1tckrv" path="res://objects/Wanderer.tscn" id="2_mhqh4"]
@ -50,6 +50,8 @@
[ext_resource type="Texture2D" uid="uid://btfc2tuopxu6s" path="res://assets/sprites/robot/walk/frame_46.png" id="47_wvwh5"]
[ext_resource type="Texture2D" uid="uid://bhqv1eipx5hv1" path="res://assets/sprites/robot/walk/frame_47.png" id="48_772t7"]
[ext_resource type="Texture2D" uid="uid://do57i0kkqu2pc" path="res://assets/sprites/robot/walk/frame_48.png" id="49_5u1cp"]
[ext_resource type="AudioStream" uid="uid://cb4ouq4awiyri" path="res://assets/sounds/Actions/Planter.mp3" id="51_f30v0"]
[ext_resource type="AudioStream" uid="uid://c1jt77fyb2lx4" path="res://assets/sounds/Actions/Déplacement.mp3" id="52_xvi3g"]
[sub_resource type="SpriteFrames" id="SpriteFrames_jlahh"]
animations = [{
@ -219,4 +221,11 @@ one_shot = true
[node name="Wanderer" parent="." node_paths=PackedStringArray("node_to_move") instance=ExtResource("2_mhqh4")]
node_to_move = NodePath("..")
[node name="PlantSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("51_f30v0")
[node name="MoveSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("52_xvi3g")
pitch_scale = 1.5
[connection signal="timeout" from="Planting" to="." method="_on_planting_timeout"]

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://0so4tpnkk8t2"]
[gd_scene load_steps=7 format=3 uid="uid://0so4tpnkk8t2"]
[ext_resource type="Script" path="res://scripts/gui/scanner_modes.gd" id="1_synac"]
[ext_resource type="Theme" uid="uid://dnebunkx13tbr" path="res://assets/gui/Text.tres" id="2_3kvh5"]
[ext_resource type="Texture2D" uid="uid://dpfe11wn04ntd" path="res://assets/gui/icons/watering-soil.svg" id="3_7lrcm"]
[ext_resource type="Texture2D" uid="uid://dgo81cisfryi1" path="res://assets/gui/icons/soil-alt.svg" id="4_ld01f"]
[ext_resource type="Texture2D" uid="uid://bdg3ep75da6xd" path="res://assets/gui/icons/tree.svg" id="5_fjsbw"]
[ext_resource type="AudioStream" uid="uid://chj1wssgktreb" path="res://assets/sounds/Actions/Clic bouton.mp3" id="6_37qut"]
[node name="ScannerModes" type="Control"]
layout_mode = 3
@ -36,4 +37,7 @@ popup/item_3/text = "Population"
popup/item_3/icon = ExtResource("5_fjsbw")
popup/item_3/id = 3
[node name="ClickSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6_37qut")
[connection signal="item_selected" from="Scanner Select" to="." method="_on_scanner_select_item_selected"]

View File

@ -18,6 +18,7 @@ config/icon="res://icon.svg"
[autoload]
GameTerrain="*res://scenes/Terrain.tscn"
Music="*res://objects/Music.tscn"
[editor]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://d3hul8b7hlmj7"]
[gd_scene load_steps=16 format=3 uid="uid://d3hul8b7hlmj7"]
[ext_resource type="Script" path="res://scripts/map.gd" id="1_3np0o"]
[ext_resource type="PackedScene" uid="uid://6ferubyu2uy1" path="res://scenes/Scanners.tscn" id="1_6mlj0"]
@ -8,6 +8,8 @@
[ext_resource type="Shader" path="res://scripts/shaders/TextureSplit.gdshader" id="5_iqvbx"]
[ext_resource type="Texture2D" uid="uid://6h5ieh6ba7re" path="res://assets/texture/sol_gamejam_mort.png" id="6_wj5l3"]
[ext_resource type="Texture2D" uid="uid://c85s1vwryvngb" path="res://assets/texture/sol_gamejam_normal.png" id="7_iuq0o"]
[ext_resource type="Texture2D" uid="uid://de81tdearo84u" path="res://assets/texture/sol_gamejam_fleurs_transp.png" id="8_6vuay"]
[ext_resource type="Texture2D" uid="uid://c48gqsunv5wv3" path="res://assets/texture/sol_gamejam_pollution_transparent.png" id="9_wuhlx"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h3thu"]
shader = ExtResource("5_iqvbx")
@ -33,12 +35,14 @@ gradient = SubResource("Gradient_u5wcm")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4rqj7"]
shader = ExtResource("5_iqvbx")
shader_parameter/data_texture_size = Vector2(1000, 1000)
shader_parameter/texture_low_threshold = 0.3
shader_parameter/texture_low_threshold = 0.01
shader_parameter/texture_high_threshold = 0.711
shader_parameter/dimension = 1
shader_parameter/texture_size = Vector2(100, 100)
shader_parameter/texture_size = Vector2(384, 216)
shader_parameter/smooth_change_range = 0.0
shader_parameter/texture_low = ExtResource("9_wuhlx")
shader_parameter/texture_medium = SubResource("GradientTexture1D_hwe6p")
shader_parameter/texture_high = ExtResource("8_6vuay")
[node name="Map" type="Node2D"]
script = ExtResource("1_3np0o")
@ -59,7 +63,6 @@ texture = SubResource("CompressedTexture2D_rhtup")
texture_scale = Vector2(5, 5)
[node name="Fertility" type="Polygon2D" parent="."]
visible = false
z_index = -1
texture_repeat = 2
material = SubResource("ShaderMaterial_4rqj7")

View File

@ -5,6 +5,8 @@ signal scanner_selected
func _on_scanner_select_item_selected(index):
var scannerType : Scanners.Type
$ClickSound.play()
match index:
0: scannerType = Scanners.Type.NoScanner
1: scannerType = Scanners.Type.Water

19
scripts/music.gd Normal file
View File

@ -0,0 +1,19 @@
extends Node
@onready var musics = [
$"Stade Désertique",
$"Stade Intermédiaire",
$"Stade Forestier"
]
var cursor = 1
func _ready():
for player in musics:
player.connect("finished", end_music)
musics[0].play()
func end_music():
musics[min(len(musics) - 1, cursor)].play()
cursor += 1

View File

@ -42,10 +42,12 @@ func _process(delta: float) -> void:
$AnimatedSprite2D.flip_h = true
func go_to(new_target_pos: Vector2):
$MoveSound.play()
state = MoveState.MOVING
target_pos = new_target_pos
func _on_planting_timeout() -> void:
$PlantSound.play()
Planted.emit()
state = MoveState.IDLE

View File

@ -27,31 +27,31 @@ void fragment() {
float value = pixel_color.x;
if (dimension == 1) value = pixel_color.y;
if (dimension == 2) value = pixel_color.z;
vec4 color = texture(texture_medium, vert/texture_size);
if (value < texture_low_threshold)
color =
color =
min(
(texture_low_threshold - value) / smooth_change_range,
(texture_low_threshold - value) / smooth_change_range,
1.0
) * texture(texture_low, vert/texture_size)
) * texture(texture_low, vert/texture_size)
+ (1.0 - min(
(texture_low_threshold - value) / smooth_change_range,
(texture_low_threshold - value) / smooth_change_range,
1.0
)
) * texture(texture_medium, vert/texture_size);
if (value > texture_high_threshold)
color =
color =
min(
(value - texture_high_threshold) / smooth_change_range,
(value - texture_high_threshold) / smooth_change_range,
1.0
) * texture(texture_high, vert/texture_size)
) * texture(texture_high, vert/texture_size)
+ (1.0 - min(
(value - texture_high_threshold) / smooth_change_range,
(value - texture_high_threshold) / smooth_change_range,
1.0
)
) * texture(texture_medium, vert/texture_size);
COLOR = color;
}