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.