lactase: rajout d'un nouvel item, la lactase
Cet item supprime les vents de la princesse en lui permettant d'immédiatement digérer le lactose. Ce qui a pour effet de couper son dash en cours et de lui vider les intestincs. J'ai rajouté plein d'éléments dans le niveau numéro deux pour tester ça. Addition supplémentaires: - le fromage peut être de différentes couleurs avec pour conséquences différentes intensités. Ce qui a pour effet de recharger plus ou moins vite la jauge de pét. - J'ai rajouté une passerelle à sens unique qui permet de créer un petit point de non retour, j'aimerai bien aussi l'avoir à la verticale, mais pour le moment, je n'y arrive pas.
This commit is contained in:
@@ -9,7 +9,8 @@ signal dash_done()
|
|||||||
var loading = false
|
var loading = false
|
||||||
var loaded = false
|
var loaded = false
|
||||||
|
|
||||||
func load_cheese() -> bool:
|
func load_cheese(speed) -> bool:
|
||||||
|
animationPlayer.speed_scale = speed
|
||||||
if not loading and not loaded:
|
if not loading and not loaded:
|
||||||
animationPlayer.play("reload")
|
animationPlayer.play("reload")
|
||||||
loading = true
|
loading = true
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ tracks/1/keys = {
|
|||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_eh7ry"]
|
[sub_resource type="Animation" id="Animation_eh7ry"]
|
||||||
resource_name = "reload"
|
resource_name = "reload"
|
||||||
length = 3.0
|
length = 2.0
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
@@ -68,7 +68,7 @@ tracks/0/path = NodePath("Full:region_rect")
|
|||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 3),
|
"times": PackedFloat32Array(0, 2),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Rect2(16, 0, 16, 0), Rect2(16, 0, 16, 144)]
|
"values": [Rect2(16, 0, 16, 0), Rect2(16, 0, 16, 144)]
|
||||||
@@ -80,7 +80,7 @@ tracks/1/path = NodePath("Full:position")
|
|||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
"times": PackedFloat32Array(0, 3),
|
"times": PackedFloat32Array(0, 2),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector2(0, -70), Vector2(0, 0)]
|
"values": [Vector2(0, -70), Vector2(0, 0)]
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ func reset():
|
|||||||
for gauge in gauges:
|
for gauge in gauges:
|
||||||
gauge.reset()
|
gauge.reset()
|
||||||
|
|
||||||
func load_cheese():
|
func load_cheese(speed):
|
||||||
for gauge in gauges:
|
for gauge in gauges:
|
||||||
if gauge.load_cheese():
|
if gauge.load_cheese(speed):
|
||||||
return
|
return
|
||||||
|
|
||||||
func dash_fart():
|
func dash_fart():
|
||||||
|
|||||||
9
game.gd
9
game.gd
@@ -65,15 +65,20 @@ func _on_hud_screen_is_black() -> void:
|
|||||||
if old_princesse:
|
if old_princesse:
|
||||||
princesse.copy_from(old_princesse)
|
princesse.copy_from(old_princesse)
|
||||||
princesse.connect("cheese_collected", hud_load_cheese)
|
princesse.connect("cheese_collected", hud_load_cheese)
|
||||||
|
princesse.connect("lactase_collected", hud_reset_cheese)
|
||||||
princesse.connect("dash_fart", hud_unload_cheese)
|
princesse.connect("dash_fart", hud_unload_cheese)
|
||||||
#princesse.connect("princess_is_dead", princess_death)
|
#princesse.connect("princess_is_dead", princess_death)
|
||||||
hud.end_scene_transition()
|
hud.end_scene_transition()
|
||||||
|
|
||||||
|
# vient de la princesse quand elle a ramassé du lactase
|
||||||
|
func hud_reset_cheese():
|
||||||
|
Input.start_joy_vibration(0, 0.1, 0.1, 0.1)
|
||||||
|
hud.reset()
|
||||||
|
|
||||||
# vient de la princesse quand elle a ramassé un fromage
|
# vient de la princesse quand elle a ramassé un fromage
|
||||||
func hud_load_cheese():
|
func hud_load_cheese(speed):
|
||||||
Input.start_joy_vibration(0, 0, 1, 0.1)
|
Input.start_joy_vibration(0, 0, 1, 0.1)
|
||||||
hud.load_cheese()
|
hud.load_cheese(speed)
|
||||||
|
|
||||||
# vient de la princesse quand elle ^ète
|
# vient de la princesse quand elle ^ète
|
||||||
func hud_unload_cheese():
|
func hud_unload_cheese():
|
||||||
|
|||||||
48
items/cheese.gd
Normal file
48
items/cheese.gd
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
class_name Cheese extends Area2D
|
||||||
|
|
||||||
|
|
||||||
|
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
||||||
|
@onready var sprite := $Sprite2D as Sprite2D
|
||||||
|
@onready var timer := $Timer as Timer
|
||||||
|
@export var CHEESE_RESPAWN_TIME : int = 1
|
||||||
|
|
||||||
|
enum KIND {BRIE, BREBIS, EMMENTAL, BLEU}
|
||||||
|
@export var CHEESE_KIND : KIND = KIND.BRIE
|
||||||
|
var cheese_strength : float = 1
|
||||||
|
|
||||||
|
var picked :bool = false
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if CHEESE_KIND == KIND.BREBIS:
|
||||||
|
cheese_strength = 2
|
||||||
|
sprite.set_region_rect(Rect2(Vector2(48, 16), Vector2(16, 16)))
|
||||||
|
elif CHEESE_KIND == KIND.EMMENTAL:
|
||||||
|
cheese_strength = 3
|
||||||
|
sprite.set_region_rect(Rect2(Vector2(16, 0), Vector2(16, 16)))
|
||||||
|
elif CHEESE_KIND == KIND.BLEU:
|
||||||
|
cheese_strength = 10
|
||||||
|
sprite.set_region_rect(Rect2(Vector2(48, 0), Vector2(16, 16)))
|
||||||
|
else:
|
||||||
|
cheese_strength = 1
|
||||||
|
sprite.set_region_rect(Rect2(Vector2(32, 0), Vector2(16, 16)))
|
||||||
|
animation_player.speed_scale = cheese_strength /2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
|
if not picked:
|
||||||
|
animation_player.play(&"picked")
|
||||||
|
(body as Princess).you_got_cheese(cheese_strength)
|
||||||
|
picked = true
|
||||||
|
# Le fromage peut être à utilisation unique
|
||||||
|
if CHEESE_RESPAWN_TIME > 0:
|
||||||
|
timer.start(CHEESE_RESPAWN_TIME)
|
||||||
|
|
||||||
|
func _on_timer_timeout() -> void:
|
||||||
|
timer.stop()
|
||||||
|
animation_player.play(&"RESET")
|
||||||
|
|
||||||
|
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||||
|
if anim_name == "RESET":
|
||||||
|
animation_player.play(&"cheese")
|
||||||
|
picked = false
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://bfff6uggijk4k"]
|
[gd_scene load_steps=9 format=3 uid="uid://lble7xchwb6e"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://items/normal_cheese.gd" id="1_2l3x1"]
|
[ext_resource type="Script" path="res://items/cheese.gd" id="1_w15aa"]
|
||||||
[ext_resource type="Texture2D" uid="uid://blh8aqj3ojadf" path="res://sprite/items.png" id="1_rx0yq"]
|
[ext_resource type="Texture2D" uid="uid://blh8aqj3ojadf" path="res://sprite/items.png" id="2_t0wi0"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7rdb1"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7rdb1"]
|
||||||
atlas = ExtResource("1_rx0yq")
|
atlas = ExtResource("2_t0wi0")
|
||||||
region = Rect2(16, 0, 16, 16)
|
region = Rect2(0, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_xry4i"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_xry4i"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
@@ -124,13 +124,15 @@ _data = {
|
|||||||
"picked": SubResource("Animation_jemsl")
|
"picked": SubResource("Animation_jemsl")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Fromage normal" type="Area2D"]
|
[node name="Fromage" type="Area2D"]
|
||||||
collision_layer = 64
|
collision_layer = 64
|
||||||
script = ExtResource("1_2l3x1")
|
script = ExtResource("1_w15aa")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
scale = Vector2(0.7, 0.7)
|
scale = Vector2(0.7, 0.7)
|
||||||
texture = SubResource("AtlasTexture_7rdb1")
|
texture = SubResource("AtlasTexture_7rdb1")
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_xry4i")
|
shape = SubResource("CircleShape2D_xry4i")
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
class_name NormalCheese extends Area2D
|
class_name LactasePill extends Area2D
|
||||||
|
|
||||||
|
|
||||||
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
||||||
@onready var timer := $Timer as Timer
|
@onready var timer := $Timer as Timer
|
||||||
@export var CHEESE_RESPAWN_TIME : int = 1
|
@export var LACTASE_RESPAWN_TIME : int = 1
|
||||||
var picked :bool = false
|
var picked :bool = false
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> void:
|
func _on_body_entered(body: Node2D) -> void:
|
||||||
if not picked:
|
if not picked:
|
||||||
animation_player.play(&"picked")
|
animation_player.play(&"picked")
|
||||||
(body as Princess).you_got_cheese()
|
(body as Princess).you_got_lactase()
|
||||||
picked = true
|
picked = true
|
||||||
# Le fromage peut être à utilisation unique
|
# Le fromage peut être à utilisation unique
|
||||||
if CHEESE_RESPAWN_TIME > 0:
|
if LACTASE_RESPAWN_TIME > 0:
|
||||||
timer.start(CHEESE_RESPAWN_TIME)
|
timer.start(LACTASE_RESPAWN_TIME)
|
||||||
|
|
||||||
func _on_timer_timeout() -> void:
|
func _on_timer_timeout() -> void:
|
||||||
timer.stop()
|
timer.stop()
|
||||||
@@ -21,5 +21,5 @@ func _on_timer_timeout() -> void:
|
|||||||
|
|
||||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||||
if anim_name == "RESET":
|
if anim_name == "RESET":
|
||||||
animation_player.play(&"cheese")
|
animation_player.play(&"lactase")
|
||||||
picked = false
|
picked = false
|
||||||
148
items/lactase.tscn
Normal file
148
items/lactase.tscn
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://b1c6ox0yndxae"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://items/lactase.gd" id="1_74h8u"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://blh8aqj3ojadf" path="res://sprite/items.png" id="2_otpeg"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_r1hm6"]
|
||||||
|
atlas = ExtResource("2_otpeg")
|
||||||
|
region = Rect2(48.8807, 37.6091, 14.0905, 7.63786)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_xry4i"]
|
||||||
|
radius = 4.0
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_r46qo"]
|
||||||
|
resource_name = "RESET"
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = false
|
||||||
|
tracks/1/path = NodePath("Sprite2D:modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(),
|
||||||
|
"transitions": PackedFloat32Array(),
|
||||||
|
"update": 0,
|
||||||
|
"values": []
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Sprite2D:self_modulate")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_fpj7j"]
|
||||||
|
resource_name = "lactase"
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0.1, 0.5, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(0, -2), Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0.1, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_jemsl"]
|
||||||
|
resource_name = "picked"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0.1, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 2.2974),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(0, -50)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = false
|
||||||
|
tracks/1/path = NodePath(".:modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(),
|
||||||
|
"transitions": PackedFloat32Array(),
|
||||||
|
"update": 0,
|
||||||
|
"values": []
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Sprite2D:self_modulate")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0.1, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4iwa0"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_r46qo"),
|
||||||
|
"lactase": SubResource("Animation_fpj7j"),
|
||||||
|
"picked": SubResource("Animation_jemsl")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="lactase" type="Area2D"]
|
||||||
|
collision_layer = 64
|
||||||
|
script = ExtResource("1_74h8u")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.7, 0.7)
|
||||||
|
texture = SubResource("AtlasTexture_r1hm6")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_xry4i")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
autoplay = "lactase"
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_4iwa0")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://cfou80f4ng1q0"]
|
[gd_scene load_steps=4 format=3]
|
||||||
|
|
||||||
[ext_resource type="TileSet" uid="uid://cx4160r6lbeb3" path="res://levels/global_tileset.tres" id="1_u82x8"]
|
[ext_resource type="TileSet" uid="uid://cx4160r6lbeb3" path="res://levels/global_tileset.tres" id="1_u82x8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bfff6uggijk4k" path="res://items/fromage_normal.tscn" id="3_3jwuu"]
|
[ext_resource type="PackedScene" uid="uid://lble7xchwb6e" path="res://items/fromage.tscn" id="3_3jwuu"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dv0mokf4eogm7" path="res://princesse.tscn" id="3_cfovy"]
|
[ext_resource type="PackedScene" uid="uid://dv0mokf4eogm7" path="res://princesse.tscn" id="3_cfovy"]
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|||||||
37
princesse.gd
37
princesse.gd
@@ -50,8 +50,10 @@ var DASH_SPEED = WALKING_SPEED * 2
|
|||||||
|
|
||||||
@export var MAX_FARTS : int = 3
|
@export var MAX_FARTS : int = 3
|
||||||
|
|
||||||
signal cheese_collected() # utilisé pour remplir le HUD qui apelera
|
signal cheese_collected(speed:float) # utilisé pour remplir le HUD qui apelera
|
||||||
# ensuite la fonction reload_fart quand il aura fini
|
# ensuite la fonction reload_fart quand il aura fini
|
||||||
|
signal lactase_collected() # utilisé pour vider le HUD qui apelera
|
||||||
|
# ensuite la fonction kill_farts quand il aura fini
|
||||||
signal dash_fart() # utilisé pour vider le HUD
|
signal dash_fart() # utilisé pour vider le HUD
|
||||||
signal princesse_is_dead() # signal au jeu de recharger la scene
|
signal princesse_is_dead() # signal au jeu de recharger la scene
|
||||||
|
|
||||||
@@ -389,6 +391,8 @@ func read_input() -> void:
|
|||||||
kick_direction = 1
|
kick_direction = 1
|
||||||
else:
|
else:
|
||||||
kick_direction = -1
|
kick_direction = -1
|
||||||
|
if not coyote_grab[-1]:
|
||||||
|
kick_direction *= -1
|
||||||
# Dès qu'il peut et veut sauter, déclencher le saut
|
# Dès qu'il peut et veut sauter, déclencher le saut
|
||||||
if need_jump and (is_on_floor() or get_coyote(coyote_ground)):
|
if need_jump and (is_on_floor() or get_coyote(coyote_ground)):
|
||||||
need_jump = false
|
need_jump = false
|
||||||
@@ -425,16 +429,16 @@ func read_input() -> void:
|
|||||||
|
|
||||||
# Le joueur veut-il et peut-il s'accrocher au mur ?
|
# Le joueur veut-il et peut-il s'accrocher au mur ?
|
||||||
if pressing_wall:
|
if pressing_wall:
|
||||||
if not grab_wall:
|
if not grab_wall :
|
||||||
grab_wall = (
|
grab_wall = (
|
||||||
(pressing_wall_left and (
|
abs(velocity.x) > 0 and
|
||||||
walking or kicking or dashing
|
(
|
||||||
) and direction == -1)
|
(pressing_wall_left and direction == -1)
|
||||||
or
|
or
|
||||||
(pressing_wall_right and (
|
(pressing_wall_right and direction == 1)
|
||||||
walking or kicking or dashing
|
)
|
||||||
) and direction == 1)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
grab_wall = false
|
grab_wall = false
|
||||||
|
|
||||||
@@ -546,18 +550,27 @@ func _physics_process(_delta: float) -> void:
|
|||||||
move_and_handle_collisions()
|
move_and_handle_collisions()
|
||||||
play_animation()
|
play_animation()
|
||||||
|
|
||||||
func you_got_cheese() -> void:
|
func you_got_cheese(speed:float=1) -> void:
|
||||||
cheese_collected.emit()
|
cheese_collected.emit(speed)
|
||||||
|
|
||||||
func reload_fart() -> void:
|
func reload_fart() -> void:
|
||||||
available_dashs = min(available_dashs+1, MAX_FARTS)
|
available_dashs = min(available_dashs+1, MAX_FARTS)
|
||||||
Input.start_joy_vibration(0, 0, 1, 0.2)
|
Input.start_joy_vibration(0, 0, 1, 0.2)
|
||||||
|
|
||||||
|
func you_got_lactase() -> void:
|
||||||
|
lactase_collected.emit()
|
||||||
|
kill_farts()
|
||||||
|
|
||||||
|
func kill_farts() -> void:
|
||||||
|
available_dashs = 0
|
||||||
|
cancel_dash()
|
||||||
|
Input.start_joy_vibration(0, 0.5, 0, 0.1)
|
||||||
|
|
||||||
func death() -> void:
|
func death() -> void:
|
||||||
if not dead:
|
if not dead:
|
||||||
print("death")
|
print("death")
|
||||||
locked = true
|
locked = true
|
||||||
Input.start_joy_vibration(0, 1, 1, 1)
|
Input.start_joy_vibration(0, 1,0.7, 1)
|
||||||
self.rotation = 90
|
self.rotation = 90
|
||||||
dead = true
|
dead = true
|
||||||
death_animation.play(&"death")
|
death_animation.play(&"death")
|
||||||
|
|||||||
@@ -265,38 +265,38 @@ script = ExtResource("1_dkp7s")
|
|||||||
JUMPING_SPEED = 230
|
JUMPING_SPEED = 230
|
||||||
COYOTE_LENGTH = 7
|
COYOTE_LENGTH = 7
|
||||||
COYOTE_GRAB_LENGTH = 7
|
COYOTE_GRAB_LENGTH = 7
|
||||||
WALK_INCR_AIR = 6
|
WALK_INCR_AIR = 10
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_q52wx")
|
sprite_frames = SubResource("SpriteFrames_q52wx")
|
||||||
animation = &"jump_impulsion"
|
animation = &"jump_impulsion"
|
||||||
|
|
||||||
[node name="wall_detect_left" type="RayCast2D" parent="."]
|
[node name="wall_detect_left" type="RayCast2D" parent="."]
|
||||||
target_position = Vector2(-10, 0)
|
target_position = Vector2(-8, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="wall_detect_left2" type="RayCast2D" parent="."]
|
[node name="wall_detect_left2" type="RayCast2D" parent="."]
|
||||||
position = Vector2(0, -19)
|
position = Vector2(0, -16)
|
||||||
target_position = Vector2(-10, 0)
|
target_position = Vector2(-8, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="wall_detect_left3" type="RayCast2D" parent="."]
|
[node name="wall_detect_left3" type="RayCast2D" parent="."]
|
||||||
position = Vector2(0, 24)
|
position = Vector2(0, 22)
|
||||||
target_position = Vector2(-10, 0)
|
target_position = Vector2(-8, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="wall_detect_right" type="RayCast2D" parent="."]
|
[node name="wall_detect_right" type="RayCast2D" parent="."]
|
||||||
target_position = Vector2(14, 0)
|
target_position = Vector2(10, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="wall_detect_right2" type="RayCast2D" parent="."]
|
[node name="wall_detect_right2" type="RayCast2D" parent="."]
|
||||||
position = Vector2(0, -19)
|
position = Vector2(0, -16)
|
||||||
target_position = Vector2(14, 0)
|
target_position = Vector2(10, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="wall_detect_right3" type="RayCast2D" parent="."]
|
[node name="wall_detect_right3" type="RayCast2D" parent="."]
|
||||||
position = Vector2(0, 24)
|
position = Vector2(0, 22)
|
||||||
target_position = Vector2(14, 0)
|
target_position = Vector2(10, 0)
|
||||||
collision_mask = 16
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|||||||
Reference in New Issue
Block a user