Fix colors
This commit is contained in:
parent
790385b67a
commit
ee2ff1112e
11 changed files with 88 additions and 108 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
22
scenes/attaques/Balle.tscn
Normal file
22
scenes/attaques/Balle.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[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"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1x7bj"]
|
||||
size = Vector2(8, 16)
|
||||
|
||||
[node name="Balle" type="Area2D" node_paths=PackedStringArray("raycast")]
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
script = ExtResource("1_4kd3w")
|
||||
raycast = NodePath("")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = 3.14159
|
||||
texture = ExtResource("1_qx664")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_1x7bj")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="Collision"]
|
|
@ -1,16 +0,0 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://btpp8l4efhrmj"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Instrument/balle.gd" id="1_mw8yb"]
|
||||
[ext_resource type="Texture2D" uid="uid://csbrejwjfkspr" path="res://ressources/images/note1.png" id="2_xpv2h"]
|
||||
|
||||
[node name="Balle1" type="CharacterBody2D" node_paths=PackedStringArray("raycast")]
|
||||
script = ExtResource("1_mw8yb")
|
||||
raycast = NodePath("RayCast2D")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = 3.14159
|
||||
texture = ExtResource("2_xpv2h")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
target_position = Vector2(0, 15)
|
|
@ -1,16 +0,0 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://crpjmum8m2m1b"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Instrument/balle.gd" id="1_gf62f"]
|
||||
[ext_resource type="Texture2D" uid="uid://1xayae6jyuge" path="res://ressources/images/note2.png" id="2_5005k"]
|
||||
|
||||
[node name="Balle1" type="CharacterBody2D" node_paths=PackedStringArray("raycast")]
|
||||
script = ExtResource("1_gf62f")
|
||||
raycast = NodePath("RayCast2D")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = 3.14159
|
||||
texture = ExtResource("2_5005k")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
target_position = Vector2(0, 15)
|
|
@ -1,16 +0,0 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://j4j8mg7jhuwy"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Instrument/balle.gd" id="1_7dxcl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cq5j2fb07d7f8" path="res://ressources/images/notes3.svg" id="2_gx4yt"]
|
||||
|
||||
[node name="Balle1" type="CharacterBody2D" node_paths=PackedStringArray("raycast")]
|
||||
script = ExtResource("1_7dxcl")
|
||||
raycast = NodePath("RayCast2D")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = 3.14159
|
||||
texture = ExtResource("2_gx4yt")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
target_position = Vector2(0, 15)
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
class_name Flute
|
||||
|
||||
var scene_node = null
|
||||
var balle_scenes = [
|
||||
preload("res://scenes/attaques/Balle1.tscn"),
|
||||
preload("res://scenes/attaques/Balle2.tscn"),
|
||||
preload("res://scenes/attaques/Balle3.tscn")
|
||||
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")
|
||||
]
|
||||
var current_balle_index = 0
|
||||
|
||||
@export var cooldown = 0.15 # Durée du cooldown en secondes
|
||||
@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:
|
||||
|
@ -36,23 +38,15 @@ func spawn_balle(player_position: Vector2, direction_balle: Vector2, angle: floa
|
|||
if scene_node == null:
|
||||
print("Erreur : Aucun nœud parent défini pour ajouter la balle.")
|
||||
return
|
||||
|
||||
var current_balle_scene = balle_scenes[current_balle_index]
|
||||
var balle = current_balle_scene.instantiate()
|
||||
|
||||
if balle:
|
||||
balle.position = player_position
|
||||
balle.initial_direction = direction_balle
|
||||
balle.rotation = deg_to_rad(angle)
|
||||
scene_node.add_child(balle)
|
||||
|
||||
# Basculer vers la prochaine balle pour le prochain tir
|
||||
current_balle_index = (current_balle_index + 1) % len(balle_scenes)
|
||||
|
||||
# Démarrez le cooldown après ce tir
|
||||
start_cooldown()
|
||||
else:
|
||||
print("Erreur : la création de la balle a échoué.")
|
||||
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()
|
||||
|
||||
|
||||
# Démarrer le timer pour le cooldown
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -13,6 +13,7 @@ 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()
|
||||
|
@ -47,22 +48,22 @@ func _process(delta: float) -> void:
|
|||
if Input.is_action_just_pressed("CHANGER_SLOT"):
|
||||
active_slot = (active_slot + 1) % 2
|
||||
|
||||
if Input.is_action_pressed("JOUER_MUSIQUE_HAUT") or Input.is_action_pressed("JOUER_MUSIQUE_BAS") or Input.is_action_pressed("JOUER_MUSIQUE_DROITE") or Input.is_action_pressed("JOUER_MUSIQUE_GAUCHE"):
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue