From d256354a23a07442951010744e6402455a77e451 Mon Sep 17 00:00:00 2001 From: Thomas Lavocat Date: Fri, 12 May 2023 16:27:24 +0200 Subject: [PATCH] =?UTF-8?q?princess/r=C3=A9glages:=20r=C3=A9glage=20du=20g?= =?UTF-8?q?rab=20wall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Encore perfectible et il reste un bug assez rare mais pénible. --- princesse.gd | 25 ++++++++++++++++++------- princesse.tscn | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/princesse.gd b/princesse.gd index b289abe..377de86 100644 --- a/princesse.gd +++ b/princesse.gd @@ -26,7 +26,7 @@ var gravity: int = ProjectSettings.get("physics/2d/default_gravity") @export var FALLING_SPEED = 230 @export var JUMPING_SPEED = 220 var DASH_SPEED = WALKING_SPEED * 2 -@export var X_SPEED_TABLE = [0, 0.1, 0.15, 0.3, 0.6, 0.9, 1] +@export var X_SPEED_TABLE = [0, 0.1, 0.15, 0.3, 0.4, 0.7, 1] @export var X_SPEED_DECEL = [0, 0.1, 0.6, 1] @export var FALL_SPEED_TABLE = [0, 0.1, 0.15, 0.2, 0.3, 0.6, 0.9, 1] @export var JUMP_SPEED_TABLE = [0, 0.1, 0.2, 0.5, 0.6, 0.7, 0.8, 0.9, 1] @@ -383,17 +383,19 @@ func read_input() -> void: if ground_far_detect.is_colliding() or (is_on_floor() or get_coyote(coyote_ground)): need_jump=true else: + need_jump=false # Peut-il kicker ? if get_coyote(coyote_grab): if not kicking: kicking=true kick_step = KICK_SPEED_TABLE.size()-1 - if pressing_wall_left: - kick_direction = 1 + if grab_wall: + if pressing_wall_left: + kick_direction = 1 + else: + kick_direction = -1 else: - kick_direction = -1 - if not coyote_grab[-1]: - kick_direction *= -1 + kick_direction = direction # Dès qu'il peut et veut sauter, déclencher le saut if need_jump and (is_on_floor() or get_coyote(coyote_ground)): need_jump = false @@ -432,7 +434,16 @@ func read_input() -> void: if pressing_wall: if not grab_wall : grab_wall = ( - abs(velocity.x) > 0 and + ( + abs(velocity.x) > 0 + or + walking + or + kicking + or + dashing + ) + and ( (pressing_wall_left and direction == -1) or diff --git a/princesse.tscn b/princesse.tscn index 314af7e..5aa1498 100644 --- a/princesse.tscn +++ b/princesse.tscn @@ -264,7 +264,7 @@ floor_constant_speed = true script = ExtResource("1_dkp7s") JUMPING_SPEED = 230 COYOTE_LENGTH = 7 -COYOTE_GRAB_LENGTH = 7 +COYOTE_GRAB_LENGTH = 4 WALK_INCR_AIR = 10 [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]