Chasing some logic ideas here. I'm pretty new at this.
I have a character running, jumping, etc. I want to implement a "dash" function to the character.
Pressing R makes character run, tapping and holding R again makes character dash.
I have a state setup happening where I have all my code in the R key as such:
if btn_right.check() == 2: #2 = pressed in the input_states.gd script
move(player_speed, acceleration, delta)
ORIENTATION_NEXT = "right"
anim = "run"
anim_speed = 2
anim_blend = 0.3
How would I go about putting a check in there for dashing or not?
I've considered these variables:
var dash = false #are they dashing?
var dash_time = 4 #how long they can dash for
var dash_speed = 2 #multiplier - how much faster than the normal run is the dash
I'm just at a loss of how to say and where to put something like:
- check if R is pressed a second time
- if so, then dash like a madpixelsprite
- if key released, set dash to FALSE
I know I've almost answered it, I just can't get it right unfortunately. Any help would be manna from heaven. :-)