princesse/walljump: améliorations du feeling
lorsque le joueur pointe dans une direction accroché au mur il a 20 frames pour décider d'où aller. Si il ne le fait pas, alors le personnage se décolle du mur. Pour être plus clair dans le décollage du mur, mettre une marge suffisante. Coller au mur se produit quand on à les flêches du bon côté du touchent. peut importe qu'on ait de la vitesse ou pas. Ce qui fait que projeté au mur, même avec une vitesse de 0 à l'arrivée, on va s'y coller.
This commit is contained in:
25
princesse.gd
25
princesse.gd
@@ -161,6 +161,8 @@ func walk(direction:int) -> float:
|
||||
init_walk_state()
|
||||
return velocity.x
|
||||
|
||||
if not get_coyote(coyote_grab) and pressing_wall:
|
||||
return WALKING_SPEED * direction *1.2
|
||||
|
||||
# Si le personnage est dans l'air, il aura une friction plus faible lors de
|
||||
# la décélération.
|
||||
@@ -452,22 +454,10 @@ func read_input() -> void:
|
||||
if pressing_wall:
|
||||
if not grab_wall :
|
||||
grab_wall = (
|
||||
(
|
||||
abs(velocity.x) > 0
|
||||
or
|
||||
walking
|
||||
or
|
||||
kicking
|
||||
or
|
||||
dashing
|
||||
)
|
||||
and
|
||||
(
|
||||
(pressing_wall_left and direction == -1)
|
||||
or
|
||||
(pressing_wall_right and direction == 1)
|
||||
)
|
||||
)
|
||||
else:
|
||||
# Désactivation du grab wall
|
||||
if walking:
|
||||
@@ -479,6 +469,7 @@ func read_input() -> void:
|
||||
grab_wall = false
|
||||
else:
|
||||
grab_wall = false
|
||||
coyote_grab = [false]
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("dash" + action_suffix):
|
||||
@@ -537,16 +528,14 @@ func compute_state() -> void:
|
||||
pressing_wall_left = (
|
||||
not is_on_floor() and not collide_ground_far_detect and not is_on_ceiling_only()
|
||||
) and (
|
||||
wall_detect_left.is_colliding() or
|
||||
wall_detect_left2.is_colliding() or
|
||||
wall_detect_left3.is_colliding()
|
||||
(wall_detect_left.is_colliding() and wall_detect_left2.is_colliding()) or
|
||||
(wall_detect_left3.is_colliding())
|
||||
)
|
||||
pressing_wall_right = (
|
||||
not is_on_floor() and not collide_ground_far_detect and not is_on_ceiling_only()
|
||||
) and (
|
||||
wall_detect_right.is_colliding() or
|
||||
wall_detect_right2.is_colliding() or
|
||||
wall_detect_right3.is_colliding()
|
||||
(wall_detect_right.is_colliding() and wall_detect_right2.is_colliding()) or
|
||||
(wall_detect_right3.is_colliding())
|
||||
)
|
||||
pressing_wall = pressing_wall_left or pressing_wall_right
|
||||
|
||||
|
||||
@@ -442,34 +442,6 @@ sprite_frames = SubResource("SpriteFrames_q52wx")
|
||||
animation = &"idle"
|
||||
frame_progress = 0.890388
|
||||
|
||||
[node name="wall_detect_left" type="RayCast2D" parent="."]
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_left2" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -12)
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_left3" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 22)
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right" type="RayCast2D" parent="."]
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right2" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -12)
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right3" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 22)
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
zoom = Vector2(2, 2)
|
||||
position_smoothing_enabled = true
|
||||
@@ -512,4 +484,34 @@ shadow_enabled = true
|
||||
texture = ExtResource("8_8c83t")
|
||||
texture_scale = 0.44
|
||||
|
||||
[node name="wall_detect_left2" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -6.66667)
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right2" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, -6.66667)
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right3" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 16.6667)
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_right" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 5)
|
||||
target_position = Vector2(8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_left3" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 16.6667)
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[node name="wall_detect_left" type="RayCast2D" parent="."]
|
||||
position = Vector2(0, 5)
|
||||
target_position = Vector2(-8, 0)
|
||||
collision_mask = 16
|
||||
|
||||
[connection signal="animation_finished" from="Death player" to="." method="_on_death_player_animation_finished"]
|
||||
|
||||
Reference in New Issue
Block a user