La gestion de la mort est en place, je peut mourir en paix

This commit is contained in:
E213872U 2025-01-25 02:18:26 +01:00
parent 303f40c3cc
commit 5766858c9b
8 changed files with 6008 additions and 7 deletions

View file

@ -8,6 +8,7 @@ var first_room = preload("res://scenes/Room.tscn").instantiate()
func _ready():
menu_parametres.exit_parametres.connect(on_exit_parametres)
first_room.daddy.connect(on_daddy)
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -45,3 +46,9 @@ func _on_play_button_pressed():
func _on_musique_fond_finished() -> void:
musique_fond.play()
func on_daddy () -> void :
musique_fond.playing = true
menu_principal.visible = true
first_room = preload("res://scenes/Room.tscn").instantiate()
first_room.daddy.connect(on_daddy)

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 348 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://j8hopa3c7fr3"
path="res://.godot/imported/icone_mort.svg-9c4d18d674b077967d7e3abe6c469e2a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/icone_mort.svg"
dest_files=["res://.godot/imported/icone_mort.svg-9c4d18d674b077967d7e3abe6c469e2a.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://durhes43gex7a"]
[gd_scene load_steps=15 format=3 uid="uid://durhes43gex7a"]
[ext_resource type="PackedScene" uid="uid://c7bfiw54rvaq2" path="res://scenes/player_melodie.tscn" id="1_cl1wt"]
[ext_resource type="Script" path="res://scenes/room.gd" id="1_jh83c"]
@ -9,6 +9,7 @@
[ext_resource type="Texture2D" uid="uid://dhva3tivsvknl" path="res://ressources/images/mur_coin.svg" id="4_6a3f6"]
[ext_resource type="PackedScene" uid="uid://di4chlep1t1or" path="res://parametres/menu_parametres.tscn" id="6_6ubhx"]
[ext_resource type="PackedScene" uid="uid://cnd2a1x1smulq" path="res://scenes/interface.tscn" id="8_5s7tf"]
[ext_resource type="PackedScene" uid="uid://ctgxrbcg2vu1p" path="res://scenes/ecran_mort.tscn" id="10_3ou8w"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_1c4te"]
normal = Vector2(0, 1)
@ -134,6 +135,12 @@ texture = ExtResource("4_6a3f6")
[node name="Slime" parent="." groups=["Enemies"] instance=ExtResource("3_04ip2")]
position = Vector2(-448, 205)
[node name="Interface" parent="." instance=ExtResource("8_5s7tf")]
offset_left = -640.0
offset_top = -360.0
offset_right = -640.0
offset_bottom = -360.0
[node name="Menu_parametres" parent="." instance=ExtResource("6_6ubhx")]
process_mode = 3
visible = false
@ -142,10 +149,13 @@ offset_top = -360.0
offset_right = 640.0
offset_bottom = 360.0
[node name="Interface" parent="." instance=ExtResource("8_5s7tf")]
offset_left = -640.0
offset_top = -360.0
offset_right = -640.0
offset_bottom = -360.0
[node name="Ecran mort" parent="." instance=ExtResource("10_3ou8w")]
process_mode = 3
visible = false
offset_left = -258.0
offset_top = -383.0
offset_right = -258.0
offset_bottom = -383.0
[connection signal="finished" from="Musique" to="." method="_on_audio_stream_player_finished"]
[connection signal="retour_menu" from="Ecran mort" to="." method="_on_ecran_mort_retour_menu"]

16
scenes/ecran_mort.gd Normal file
View file

@ -0,0 +1,16 @@
extends Control
signal retour_menu ()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_main_menu_button_pressed() -> void:
retour_menu.emit()

81
scenes/ecran_mort.tscn Normal file
View file

@ -0,0 +1,81 @@
[gd_scene load_steps=6 format=3 uid="uid://ctgxrbcg2vu1p"]
[ext_resource type="Texture2D" uid="uid://j8hopa3c7fr3" path="res://ressources/images/icone_mort.svg" id="1_ekgu8"]
[ext_resource type="Script" path="res://scenes/ecran_mort.gd" id="1_k44wh"]
[ext_resource type="FontFile" uid="uid://dbe1teksyhymq" path="res://ressources/fonts/OpenDyslexic-Regular.otf" id="2_usedy"]
[ext_resource type="Texture2D" uid="uid://dqfrqntx73do5" path="res://ressources/images/menu_jeu_button.svg" id="3_ecfx2"]
[ext_resource type="Texture2D" uid="uid://kpss4kt07w8l" path="res://ressources/images/menu_jeu_button_survole.svg" id="4_jv24w"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_k44wh")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="VSeparator" type="VSeparator" parent="HBoxContainer"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(500, 500)
layout_mode = 2
texture = ExtResource("1_ekgu8")
expand_mode = 1
[node name="Mort" type="Label" parent="HBoxContainer/VBoxContainer/TextureRect"]
modulate = Color(0.917647, 0.941176, 0.847059, 1)
self_modulate = Color(0.917647, 0.941176, 0.847059, 1)
offset_left = 89.0
offset_top = 187.0
offset_right = 414.0
offset_bottom = 315.0
theme_override_fonts/font = ExtResource("2_usedy")
theme_override_font_sizes/font_size = 32
text = "Vous êtes
mort"
horizontal_alignment = 1
vertical_alignment = 1
language = "fr_FR"
[node name="main_menu_button" type="TextureButton" parent="HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(250, 250)
layout_mode = 2
texture_normal = ExtResource("3_ecfx2")
texture_pressed = ExtResource("4_jv24w")
texture_hover = ExtResource("4_jv24w")
texture_disabled = ExtResource("4_jv24w")
texture_focused = ExtResource("4_jv24w")
stretch_mode = 0
[node name="main_menu_label" type="Label" parent="HBoxContainer/VBoxContainer/main_menu_button"]
modulate = Color(0, 0, 0, 1)
layout_mode = 0
offset_left = 89.0
offset_top = 62.0
offset_right = 414.0
offset_bottom = 190.0
theme_override_fonts/font = ExtResource("2_usedy")
theme_override_font_sizes/font_size = 32
text = "Menu Principal"
horizontal_alignment = 1
vertical_alignment = 1
language = "fr_FR"
[node name="VSeparator2" type="VSeparator" parent="HBoxContainer"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2
size_flags_horizontal = 3
[connection signal="pressed" from="HBoxContainer/VBoxContainer/main_menu_button" to="." method="_on_main_menu_button_pressed"]

View file

@ -12,6 +12,8 @@ extends Control
@onready var life : int = 10
signal mort ()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
@ -30,7 +32,7 @@ func update_life (pv : int) -> void :
match pv :
0 :
coeur1.hide()
#Rajouter ici la gestion de la mort
mort.emit()
1 :
coeur1.texture = load("res://ressources/images/half_heart.svg")
2 :

View file

@ -2,11 +2,16 @@ extends Node2D
@onready var menu_parametres = $Menu_parametres
@onready var interface = $Interface
@onready var mort = $"Ecran mort"
@onready var musique = $Musique
signal daddy ()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
menu_parametres.exit_parametres.connect(on_exit_parametres)
mort.retour_menu.connect(on_ecran_mort_retour_menu)
interface.mort.connect(on_death)
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -37,3 +42,11 @@ func set_musique(nom : String) -> void :
musique.stream = load("res://ressources/sons/fight_theme.wav")
_ :
pass
func on_ecran_mort_retour_menu() -> void:
daddy.emit()
queue_free()
func on_death() -> void :
mort.visible = true