Need wallslide to trigger only if you dashed into the wall

Godot Version

4.2.2

Question

I am very new to Godot (as in started last week) and I’m making a 2D platformer in which the player can wallslide, but only if they dash into the wall. My issue is that I’ve managed to implement a wallslide, but I’m not sure how to make the wallslide only work when you dash into the wall. Here is my current code for the wallslide:

if is_on_wall() and not is_on_floor():
velocity.y = 5

This code is currently under _physics_process. It’s very basic, but my goal is that the code above will only trigger if the variable “is_dashing” is true, but will then persist after is_dashing become false (which naturally happens upon impact with the wall).
This means that simply putting is_dashing in the if statement doesn’t work. I’m sure there’s a very simple solution to this, but it’s not one I could find in an hour of searching online.

coyote time allows you, for a brief duration, to jump even if you aren’t standing on the ground.

do something like that but for wall sliding

above, if you collide with a wall and stopped dashing less than say 1/10th a second ago, than allow wall sliding.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.