Le #merge

This commit is contained in:
E213872U 2025-01-24 21:22:15 +01:00
commit ef0b911b9c
22 changed files with 388 additions and 61 deletions

View file

@ -166,7 +166,6 @@ layout_mode = 1
[node name="MusiqueFond" type="AudioStreamPlayer" parent="."]
stream = ExtResource("8_sq6yk")
autoplay = true
bus = &"Music"
[connection signal="pressed" from="Menu_principal/HBoxContainer/VBoxMainButton/play_button" to="." method="_on_play_button_pressed"]
[connection signal="pressed" from="Menu_principal/HBoxContainer/VBoxMainButton/quit_button" to="." method="_on_quit_button_pressed"]

View file

@ -25,6 +25,11 @@ window/stretch/mode="canvas_items"
project/assembly_name="code-game-jam-drop-plafond-2025"
[global_group]
World_Border=""
Enemies=""
[input]
BOUGER_HAUT={
@ -52,6 +57,11 @@ PAUSE={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
JOUER_MUSIQUE={
"deadzone": 0.5,
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
JOUER_MUSIQUE_HAUT={
"deadzone": 0.5,
"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":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
@ -72,6 +82,11 @@ JOUER_MUSIQUE_GAUCHE={
"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":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
CHANGER_SLOT={
"deadzone": 0.5,
"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":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2spn60rmdyy5"
path="res://.godot/imported/poulpe-1.png-9fe980980e71224a7a2953bc228f988d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/poulpe-1.png"
dest_files=["res://.godot/imported/poulpe-1.png-9fe980980e71224a7a2953bc228f988d.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: 3.4 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4ukmsspx16f"
path="res://.godot/imported/poulpe-2.png-e0bb613d3a74e50be7b911ae44672c8a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/poulpe-2.png"
dest_files=["res://.godot/imported/poulpe-2.png-e0bb613d3a74e50be7b911ae44672c8a.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: 3.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dinxaox0ug7kx"
path="res://.godot/imported/poulpe-atk.png-083584296229d569f6bbc6969a32bc79.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/poulpe-atk.png"
dest_files=["res://.godot/imported/poulpe-atk.png-083584296229d569f6bbc6969a32bc79.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: 2.5 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bg7xknf5g2rfj"
path="res://.godot/imported/poulpe-bullet.png-b20bc813564a020a5c3d1f084af754d3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/poulpe-bullet.png"
dest_files=["res://.godot/imported/poulpe-bullet.png-b20bc813564a020a5c3d1f084af754d3.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

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://h0y356ur32vi"
path="res://.godot/imported/ronde-tambour.png-ee4e4d2b4e71a4aef719ad8901b83c4c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ressources/images/ronde-tambour.png"
dest_files=["res://.godot/imported/ronde-tambour.png-ee4e4d2b4e71a4aef719ad8901b83c4c.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

View file

@ -32,7 +32,9 @@ stretch_mode = 1
[node name="Player_Melodie" parent="." instance=ExtResource("1_cl1wt")]
scale = Vector2(4, 4)
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="StaticBody2D" type="StaticBody2D" parent="." groups=["World_Border"]]
collision_layer = 3
collision_mask = 3
[node name="World Border Up" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_1c4te")
@ -50,5 +52,5 @@ shape = SubResource("WorldBoundaryShape2D_ia1hi")
[node name="Camera2D" type="Camera2D" parent="CanvasLayer"]
[node name="Slime" parent="." instance=ExtResource("3_04ip2")]
[node name="Slime" parent="." groups=["Enemies"] instance=ExtResource("3_04ip2")]
position = Vector2(-448, 205)

View file

@ -1,16 +1,21 @@
[gd_scene load_steps=3 format=3 uid="uid://btpp8l4efhrmj"]
[gd_scene load_steps=4 format=3 uid="uid://buhlaoq2nalup"]
[ext_resource type="Script" path="res://scripts/Instrument/balle.gd" id="1_4kd3w"]
[ext_resource type="Texture2D" uid="uid://csbrejwjfkspr" path="res://ressources/images/note1.png" id="1_qx664"]
[node name="Balle1" type="CharacterBody2D" node_paths=PackedStringArray("raycast")]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1x7bj"]
size = Vector2(8, 16)
[node name="Balle" type="Area2D"]
collision_layer = 3
collision_mask = 3
script = ExtResource("1_4kd3w")
raycast = NodePath("RayCast2D")
[node name="Sprite2D" type="Sprite2D" parent="."]
rotation = 3.14159
texture = ExtResource("1_qx664")
[node name="RayCast2D" type="RayCast2D" parent="."]
position = Vector2(0, -7)
target_position = Vector2(0, 15)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_1x7bj")
[connection signal="body_entered" from="." to="." method="Collision"]

19
scenes/attaques/Onde.tscn Normal file
View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://y2j5qtyg4vt3"]
[ext_resource type="Script" path="res://scripts/Instrument/onde.gd" id="1_6377h"]
[ext_resource type="Texture2D" uid="uid://bq2gg8sxvwth2" path="res://ressources/images/ronde tambour.png.png" id="1_oawub"]
[sub_resource type="CircleShape2D" id="CircleShape2D_r81ru"]
radius = 125.575
[node name="Onde" type="CharacterBody2D"]
collision_layer = 2
collision_mask = 2
script = ExtResource("1_6377h")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(2.5, 2.5)
texture = ExtResource("1_oawub")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_r81ru")

View file

@ -16,7 +16,6 @@ func _physics_process(delta: float) -> void:
move_and_slide()
for i in get_slide_collision_count():
var collision = get_slide_collision(i)
print("Collided with: ", collision.get_collider().name)
func _process(delta: float) -> void:
var direction : Vector2

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://cyvqa6g64cw37"]
[ext_resource type="Script" path="res://scenes/enemies/slime.gd" id="1_hnufy"]
[ext_resource type="Texture2D" uid="uid://devrwnq1oj3qv" path="res://ressources/images/blob-1.png.png" id="1_n4mgf"]
[ext_resource type="Texture2D" uid="uid://b0cua5ecp7bfw" path="res://ressources/images/blob-2-4.png.png" id="2_w8gqg"]
[ext_resource type="Texture2D" uid="uid://cc1kqgdbwm1dh" path="res://ressources/images/blob-3.png.png" id="3_pwpfc"]
[ext_resource type="Texture2D" uid="uid://ba14nw87lxef4" path="res://ressources/images/blob-1.png.png" id="1_n4mgf"]
[ext_resource type="Texture2D" uid="uid://cpge55gmdllmi" path="res://ressources/images/blob-2-4.png.png" id="2_w8gqg"]
[ext_resource type="Texture2D" uid="uid://bst1iwqgqmcvl" path="res://ressources/images/blob-3.png.png" id="3_pwpfc"]
[sub_resource type="SpriteFrames" id="SpriteFrames_qfla8"]
animations = [{
@ -40,6 +40,8 @@ animations = [{
radius = 20.0
[node name="Slime" type="CharacterBody2D"]
collision_layer = 3
collision_mask = 3
script = ExtResource("1_hnufy")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
@ -51,4 +53,3 @@ frame_progress = 1.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_bokrm")
disabled = true

View file

@ -3,8 +3,9 @@
[ext_resource type="Script" path="res://scripts/player_control.gd" id="1_7sg4g"]
[ext_resource type="Texture2D" uid="uid://uebyv8y862vt" path="res://ressources/images/melodie.svg" id="2_se13h"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwwdc"]
size = Vector2(16, 32)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_wgkyh"]
radius = 6.0
height = 32.0
[node name="Player_Melodie" type="CharacterBody2D"]
script = ExtResource("1_7sg4g")
@ -14,4 +15,4 @@ scale = Vector2(0.75, 0.75)
texture = ExtResource("2_se13h")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_uwwdc")
shape = SubResource("CapsuleShape2D_wgkyh")

View file

@ -1,28 +1,60 @@
class_name Flute
var scene_node = null
var balle_template = preload("res://scenes/attaques/Balle.tscn")
var color_index = 0
var color_list = [
preload("res://ressources/images/note1.png"),
preload("res://ressources/images/note2.png"),
preload("res://ressources/images/note3.png"),
preload("res://ressources/images/note2.png")
]
@export var cooldown = 0.5 # Durée du cooldown en secondes
var is_on_cooldown = false # Indique si le cooldown est en cours
func set_scene_parent(node: Node) -> void:
scene_node = node
# Si scene_node est défini pour la première fois, on ajoute un Timer
if not scene_node.has_node("TirCooldownTimer"):
var cooldown_timer = Timer.new()
cooldown_timer.name = "TirCooldownTimer"
cooldown_timer.one_shot = true
cooldown_timer.wait_time = cooldown
cooldown_timer.connect("timeout", Callable(self, "_on_cooldown_timeout"))
scene_node.add_child(cooldown_timer)
func jouer_melodie(player_position, direction_balle, angle) -> void:
spawn_balle(player_position, direction_balle, angle)
func _process(delta) -> void:
pass # Cette fonction est requise pour que delta fonctionne correctement
func spawn_balle(player_position, direction_balle, angle) -> void:
func jouer_melodie(player_position: Vector2, direction_balle: Vector2, angle: float) -> void:
if not is_on_cooldown: # Vérifiez si nous pouvons tirer
spawn_balle(player_position, direction_balle, angle)
func spawn_balle(player_position: Vector2, direction_balle: Vector2, angle: float) -> void:
if scene_node == null:
print("Erreur : Aucun nœud parent défini pour ajouter la balle.")
return
var balle = preload("res://scenes/attaques/Balle.tscn").instantiate()
if balle:
balle.position = player_position
balle.initial_direction = direction_balle
balle.rotation = deg_to_rad(angle)
scene_node.add_child(balle)
var balle = balle_template.instantiate()
balle.position = player_position
balle.initial_direction = direction_balle
balle.rotation = deg_to_rad(angle)
color_index = (1 +color_index)% len(color_list)
balle.get_node("Sprite2D").texture = color_list[color_index]
scene_node.add_child(balle)
# Démarrez le cooldown après ce tir
start_cooldown()
else:
print("Erreur : la création de la balle a échoué.")
# Démarrer le timer pour le cooldown
func start_cooldown() -> void:
is_on_cooldown = true
var cooldown_timer = scene_node.get_node("TirCooldownTimer")
cooldown_timer.start()
func _on_cooldown_timeout() -> void:
is_on_cooldown = false # Réinitialisez l'état de cooldown après expiration du Timer

View file

@ -1,5 +1,55 @@
class_name Tambour
var scene_node = null
@export var cooldown = 0.9 # Durée du cooldown en secondes
var is_on_cooldown = false # Indique si le cooldown est actif
func faire_roulement() -> void:
print("Le tambour fait un roulement.")
func set_scene_parent(node: Node) -> void:
scene_node = node
# Si scene_node est défini pour la première fois, on ajoute un Timer
if not scene_node.has_node("TambourCooldownTimer2"): # Changement du nom du Timer unique pour le Tambour
var cooldown_timer = Timer.new()
cooldown_timer.name = "TambourCooldownTimer2" # Nom unique pour éviter les conflits
cooldown_timer.one_shot = true
cooldown_timer.wait_time = cooldown
cooldown_timer.connect("timeout", Callable(self, "_on_cooldown_timeout"))
scene_node.add_child(cooldown_timer)
func jouer_melodie(player_position: Vector2) -> void:
if not is_on_cooldown: # Vérifiez si nous sommes en cooldown
spawn_onde(player_position)
func spawn_onde(player_position: Vector2) -> void:
if scene_node == null:
print("Erreur : Aucun nœud parent défini pour ajouter l'onde.")
return
var onde_scene = preload("res://scenes/attaques/Onde.tscn") # Chargez la scène de l'onde
var onde = onde_scene.instantiate()
if onde:
onde.position = player_position
scene_node.add_child(onde)
# Démarrez le cooldown après avoir ajouté l'onde
start_cooldown()
else:
print("Erreur : Impossible de créer l'onde.")
# Démarrer le Timer pour le cooldown
func start_cooldown() -> void:
is_on_cooldown = true
var cooldown_timer = scene_node.get_node("TambourCooldownTimer2") # Assurez-vous que le Timer est bien trouvé
if cooldown_timer:
cooldown_timer.start()
else:
print("Erreur : Timer introuvable.")
func _on_cooldown_timeout() -> void:
is_on_cooldown = false # Réinitialiser le cooldown lorsque le Timer se termine
print("Cooldown terminé.")

View file

@ -1,20 +1,17 @@
extends CharacterBody2D
extends Area2D
@export var speed: float = 400 # Définir la vitesse de la balle
@export var speed: float = 300 # Définir la vitesse de la balle
@export var raycast: RayCast2D
# Direction initiale du mouvement
var initial_direction: Vector2 = Vector2(1, 0) # Exemple par défaut : vers la droite
func _ready() -> void:
# Configurer la vitesse sur l'axe désiré
velocity = initial_direction * speed # Multiplie la direction initiale par la vitesse
func _physics_process(delta: float) -> void:
move_and_collide(velocity * delta)
if raycast.is_colliding():
queue_free()
position += initial_direction * speed * delta
func Collision(body: Node2D) -> void:
if body.is_in_group("World_Border") :
queue_free()
if body.is_in_group("Enemies") :
queue_free()

View file

@ -0,0 +1,20 @@
extends CharacterBody2D
var cooldown_timer = null
func _process(delta: float) -> void:
if cooldown_timer == null:
cooldown_timer = Timer.new()
cooldown_timer.name = "OndeCooldownTimer"
cooldown_timer.one_shot = true
cooldown_timer.connect("timeout", Callable(self, "_on_cooldown_timeout"))
get_tree().root.add_child(cooldown_timer)
# Démarrer le timer pour le cooldown
func start_cooldown() -> void:
cooldown_timer.start()
func _on_cooldown_timeout() -> void:
cooldown_timer.queue_free()
cooldown_timer = null
queue_free()

View file

@ -6,11 +6,21 @@ const max_boost_speed = 800
var previous_direction = Vector2.ZERO
var boost_speed = 0
var flute = null
var tambour = null
# Slot actif (0 = Flûte, 1 = Tambour)
var active_slot = 0
var flute_timer = 0
func _ready() -> void:
flute = load("res://scripts/Instrument/Flute.gd").new()
flute.set_scene_parent(get_tree().get_root())
tambour = load("res://scripts/Instrument/Tambour.gd").new()
tambour.set_scene_parent(get_tree().get_root())
@ -35,21 +45,28 @@ func _process(delta: float) -> void:
previous_direction = direction
velocity = direction * (move_speed + boost_speed)
if Input.is_action_just_pressed("JOUER_MUSIQUE_HAUT") or Input.is_action_just_pressed("JOUER_MUSIQUE_BAS") or Input.is_action_just_pressed("JOUER_MUSIQUE_DROITE") or Input.is_action_just_pressed("JOUER_MUSIQUE_GAUCHE"):
var direction_balle = Vector2.ZERO
var angle = 0
if Input.is_action_just_pressed("JOUER_MUSIQUE_HAUT"):
direction_balle = Vector2(0, -1)
angle = 180
elif Input.is_action_just_pressed("JOUER_MUSIQUE_BAS"):
direction_balle = Vector2(0, 1)
angle = 0
elif Input.is_action_just_pressed("JOUER_MUSIQUE_DROITE"):
direction_balle = Vector2(1, 0)
angle = 270
elif Input.is_action_just_pressed("JOUER_MUSIQUE_GAUCHE"):
direction_balle = Vector2(-1, 0)
angle = 90
if Input.is_action_just_pressed("CHANGER_SLOT"):
active_slot = (active_slot + 1) % 2
var direction_balle = Vector2.ZERO
var angle = 0
if Input.is_action_pressed("JOUER_MUSIQUE_HAUT"):
direction_balle = Vector2(0, -1)
angle = 180
elif Input.is_action_pressed("JOUER_MUSIQUE_BAS"):
direction_balle = Vector2(0, 1)
angle = 0
elif Input.is_action_pressed("JOUER_MUSIQUE_DROITE"):
direction_balle = Vector2(1, 0)
angle = 270
elif Input.is_action_pressed("JOUER_MUSIQUE_GAUCHE"):
direction_balle = Vector2(-1, 0)
angle = 90
if direction_balle != Vector2.ZERO :
if active_slot == 0: # Slot Flûte
flute.jouer_melodie(position, direction_balle, angle)
elif active_slot == 1: # Slot Tambour
tambour.jouer_melodie(position)
flute.jouer_melodie(position, direction_balle, angle)
pass