Simple Dash Contols in Godot 4.1
HTML-код
- Опубликовано: 8 сен 2024
- So you have a platform character and you want to add a little juice to your controller?
In this video I'll show you how to add "dash" to the basic CharacterBody2D script to make your game cooler.
And all of that in less than 4 minutes? What do you have to lose?
Legendary tutorial, got it working way quicker than I expected!
Cool. Godot is awesome
Small video, simple and direct to point
you're such a life saver
perfect tutorial - thanks!
I was dreading making a dash cuz it looked hard but this vid made it ez W vid
Thanks man!
Muchas gracias el vídeo me ayudó mucho 👍👍👍
i love u bro this was just what i was looking for(no homo)
no diddy
Thanks for the video!
Hi thank you so much for the tutorial.
I'm very new at programing so sorry if my language is not correct. Is there a way to pause the dash timer while in the air? (what I mean by that is keeping the momentum of the dash aslong as I'm in the air)
You saved my day. Thanks :)
Your amazing Dude
Thanks!
Your amazing Dude thank you😍
how can I do for my player complete the "dash" animation before he starts "Run" (animation) again?
Quick question, what do I do if I want to be able to dash while being still, aka when not pressing left of right
thank you!!!!
How do i add animation?? 🤔
I also want to know this.
Very good video.
Thanks
hello, how can i make it so during the dash the player isn't affected by gravity?
Hi! Under the variable that handles direction and dashing ```var horizontal_direction = Input.get_axis("left", "right")
if dashing:
You add ```velocity.y = JUMP_VELOCITY == 0```
that tells the dash to not change the current Y direction during the whole dash
Anyway to make that you cant switch directions mid dash?
If you have the default player controls in your script, just change it up a little:
Its normally:
var direction = Input.get_axis("left", "right")
if direction:
velocity.x = direction * speed
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
and you just have to change the if variable so it would be:
var direction = Input.get_axis("left", "right")
if direction and !dashing:
velocity.x = direction * speed
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
or alternatively:
var direction = Input.get_axis("left", "right")
if direction and not dashing:
velocity.x = direction * speed
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
Dont forget the indentations and it should work smoothly
hello i did animation for my walk and dash, but when use dash in game it didnt play
if direction:
if dashing:
velocity.x = direction * DASHSPEED
anim.play("dash")
else:
velocity.x=direction*SPEED
anim.play("walk")
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
anim.play("idle")
if dashing==true:
anim.play("dash")
here code
@@piefish8824 at the end of the physics process, but still in it, add this :
if dashing == true :
anim.play("Fall")
it has to be in the "func _physics _process" or it won't work.
you're welcome
theres no errors and everything seems to be fine but it wont let me dash for some reason
Debugging your own problems is a great skill to learn. Keep working at it and you'll get there!
@@SRCoder I agree but i was wondering if it was because im using Godot 4 and not Godot 4.1
@@JacobDoesAll that won't make a diggerence
check under your position movements maybe you duplicated one.
Thx!
So I'm trying to figure out this issue, I've copied the code down line for line yet my character won't dash? I've been spending the past 30 minutes trying to figure this out
Step through the code again and keep trying. Learning to debug is a vital skill for game developers!
@SRCoder so found the issue. Turns out this code doesn't actually work with anything other than the template player movement code. This is an issue because:
The code I had gotten from a movement tutorial is different enough to where I can't copy the animation triggers (so the only animation playing is the walking animation, and it just loops infinitely).
I don't want to discard the work I did before but I can't find any other tutorials for a dash Mechanic that work with godot 4.1 AND work with the code I have
Holy crap I just got it to work with my code- okay this works thank you for the help
Me and my friend followed this tutorial to a T and its just not working. Instead, my player starts moving at dash speed but the timer doesnt actually make it stop so im just stuck at max speed.
Was there a recent update that made this code outdated?
I'm sorry to hear that ot didn't work for you. The code is sound and there are lots of people who have had success with this tutorial. Debugging problems is a really important skill so don't give up. Work through what is supposed to happening slowly and logically and you'll get there. Good luck!!
Did you connect the timeout node thingy so you could tell Godot to stop the dash?
@@user-rc5wl3xc1z turns out i didnt turn on "one-shot" so the timer was just repeating over and over again which led to the timer stop function not triggering.
I actually didnt test this fix, im just assuming that that is what was causing it. other wise, everything was doing perfectly to a T the way its shown in this video. I spent multiple hours going through it over and over again redoing everything over and over again.
Eventually I just opted for a different method.
muitor obrigado
Hello, i did exactly what u did in the video and my character doesnt dash. Dont you know why?
okay i found the mistake, i hadnt ":" before "=" in the var direction
Debugging your own problems is a great skill to develop. We'll done!
How can I make it work when the player stands still?
Why not follow the platform game tutorial series on my channel first so you have a basic platform player. Then do the dash.
@@SRCoder I am still having trouble
I don’t know how to give the direction variable a value based on the direction of the player
@@Slapthesushi try stuff. You'll work it out in the end.
Its not for godot 4😢
wdym it is
Yes it is.
Sucks
how to make it so my character stay in air while dashing instead of going kinda downwards?
depending on how you've setup gravity for your character, you have to keep the velocity.y the same throughout the dash, and then when you're done dashing you "unfreeze" the velocity.y again.
@@sebkolind Thank you soooo much