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?

Комментарии • 60

  • @itsrhet
    @itsrhet 3 месяца назад +2

    Legendary tutorial, got it working way quicker than I expected!

    • @SRCoder
      @SRCoder  3 месяца назад

      Cool. Godot is awesome

  • @tomasalves3462
    @tomasalves3462 5 месяцев назад +2

    Small video, simple and direct to point

  • @ItzAstroTheNoob
    @ItzAstroTheNoob 6 месяцев назад +5

    you're such a life saver

  • @hvnter4397
    @hvnter4397 11 дней назад

    perfect tutorial - thanks!

  • @floatingcowinvasion
    @floatingcowinvasion 9 месяцев назад +3

    I was dreading making a dash cuz it looked hard but this vid made it ez W vid

    • @SRCoder
      @SRCoder  9 месяцев назад +1

      Thanks man!

  • @junior8901
    @junior8901 11 дней назад

    Muchas gracias el vídeo me ayudó mucho 👍👍👍

  • @mariamshahin199
    @mariamshahin199 2 месяца назад +1

    i love u bro this was just what i was looking for(no homo)

  • @kebstrr
    @kebstrr 5 месяцев назад +2

    Thanks for the video!

  • @Alicenuga
    @Alicenuga 2 дня назад

    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)

  • @duccloud4101989
    @duccloud4101989 5 месяцев назад +1

    You saved my day. Thanks :)

  • @hermandarr6274
    @hermandarr6274 11 месяцев назад +2

    Your amazing Dude

    • @SRCoder
      @SRCoder  11 месяцев назад

      Thanks!

  • @user-wl3yg2ro2n
    @user-wl3yg2ro2n 6 месяцев назад

    Your amazing Dude thank you😍

  • @TheJulxsIV
    @TheJulxsIV 3 месяца назад

    how can I do for my player complete the "dash" animation before he starts "Run" (animation) again?

  • @claymorwan
    @claymorwan 3 месяца назад

    Quick question, what do I do if I want to be able to dash while being still, aka when not pressing left of right

  • @user-jf1gx3co7b
    @user-jf1gx3co7b 8 месяцев назад +1

    thank you!!!!

  • @SentryX7
    @SentryX7 Месяц назад +2

    How do i add animation?? 🤔

  • @mystery1051
    @mystery1051 4 месяца назад

    Very good video.

  • @KeetoIsCultured
    @KeetoIsCultured Месяц назад

    hello, how can i make it so during the dash the player isn't affected by gravity?

    • @c2kiyomi
      @c2kiyomi Месяц назад +1

      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

  • @JevonBulze
    @JevonBulze Месяц назад

    Anyway to make that you cant switch directions mid dash?

    • @BenJohnson12345
      @BenJohnson12345 25 дней назад +1

      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

  • @piefish8824
    @piefish8824 10 месяцев назад +1

    hello i did animation for my walk and dash, but when use dash in game it didnt play

    • @piefish8824
      @piefish8824 10 месяцев назад

      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

    • @ibluebee2832
      @ibluebee2832 9 месяцев назад

      @@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

  • @JacobDoesAll
    @JacobDoesAll 3 месяца назад +1

    theres no errors and everything seems to be fine but it wont let me dash for some reason

    • @SRCoder
      @SRCoder  3 месяца назад +1

      Debugging your own problems is a great skill to learn. Keep working at it and you'll get there!

    • @JacobDoesAll
      @JacobDoesAll 3 месяца назад

      @@SRCoder I agree but i was wondering if it was because im using Godot 4 and not Godot 4.1

    • @SRCoder
      @SRCoder  3 месяца назад

      @@JacobDoesAll that won't make a diggerence

    • @therealcherrypapa
      @therealcherrypapa 2 месяца назад

      check under your position movements maybe you duplicated one.

  • @B33BopTheAlien
    @B33BopTheAlien 3 месяца назад

    Thx!

  • @LoxaDAxol
    @LoxaDAxol 6 месяцев назад

    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

    • @SRCoder
      @SRCoder  6 месяцев назад

      Step through the code again and keep trying. Learning to debug is a vital skill for game developers!

    • @LoxaDAxol
      @LoxaDAxol 6 месяцев назад +1

      @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

    • @LoxaDAxol
      @LoxaDAxol 6 месяцев назад

      Holy crap I just got it to work with my code- okay this works thank you for the help

  • @CasticDigital
    @CasticDigital 4 месяца назад

    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?

    • @SRCoder
      @SRCoder  4 месяца назад +2

      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!!

    • @user-rc5wl3xc1z
      @user-rc5wl3xc1z 4 месяца назад

      Did you connect the timeout node thingy so you could tell Godot to stop the dash?

    • @CasticDigital
      @CasticDigital 4 месяца назад

      @@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.

  • @ivangj31games66
    @ivangj31games66 8 месяцев назад +1

    muitor obrigado

  • @NoX_Dynami
    @NoX_Dynami 7 месяцев назад

    Hello, i did exactly what u did in the video and my character doesnt dash. Dont you know why?

    • @NoX_Dynami
      @NoX_Dynami 7 месяцев назад

      okay i found the mistake, i hadnt ":" before "=" in the var direction

    • @SRCoder
      @SRCoder  7 месяцев назад

      Debugging your own problems is a great skill to develop. We'll done!

  • @Slapthesushi
    @Slapthesushi 7 месяцев назад

    How can I make it work when the player stands still?

    • @SRCoder
      @SRCoder  7 месяцев назад +1

      Why not follow the platform game tutorial series on my channel first so you have a basic platform player. Then do the dash.

    • @Slapthesushi
      @Slapthesushi 7 месяцев назад

      @@SRCoder I am still having trouble

    • @Slapthesushi
      @Slapthesushi 7 месяцев назад

      I don’t know how to give the direction variable a value based on the direction of the player

    • @SRCoder
      @SRCoder  7 месяцев назад +1

      @@Slapthesushi try stuff. You'll work it out in the end.

  • @user-et5in1ko2j
    @user-et5in1ko2j 5 месяцев назад +1

    Its not for godot 4😢

  • @ovgamer8742
    @ovgamer8742 3 месяца назад

    Sucks

  • @prod.fxde1
    @prod.fxde1 7 месяцев назад +1

    how to make it so my character stay in air while dashing instead of going kinda downwards?

    • @sebkolind
      @sebkolind 7 месяцев назад +1

      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.

    • @prod.fxde1
      @prod.fxde1 7 месяцев назад +1

      @@sebkolind Thank you soooo much