Skip to content

Commit

Permalink
musics
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCarriere committed Jan 24, 2024
1 parent 4ffcd1e commit 053720c
Show file tree
Hide file tree
Showing 26 changed files with 181 additions and 20 deletions.
Binary file added assets/audio/musics/Le destin d'alquimé.mp3
Binary file not shown.
19 changes: 19 additions & 0 deletions assets/audio/musics/Le destin d'alquimé.mp3.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="mp3"
type="AudioStreamMP3"
uid="uid://bree5k18plmk1"
path="res://.godot/imported/Le destin d'alquimé.mp3-2ce4a85ed7ebbc995f0a9e2ff0059fd4.mp3str"

[deps]

source_file="res://assets/audio/musics/Le destin d'alquimé.mp3"
dest_files=["res://.godot/imported/Le destin d'alquimé.mp3-2ce4a85ed7ebbc995f0a9e2ff0059fd4.mp3str"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file added assets/audio/musics/festin.wav
Binary file not shown.
24 changes: 24 additions & 0 deletions assets/audio/musics/festin.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://dhvxr1i7r6r0q"
path="res://.godot/imported/festin.wav-b4eca8b18b49219f1c25e5f3dc9f140f.sample"

[deps]

source_file="res://assets/audio/musics/festin.wav"
dest_files=["res://.godot/imported/festin.wav-b4eca8b18b49219f1c25e5f3dc9f140f.sample"]

[params]

force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
File renamed without changes.
19 changes: 19 additions & 0 deletions assets/audio/sounds/hurt/hurt1.mp3.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="mp3"
type="AudioStreamMP3"
uid="uid://bqvcoegu5ackk"
path="res://.godot/imported/hurt1.mp3-79882eceac88ed6b48db63ac18b7a5f0.mp3str"

[deps]

source_file="res://assets/audio/sounds/hurt/hurt1.mp3"
dest_files=["res://.godot/imported/hurt1.mp3-79882eceac88ed6b48db63ac18b7a5f0.mp3str"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file modified assets/audio/sounds/hurt/hurt3.mp3
Binary file not shown.
Binary file not shown.
Binary file added assets/audio/sounds/hurt/hurt4.mp3
Binary file not shown.
19 changes: 19 additions & 0 deletions assets/audio/sounds/hurt/hurt4.mp3.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="mp3"
type="AudioStreamMP3"
uid="uid://u1weobbf1ls4"
path="res://.godot/imported/hurt4.mp3-c0fd15c22383c36ff4e2a71941e9d703.mp3str"

[deps]

source_file="res://assets/audio/sounds/hurt/hurt4.mp3"
dest_files=["res://.godot/imported/hurt4.mp3-c0fd15c22383c36ff4e2a71941e9d703.mp3str"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file modified assets/audio/sounds/sword/sword_hit1.mp3
Binary file not shown.
Binary file modified assets/audio/sounds/sword/sword_hit2.mp3
Binary file not shown.
Binary file modified assets/audio/sounds/sword/sword_void1.mp3
Binary file not shown.
Binary file modified assets/audio/sounds/sword/sword_void2.mp3
Binary file not shown.
3 changes: 1 addition & 2 deletions entities/enemies/bigMouth/fireball/fireball.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ script = ExtResource("1_q7og3")

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
position = Vector2(9, -7)
rotation = -3.15206
position = Vector2(-13, -4)
sprite_frames = SubResource("SpriteFrames_gonb2")
frame_progress = 0.153785

Expand Down
5 changes: 5 additions & 0 deletions entities/musics/musics.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[gd_scene format=3 uid="uid://wueb16edpruq"]

[node name="Musics" type="Node2D"]

[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
4 changes: 0 additions & 4 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,3 @@ test_key_1={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194439,"key_label":0,"unicode":49,"echo":false,"script":null)
]
}

[rendering]

renderer/rendering_method="mobile"
2 changes: 1 addition & 1 deletion scenes/game/ile0.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=14 format=3 uid="uid://c6rc7jq8jqwvq"]

[ext_resource type="TileSet" uid="uid://wjsng8xcnmrd" path="res://assets/tilesets/ile0.tres" id="1_60w02"]
[ext_resource type="PackedScene" path="res://entities/level_transition_portal.tscn" id="4_2vnhw"]
[ext_resource type="PackedScene" uid="uid://cjnc40l5nv2wy" path="res://entities/level_transition_portal.tscn" id="4_2vnhw"]
[ext_resource type="Texture2D" uid="uid://n8wnk6d7sju7" path="res://assets/sprites/terrain/sky1.png" id="6_isy8g"]
[ext_resource type="Texture2D" uid="uid://bscovfaox3mpe" path="res://assets/sprites/terrain/chest.png" id="7_jd70f"]
[ext_resource type="PackedScene" uid="uid://c3cias6fmcxll" path="res://entities/enemies/orc/orc.tscn" id="7_swq6x"]
Expand Down
2 changes: 1 addition & 1 deletion scenes/game/ile3.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://cjgww3etryfy0"]
[gd_scene load_steps=16 format=3 uid="uid://bskyw5gimgjl3"]

[ext_resource type="TileSet" uid="uid://wjsng8xcnmrd" path="res://assets/tilesets/ile0.tres" id="1_haoqn"]
[ext_resource type="PackedScene" uid="uid://cpodpha35gsv0" path="res://entities/player/player.tscn" id="2_2jjfi"]
Expand Down
4 changes: 3 additions & 1 deletion scenes/menu/mainmenu.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://jidvf6c1tkgs"]
[gd_scene load_steps=10 format=3 uid="uid://jidvf6c1tkgs"]

[ext_resource type="Script" path="res://scripts/ui/playbutton.gd" id="1_cyuk1"]
[ext_resource type="Script" path="res://scripts/MainMenu.gd" id="1_p61cy"]
[ext_resource type="Texture2D" uid="uid://cj6jxbeje3l45" path="res://assets/logo/main_title.png" id="2_sw6wy"]
[ext_resource type="Texture2D" uid="uid://b7og73vbn8ogq" path="res://assets/logo/fond_gris.png" id="3_rpnaq"]
[ext_resource type="Script" path="res://scripts/ui/LoadGameButton.gd" id="4_ium14"]
Expand All @@ -16,6 +17,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_p61cy")

[node name="RichTextLabel" type="RichTextLabel" parent="."]
layout_mode = 0
Expand Down
59 changes: 48 additions & 11 deletions scripts/AudioManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@ extends Node

var num_players = 8
var bus = "master"
var p1 = null
var p2 = null

var available = [] # The available players.
var queue = [] # The queue of sounds to play.

var music1Path = "res://assets/audio/musics/festin.wav"
var music2Path = "res://assets/audio/musics/Le destin d'alquimé.mp3"

var musics = [
music1Path,
music2Path
]

var soundPath = "res://assets/audio/sounds/"
var dieSound = "die/die.mp3"
var hurtSounds = [
"hurt/hurt1.mp3",
"hurt/hurt2.mp3",
"hurt/hurt3.mp3"
"hurt/hurt3.mp3",
"hurt/hurt4.mp3"
]
var pickSounds = [
"pick/pick1.mp3",
Expand All @@ -19,10 +31,10 @@ var pickSounds = [
"pick/pick4.mp3"
]
var swordSounds = [
"sword_hit1.mp3",
"sword_hit2.mp3",
"sword_void1.mp3",
"sword_void2.mp3"
"sword/sword_hit1.mp3",
"sword/sword_hit2.mp3",
"sword/sword_void1.mp3",
"sword/sword_void2.mp3"
]

func _ready():
Expand All @@ -38,24 +50,49 @@ func _on_stream_finished(stream):
# When finished playing a stream, make the player available again.
available.append(stream)

func play(sound_path):
queue.append(sound_path)
func play(sound_path,once):
if(once):
p1 = AudioStreamPlayer.new()
add_child(p1)
p1.bus = bus
p1.stream = load(sound_path)
p1.play()

else:
queue.append(sound_path)



func playDieSound():
play(soundPath + dieSound)
play(soundPath + dieSound,true)

func playHurtSound():
play(soundPath + hurtSounds[randi() % hurtSounds.size()])
play(soundPath + hurtSounds[randi() % hurtSounds.size()],true)

func playPickSound():
play(soundPath + pickSounds[randi() % pickSounds.size()])
play(soundPath + pickSounds[randi() % pickSounds.size()],true)

func playSwordSound():
play(soundPath + swordSounds[randi() % swordSounds.size()])

play(soundPath + swordSounds[randi() % swordSounds.size()],true)

func playMusic1():
play(music1Path,false)

func pauseMusic():
p2.stop()


func playMusic2():
play(music2Path,false)

func randMusic():
play(musics[randi() % musics.size()],false)

func _process(delta):
# Play a queued sound if any players are available.
if not queue.is_empty() and not available.is_empty():
available[0].stream = load(queue.pop_front())
available[0].play()
p2 = available[0]
available.pop_front()
12 changes: 12 additions & 0 deletions scripts/MainMenu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends Control


# Called when the node enters the scene tree for the first time.
func _ready():
AudioManager.playMusic1()


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

4 changes: 4 additions & 0 deletions scripts/coupe_doree.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ func _on_area_2d_coupe(body):
#SceneManager.load_scene("game/ile1.tscn")
PlayerInfo.currentAltitude += randi_range(50, 250)
SceneManager.change_scene()

if randi_range(0,2) == 1:
AudioManager.pauseMusic()
AudioManager.randMusic()
8 changes: 8 additions & 0 deletions scripts/entities/GraveUnlock2.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends CharacterBody2D

@onready var collider = $Area2D
var isEntered = false
var is_playing = false

func _ready():
if (!PlayerInfo.hasUnlockedStone2):
Expand All @@ -15,6 +16,13 @@ func _physics_process(delta):
PlayerInfo.unlockStone2()
PlayerInfo.maxHealthPoints += 2
hide()
if !is_playing:
AudioManager.playPickSound()
is_playing = true

await get_tree().create_timer(1.5).timeout
is_playing = false


func on_grave_entered(body: Node):
isEntered = true
Expand Down
16 changes: 16 additions & 0 deletions scripts/player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var enemyU = null
var enemyL = null
var enemyR = null
var enemyD = null
var is_playing = false


func show_message(text):
DialogueBox.display_text(text)
Expand Down Expand Up @@ -59,6 +61,9 @@ func interacted() -> bool:
func animationInteractionUpdate(anim_name: String = "") -> void:
if Input.is_anything_pressed():
if swung_sword():
if !playerState.contains("swung_sword"):
AudioManager.playSwordSound()

playerState = "swung_sword"
match (directionOfPlayer):
"up":
Expand Down Expand Up @@ -111,6 +116,7 @@ func _ready():
DialogueBox.closeBox()
update_health_bar()


func _physics_process(delta):
#test
"""
Expand Down Expand Up @@ -175,6 +181,7 @@ func take_dmg(damage: int = 1) -> void:
playerState = "aMal";
if playerState == "aMal":
animation_player.play("hit")
AudioManager.playHurtSound()
PlayerInfo.healthPoints -= damage
if PlayerInfo.healthPoints <= 0:
die()
Expand All @@ -191,7 +198,16 @@ func die() -> void:
if playerState == "dead" :
animation_player.play("mort")
show_message("GAME OVER !!!")
if !is_playing:
AudioManager.playDieSound()
is_playing = true


await get_tree().create_timer(1.5).timeout
is_playing = false
AudioManager.pauseMusic()
AudioManager.playMusic1()

PlayerInfo.healthPoints = PlayerInfo.maxHealthPoints
PlayerInfo.currentAltitude = 0
SceneManager.load_scene("game/Hub.tscn")
Expand Down
1 change: 1 addition & 0 deletions scripts/ui/playbutton.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ func _on_pressed():
# print_debug("Clic!")
SceneManager.load_scene("game/Hub.tscn")
# get_tree().change_scene_to_file("res://scenes/game/Level1.tscn")

0 comments on commit 053720c

Please sign in to comment.