Merge main + Change slime anim

This commit is contained in:
Renarde-dev 2025-01-24 23:02:29 +01:00
commit 2451f4d82e
No known key found for this signature in database
GPG key ID: 5B8FE0B3816369DE
9 changed files with 138 additions and 84 deletions

View file

@ -1,36 +1,41 @@
[gd_scene load_steps=8 format=3 uid="uid://durhes43gex7a"]
[gd_scene load_steps=12 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="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"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_1c4te"]
normal = Vector2(0, 1)
distance = -360.0
distance = -328.0
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_qq3vn"]
distance = -360.0
distance = -314.0
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_e1nqi"]
normal = Vector2(-1, 0)
distance = -640.0
distance = -592.0
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ia1hi"]
normal = Vector2(1, 0)
distance = -640.0
distance = -596.0
[node name="Room" type="Node2D"]
script = ExtResource("1_jh83c")
[node name="TextureRect" type="TextureRect" parent="."]
offset_left = -640.0
offset_left = -638.0
offset_top = -360.0
offset_right = 640.0
offset_right = 642.0
offset_bottom = 360.0
texture = ExtResource("2_torsx")
stretch_mode = 1
[node name="Player_Melodie" parent="." instance=ExtResource("1_cl1wt")]
scale = Vector2(4, 4)
scale = Vector2(3, 3)
[node name="StaticBody2D" type="StaticBody2D" parent="." groups=["World_Border"]]
collision_layer = 3
@ -39,18 +44,92 @@ collision_mask = 3
[node name="World Border Up" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_1c4te")
[node name="TextureRect" type="TextureRect" parent="StaticBody2D/World Border Up"]
offset_left = -640.0
offset_top = -392.0
offset_right = 640.0
offset_bottom = -328.0
texture = ExtResource("3_oi2tl")
stretch_mode = 1
[node name="World Border Down" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_qq3vn")
[node name="TextureRect" type="TextureRect" parent="StaticBody2D/World Border Down"]
offset_left = 622.0
offset_top = 379.0
offset_right = 1902.0
offset_bottom = 443.0
rotation = 3.14159
texture = ExtResource("3_oi2tl")
stretch_mode = 1
[node name="World Border Right" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_e1nqi")
[node name="TextureRect" type="TextureRect" parent="StaticBody2D/World Border Right"]
offset_left = -659.0
offset_top = 374.0
offset_right = 61.0
offset_bottom = 438.0
rotation = -1.5708
texture = ExtResource("3_oi2tl")
stretch_mode = 1
[node name="World Border Left" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource("WorldBoundaryShape2D_ia1hi")
[node name="TextureRect" type="TextureRect" parent="StaticBody2D/World Border Left"]
offset_left = 658.0
offset_top = -355.0
offset_right = 1378.0
offset_bottom = -291.0
rotation = 1.5708
texture = ExtResource("3_oi2tl")
stretch_mode = 1
[node name="TextureRect" type="TextureRect" parent="StaticBody2D"]
offset_left = -659.0
offset_top = -392.0
offset_right = -595.0
offset_bottom = -328.0
texture = ExtResource("4_6a3f6")
[node name="TextureRect2" type="TextureRect" parent="StaticBody2D"]
offset_left = -659.0
offset_top = 379.0
offset_right = -595.0
offset_bottom = 443.0
rotation = -1.5708
texture = ExtResource("4_6a3f6")
[node name="TextureRect3" type="TextureRect" parent="StaticBody2D"]
offset_left = 658.0
offset_top = 379.0
offset_right = 722.0
offset_bottom = 443.0
rotation = 3.14159
texture = ExtResource("4_6a3f6")
[node name="TextureRect4" type="TextureRect" parent="StaticBody2D"]
offset_left = 658.0
offset_top = -392.0
offset_right = 722.0
offset_bottom = -328.0
rotation = 1.5708
texture = ExtResource("4_6a3f6")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Camera2D" type="Camera2D" parent="CanvasLayer"]
[node name="Slime" parent="." groups=["Enemies"] instance=ExtResource("3_04ip2")]
position = Vector2(-448, 205)
[node name="Menu_parametres" parent="." instance=ExtResource("6_6ubhx")]
process_mode = 3
visible = false
offset_left = -640.0
offset_top = -360.0
offset_right = 640.0
offset_bottom = 360.0

View file

@ -2,7 +2,6 @@ extends CharacterBody2D
const SPEED = 100.0
var old_pos = Vector2.ZERO
@onready var player = get_parent().get_node("Player_Melodie")
var player_position = Vector2.ZERO
var target_position = Vector2.ZERO
@ -25,9 +24,6 @@ func _process(delta: float) -> void:
else :
direction = target_position
if old_pos == position :
$AnimatedSprite2D.play("idle")
else :
$AnimatedSprite2D.play("walk_down")
$AnimatedSprite2D.play("Generic")
velocity = direction * SPEED

View file

@ -1,45 +1,20 @@
[gd_scene load_steps=8 format=3 uid="uid://cyvqa6g64cw37"]
[gd_scene load_steps=6 format=3 uid="uid://cyvqa6g64cw37"]
[ext_resource type="Script" path="res://scenes/enemies/slime.gd" id="1_hnufy"]
[ext_resource type="Texture2D" uid="uid://c85d5krtd4nks" path="res://ressources/images/blob-1.png" id="1_n4mgf"]
[ext_resource type="Texture2D" uid="uid://c0b6d7551nbcm" path="res://ressources/images/blob-2-4.png" id="2_w8gqg"]
[ext_resource type="Texture2D" uid="uid://c1rqfml1fi47x" path="res://ressources/images/blob-3-side.png" id="3_pwpfc"]
[ext_resource type="Texture2D" uid="uid://2gqy3xv26df1" path="res://ressources/images/blob-3.png" id="5_bhc5m"]
[ext_resource type="Texture2D" uid="uid://c85d5krtd4nks" path="res://ressources/images/blob-1.png" id="2_f4wf2"]
[ext_resource type="Texture2D" uid="uid://c0b6d7551nbcm" path="res://ressources/images/blob-2-4.png" id="3_dyq42"]
[sub_resource type="SpriteFrames" id="SpriteFrames_qfla8"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_n4mgf")
"texture": ExtResource("2_f4wf2")
}, {
"duration": 1.0,
"texture": ExtResource("2_w8gqg")
}, {
"duration": 1.0,
"texture": ExtResource("3_pwpfc")
}, {
"duration": 1.0,
"texture": ExtResource("5_bhc5m")
"texture": ExtResource("3_dyq42")
}],
"loop": false,
"name": &"idle",
"speed": 3.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_n4mgf")
}, {
"duration": 1.0,
"texture": ExtResource("2_w8gqg")
}, {
"duration": 1.0,
"texture": ExtResource("3_pwpfc")
}, {
"duration": 1.0,
"texture": ExtResource("2_w8gqg")
}],
"loop": true,
"name": &"walk_down",
"name": &"Generic",
"speed": 3.0
}]
@ -52,11 +27,9 @@ collision_mask = 3
script = ExtResource("1_hnufy")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(-3, 12)
scale = Vector2(0.2, 0.2)
sprite_frames = SubResource("SpriteFrames_qfla8")
animation = &"idle"
frame = 1
frame_progress = 1.0
animation = &"Generic"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_bokrm")

24
scenes/room.gd Normal file
View file

@ -0,0 +1,24 @@
extends Node2D
@onready var menu_parametres = $Menu_parametres
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
menu_parametres.exit_parametres.connect(on_exit_parametres)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_just_pressed("PAUSE") :
on_param_button_pressed()
func on_param_button_pressed():
get_tree().paused = true
menu_parametres.set_process(true)
menu_parametres.visible = true
func on_exit_parametres() -> void :
get_tree().paused = false
menu_parametres.visible = false
menu_parametres.set_process(false)