diff --git a/princesse.gd b/princesse.gd index 8a03d6d..6ccfc7e 100644 --- a/princesse.gd +++ b/princesse.gd @@ -85,6 +85,7 @@ var walking_step: int = -1 # où la princesse en est dans son tableau d'accel var walk_incr_reserve : int = 0 # utilisé pour la différence ralentissement air/sol var init_decel: bool = true # utilisé pour initialiser la décélération var init_direction_change = true # utilisé pour initialiser le changement de direction +var near_cliff = false # variables d'état relatives au saut var jumping : bool = false # Princesse est-elle en train de sauter ? @@ -151,6 +152,7 @@ func copy_from(other : Princess): dash_direction_x = other.dash_direction_x dash_direction_y = other.dash_direction_y available_dashs = other.available_dashs + near_cliff = other.near_cliff ################################################################################ # @@ -554,6 +556,7 @@ func read_input() -> void: func compute_state() -> void: collide_ground_far_detect = ground_far_detect.is_colliding() or ground_far_detect2.is_colliding() + near_cliff = collide_ground_far_detect and not(ground_far_detect.is_colliding() and ground_far_detect2.is_colliding()) collide_wall_far_detect = ( wall_far_detect_left.is_colliding() or wall_detect_left2.is_colliding() or @@ -597,7 +600,10 @@ func get_new_animation() -> String: if walking_step > 0: animation_new = "walk" else: - animation_new = "idle" + if near_cliff: + animation_new = "near_cliff" + else: + animation_new = "idle" else: if velocity.y > 0.0: if get_coyote(coyote_grab): diff --git a/princesse.tscn b/princesse.tscn index 7426088..bceffad 100644 --- a/princesse.tscn +++ b/princesse.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=73 format=3 uid="uid://dv0mokf4eogm7"] +[gd_scene load_steps=80 format=3 uid="uid://dv0mokf4eogm7"] [ext_resource type="Script" path="res://princesse.gd" id="1_dkp7s"] [ext_resource type="Texture2D" uid="uid://dr7fyh2rufsyj" path="res://sprite/princess_falling_direction.png" id="2_hholp"] @@ -10,6 +10,7 @@ [ext_resource type="Texture2D" uid="uid://c2xtcu5ysgi7o" path="res://sprite/princess_jumping.png" id="6_srvje"] [ext_resource type="Texture2D" uid="uid://d23lmsjrjw1mk" path="res://sprite/princess_wall_stick.png" id="7_8dix4"] [ext_resource type="Texture2D" uid="uid://dgsn3ixn46anc" path="res://sprite/light.png" id="8_8c83t"] +[ext_resource type="Texture2D" uid="uid://vb6uaygswp4w" path="res://sprite/princess_edging.png" id="9_hgh77"] [ext_resource type="Texture2D" uid="uid://cfptwn1c03k1b" path="res://masks/smoke_particle_6.png" id="11_4uqsf"] [sub_resource type="Gradient" id="Gradient_anx4x"] @@ -199,6 +200,30 @@ region = Rect2(0, 200, 24, 50) atlas = ExtResource("6_srvje") region = Rect2(0, 250, 24, 50) +[sub_resource type="AtlasTexture" id="AtlasTexture_rqqt6"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 0, 24, 50) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uevhd"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 50, 24, 50) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4tws1"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 100, 24, 50) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dokbq"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 150, 24, 50) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i44mq"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 200, 24, 50) + +[sub_resource type="AtlasTexture" id="AtlasTexture_twit3"] +atlas = ExtResource("9_hgh77") +region = Rect2(0, 250, 24, 50) + [sub_resource type="AtlasTexture" id="AtlasTexture_yxjwj"] atlas = ExtResource("4_iiu2b") region = Rect2(0, 0, 24, 50) @@ -381,6 +406,29 @@ animations = [{ }, { "frames": [{ "duration": 1.0, +"texture": SubResource("AtlasTexture_rqqt6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uevhd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4tws1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dokbq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i44mq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_twit3") +}], +"loop": true, +"name": &"near_cliff", +"speed": 10.0 +}, { +"frames": [{ +"duration": 1.0, "texture": SubResource("AtlasTexture_yxjwj") }, { "duration": 1.0, @@ -509,7 +557,8 @@ speed_scale = 5.73 [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] modulate = Color(0.823529, 0.823529, 0.823529, 1) sprite_frames = SubResource("SpriteFrames_q52wx") -animation = &"walk" +animation = &"near_cliff" +frame_progress = 0.817412 [node name="Camera2D" type="Camera2D" parent="."] zoom = Vector2(2, 2)