diff --git a/Assets/Music/SisNeufPiDoozHuit.mp3 b/Assets/Music/SisNeufPiDoozHuit.mp3 new file mode 100644 index 0000000..435972a Binary files /dev/null and b/Assets/Music/SisNeufPiDoozHuit.mp3 differ diff --git a/Assets/Music/SisNeufPiDoozHuit.mp3.import b/Assets/Music/SisNeufPiDoozHuit.mp3.import new file mode 100644 index 0000000..9c3d171 --- /dev/null +++ b/Assets/Music/SisNeufPiDoozHuit.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://c3dy35dv368ft" +path="res://.godot/imported/SisNeufPiDoozHuit.mp3-8841a68f643174784d49b9b1bf79b1bd.mp3str" + +[deps] + +source_file="res://Assets/Music/SisNeufPiDoozHuit.mp3" +dest_files=["res://.godot/imported/SisNeufPiDoozHuit.mp3-8841a68f643174784d49b9b1bf79b1bd.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/Scenes/Levels/level_1.tscn b/Scenes/Levels/level_1.tscn index 9e55d64..075e004 100644 --- a/Scenes/Levels/level_1.tscn +++ b/Scenes/Levels/level_1.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=8 format=3 uid="uid://uoyiei4wyig3"] +[gd_scene load_steps=9 format=3 uid="uid://uoyiei4wyig3"] [ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"] [ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"] -[ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"] -[ext_resource type="PackedScene" uid="uid://by2xmwcng01uy" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"] +[ext_resource type="PackedScene" uid="uid://dgtscjxcqoxls" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"] +[ext_resource type="PackedScene" uid="uid://cf7al5uln33rn" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"] [ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"] [ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"] +[ext_resource type="AudioStream" uid="uid://c3dy35dv368ft" path="res://Assets/Music/SisNeufPiDoozHuit.mp3" id="7_but47"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_1g1r4"] size = Vector2(930, 384) @@ -51,3 +52,17 @@ position = Vector2(481.898, 270.98) [node name="PlayableRect" type="CollisionShape2D" parent="PlayableArea"] position = Vector2(479, 272) shape = SubResource("RectangleShape2D_1g1r4") + +[node name="Music" type="AudioStreamPlayer" parent="."] +stream = ExtResource("7_but47") +volume_db = -6.0 +autoplay = true + +[node name="Time" type="Label" parent="."] +offset_left = 29.0 +offset_top = 18.0 +offset_right = 69.0 +offset_bottom = 41.0 +text = "000" + +[connection signal="finished" from="Music" to="." method="_on_music_finished"] diff --git a/Scenes/ending.tscn b/Scenes/ending.tscn new file mode 100644 index 0000000..5955e50 --- /dev/null +++ b/Scenes/ending.tscn @@ -0,0 +1,81 @@ +[gd_scene load_steps=3 format=3 uid="uid://drfn4qb06jfla"] + +[ext_resource type="Script" path="res://Scripts/ending.gd" id="1_1hyxj"] +[ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="1_38e81"] + +[node name="Ending" 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_1hyxj") + +[node name="Enemy" parent="." instance=ExtResource("1_38e81")] +position = Vector2(719, 305) +scale = Vector2(8, 8) + +[node name="Quit" type="Button" parent="."] +layout_mode = 0 +offset_left = 128.0 +offset_top = 421.0 +offset_right = 205.0 +offset_bottom = 455.0 +text = "Quit" + +[node name="Message" type="Label" parent="."] +layout_mode = 0 +offset_left = 58.0 +offset_top = 38.0 +offset_right = 536.0 +offset_bottom = 82.0 + +[node name="Killcount" type="Label" parent="."] +layout_mode = 0 +offset_left = 61.0 +offset_top = 160.0 +offset_right = 138.0 +offset_bottom = 186.0 +text = "Nombre de victimes: +" + +[node name="Level" type="Label" parent="."] +layout_mode = 0 +offset_left = 62.0 +offset_top = 191.0 +offset_right = 107.0 +offset_bottom = 217.0 +text = "Niveau: +" + +[node name="Exp" type="Label" parent="."] +layout_mode = 0 +offset_left = 62.0 +offset_top = 223.0 +offset_right = 152.0 +offset_bottom = 249.0 +text = "Expérience:" + +[node name="AmtKill" type="Label" parent="."] +layout_mode = 0 +offset_left = 236.0 +offset_top = 161.0 +offset_right = 276.0 +offset_bottom = 184.0 + +[node name="AmtLvl" type="Label" parent="."] +layout_mode = 0 +offset_left = 131.0 +offset_top = 193.0 +offset_right = 171.0 +offset_bottom = 216.0 + +[node name="AmtExp" type="Label" parent="."] +layout_mode = 0 +offset_left = 159.0 +offset_top = 226.0 +offset_right = 199.0 +offset_bottom = 249.0 + +[connection signal="pressed" from="Quit" to="." method="_on_quit_pressed"] diff --git a/Scenes/enemy.tscn b/Scenes/enemy.tscn index c7d9f9c..081b990 100644 --- a/Scenes/enemy.tscn +++ b/Scenes/enemy.tscn @@ -379,7 +379,6 @@ position = Vector2(10, 10) collision_layer = 5 collision_mask = 5 script = ExtResource("1_xj62t") -hp = 5 [node name="Sprite" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_dqf8u") @@ -485,4 +484,5 @@ debug_color = Color(0.956863, 0.203922, 0, 0.419608) [connection signal="animation_looped" from="Sprite" to="." method="_on_sprite_animation_looped"] [connection signal="timeout" from="Atk_cooldown" to="." method="_on_atk_cooldown_timeout"] [connection signal="timeout" from="Death" to="." method="_on_death_timeout"] +[connection signal="finished" from="DeathSnd" to="." method="_on_death_snd_finished"] [connection signal="body_entered" from="AttackArea" to="." method="_on_attack_area_body_entered"] diff --git a/Scripts/Enemy.gd b/Scripts/Enemy.gd index 35887bb..38130b9 100644 --- a/Scripts/Enemy.gd +++ b/Scripts/Enemy.gd @@ -7,7 +7,7 @@ extends CharacterBody2D @onready var is_dying: bool = false @export var level: int = 1 -@export var hp: int = 100 +@export var hp: int = 50 @export var maxhp: int = 100 @export var maxvel: float = 2 @export var experience: int = 0 @@ -32,6 +32,7 @@ extends CharacterBody2D @onready var atkL: Node = atk1l @onready var atkR: Node = atk1r @onready var atk: String = "Attack" +@onready var is_dead: bool = false @onready var list: Array = [] @@ -45,7 +46,7 @@ func remove_foe(foe): # Called when the node enters the scene tree for the first time. func _ready(): - setLevel(2) + #setLevel(2) atk1l.set_disabled(true) atk1r.set_disabled(true) atk2l.set_disabled(true) @@ -54,6 +55,9 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + if is_dead: + pass + if hp <= 0 && !is_dying: $Death.start() $Atk_cooldown.stop() @@ -63,7 +67,7 @@ func _process(delta): $DeathSnd.play() if is_dying: - pass + is_dead = true if abs(velocity.x) < 1 && abs(velocity.y) < 1 && !is_attacking: setAnimState("Idle") elif !is_attacking: @@ -71,7 +75,7 @@ func _process(delta): if state != "Attack" && state != "Attack2": is_facing_left = velocity.x > 0 && !(velocity.x < 0) - + if currentcooldown > 0.: currentcooldown -= delta # AI STUFF @@ -186,7 +190,8 @@ func setLevel(lvl): func _on_atk_cooldown_timeout(): currAtks = maxAtks - attack() + if !list.is_empty(): + attack() func _on_sprite_animation_looped(): @@ -207,9 +212,13 @@ func _on_attack_area_body_entered(body): func _on_death_timeout(): - pass - -func _on_sprite_animation_finished(): $"..".win_screen() queue_free() + +func _on_sprite_animation_finished(): + pass + + +func _on_death_snd_finished(): + $DeathSnd.stop() diff --git a/Scripts/ending.gd b/Scripts/ending.gd new file mode 100644 index 0000000..515d2c2 --- /dev/null +++ b/Scripts/ending.gd @@ -0,0 +1,26 @@ +extends Control + +var killcount: int = 0 +var level: int = 1 +var exp: int = 0 +var message: String = "" +var is_win: bool = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + if is_win: + $Enemy.hide() + $Message.text = message + $AmtKill.text = str(killcount) + $AmtLvl.text = str(level) + $AmtExp.text = str(exp) + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_quit_pressed(): + get_tree().quit() diff --git a/Scripts/level.gd b/Scripts/level.gd index 6a6583e..4b7fc00 100644 --- a/Scripts/level.gd +++ b/Scripts/level.gd @@ -1,14 +1,45 @@ extends Node2D +var length: int = 0 +var time: int = 0 +var countdown: float = 0 # Called when the node enters the scene tree for the first time. func _ready(): + length = $Music.stream.get_length() + $Time.text = str(length) pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + countdown += delta + if countdown > 1: + countdown -= 1 + time = $Music.get_playback_position() + $Time.text = str(length - time - 1) pass func win_screen(): - get_tree().change_scene_to_file("res://Scenes/start_menu.tscn") + var enemy = $Enemy + var end = load("res://Scenes/ending.tscn").instantiate() + end.killcount = enemy.killcount + end.level = enemy.level + end.exp = enemy.experience + end.message = "Fabio le chevalier est mort, bravo." + self.queue_free() + get_tree().root.add_child(end) + +func lose_screen(): + var enemy = $Enemy + var end = load("res://Scenes/ending.tscn").instantiate() + end.killcount = enemy.killcount + end.level = enemy.level + end.exp = enemy.experience + end.is_win = false + end.message = "Fabio le chevalier et futur roi t'a torché... royalement. (HA!)" + self.queue_free() + get_tree().root.add_child(end) + +func _on_music_finished(): + lose_screen()