Merge branch 'main' into InitTambour
This commit is contained in:
commit
c3d84f1e17
24 changed files with 1459 additions and 1 deletions
|
@ -1,12 +1,14 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://durhes43gex7a"]
|
||||
[gd_scene load_steps=14 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"]
|
||||
[ext_resource type="AudioStream" uid="uid://qyacm71epyhi" path="res://ressources/sons/idle_theme.wav" id="2_8nbnd"]
|
||||
[ext_resource type="Texture2D" uid="uid://ky4e7158gqf6" path="res://ressources/images/cgj_default_tile.svg" id="2_torsx"]
|
||||
[ext_resource type="PackedScene" uid="uid://cyvqa6g64cw37" path="res://scenes/enemies/slime.tscn" id="3_04ip2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bge3nllk1bq5r" path="res://ressources/images/mur.svg" id="3_oi2tl"]
|
||||
[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"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_1c4te"]
|
||||
normal = Vector2(0, 1)
|
||||
|
@ -26,6 +28,12 @@ distance = -596.0
|
|||
[node name="Room" type="Node2D"]
|
||||
script = ExtResource("1_jh83c")
|
||||
|
||||
[node name="Musique" type="AudioStreamPlayer" parent="."]
|
||||
process_mode = 3
|
||||
stream = ExtResource("2_8nbnd")
|
||||
autoplay = true
|
||||
bus = &"Music"
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
offset_left = -638.0
|
||||
offset_top = -360.0
|
||||
|
@ -133,3 +141,11 @@ offset_left = -640.0
|
|||
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
|
||||
|
||||
[connection signal="finished" from="Musique" to="." method="_on_audio_stream_player_finished"]
|
||||
|
|
91
scenes/interface.gd
Normal file
91
scenes/interface.gd
Normal file
|
@ -0,0 +1,91 @@
|
|||
extends Control
|
||||
|
||||
@onready var coeur1 = $VBoxContainer/HBoxContainer/TextureRect1
|
||||
@onready var coeur2 = $VBoxContainer/HBoxContainer/TextureRect2
|
||||
@onready var coeur3 = $VBoxContainer/HBoxContainer/TextureRect3
|
||||
@onready var coeur4 = $VBoxContainer/HBoxContainer/TextureRect4
|
||||
@onready var coeur5 = $VBoxContainer/HBoxContainer/TextureRect5
|
||||
#Les coeurs, 1 étant le plus à gauche et 5 le plus à droite
|
||||
|
||||
@onready var slot1 = $VBoxContainer/HBoxContainer2/TextureRect
|
||||
@onready var slot2 = $VBoxContainer/HBoxContainer2/TextureRect2
|
||||
|
||||
@onready var life : int = 10
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func set_life(pv : int) -> void :
|
||||
for i in range(life, pv):
|
||||
update_life(i)
|
||||
update_life(pv)
|
||||
|
||||
func update_life (pv : int) -> void :
|
||||
match pv :
|
||||
0 :
|
||||
coeur1.hide()
|
||||
#Rajouter ici la gestion de la mort
|
||||
1 :
|
||||
coeur1.texture = load("res://ressources/images/half_heart.svg")
|
||||
2 :
|
||||
coeur1.texture = load("res://ressources/images/full_heart.svg")
|
||||
coeur2.hide()
|
||||
3 :
|
||||
coeur2.texture = load("res://ressources/images/half_heart.svg")
|
||||
coeur2.show()
|
||||
4 :
|
||||
coeur2.texture = load("res://ressources/images/full_heart.svg")
|
||||
coeur3.hide()
|
||||
5 :
|
||||
coeur3.texture = load("res://ressources/images/half_heart.svg")
|
||||
coeur3.show()
|
||||
6 :
|
||||
coeur3.texture = load("res://ressources/images/full_heart.svg")
|
||||
coeur4.hide()
|
||||
7 :
|
||||
coeur4.texture = load("res://ressources/images/half_heart.svg")
|
||||
coeur4.show()
|
||||
8 :
|
||||
coeur4.texture = load("res://ressources/images/full_heart.svg")
|
||||
coeur5.hide()
|
||||
9 :
|
||||
coeur5.texture = load("res://ressources/images/half_heart.svg")
|
||||
coeur5.show()
|
||||
10 :
|
||||
coeur5.texture = load("res://ressources/images/full_heart.svg")
|
||||
_ :
|
||||
return
|
||||
|
||||
life = pv
|
||||
|
||||
|
||||
func update_instrument (listeInstrument : Array) -> void :
|
||||
if len(listeInstrument) < 2 :
|
||||
slot1.texture = load("res://ressources/images/empty_slot.svg")
|
||||
slot2.texture = load("res://ressources/images/empty_slot.svg")
|
||||
|
||||
match listeInstrument[0] :
|
||||
"flute" :
|
||||
slot1.texture = load("res://ressources/images/flute.svg")
|
||||
"tambour" :
|
||||
slot1.texture = load("res://ressources/images/tambour.svg")
|
||||
"lyre" :
|
||||
slot1.texture = load("res://ressources/images/lyre.svg")
|
||||
_ :
|
||||
slot1.texture = load("res://ressources/images/empty_slot.svg")
|
||||
|
||||
match listeInstrument[1] :
|
||||
"flute" :
|
||||
slot2.texture = load("res://ressources/images/flute.svg")
|
||||
"tambour" :
|
||||
slot2.texture = load("res://ressources/images/tambour.svg")
|
||||
"lyre" :
|
||||
slot2.texture = load("res://ressources/images/lyre.svg")
|
||||
_ :
|
||||
slot2.texture = load("res://ressources/images/empty_slot.svg")
|
99
scenes/interface.tscn
Normal file
99
scenes/interface.tscn
Normal file
|
@ -0,0 +1,99 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cnd2a1x1smulq"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/interface.gd" id="1_5p24o"]
|
||||
[ext_resource type="Texture2D" uid="uid://jyrl33rv1fnp" path="res://ressources/images/full_heart.svg" id="2_opn3r"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy7cv4qcmyyol" path="res://ressources/images/empty_slot.svg" id="3_8aruj"]
|
||||
|
||||
[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
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_5p24o")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
custom_minimum_size = Vector2(0, 12)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect1" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_opn3r")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_opn3r")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_opn3r")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="TextureRect4" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_opn3r")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="TextureRect5" type="TextureRect" parent="VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_opn3r")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer2"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
custom_minimum_size = Vector2(32, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_8aruj")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_8aruj")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
custom_minimum_size = Vector2(0, 12)
|
||||
layout_mode = 2
|
|
@ -1,6 +1,8 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var menu_parametres = $Menu_parametres
|
||||
@onready var interface = $Interface
|
||||
@onready var musique = $Musique
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
@ -22,3 +24,16 @@ func on_exit_parametres() -> void :
|
|||
get_tree().paused = false
|
||||
menu_parametres.visible = false
|
||||
menu_parametres.set_process(false)
|
||||
|
||||
|
||||
func _on_audio_stream_player_finished() -> void:
|
||||
musique.play()
|
||||
|
||||
func set_musique(nom : String) -> void :
|
||||
match nom :
|
||||
"idle" :
|
||||
musique.stream = load("res://ressources/sons/idle_theme.wav")
|
||||
"fight" :
|
||||
musique.stream = load("res://ressources/sons/fight_theme.wav")
|
||||
_ :
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue