I wasn't even thinking of adding Dash to my game, but after seeing this tutorial I quickly added it in next to no time. Thanks for the help! :)
@AkiDevelops10 ай бұрын
also u deserve a lot more subs
@alecraigan45682 жыл бұрын
3:41 , come on now no need for that I'm flustered.... your tutorials are amazing and you did a fantastic job explaining the process to us newcomers into the gaming development community!
@srivikas18342 жыл бұрын
This is such an easy way to add Dash. I didn't even want to try using dash but after I saw this video, I was able to implement it into my game in 5 mins. Thank you so much. Wish there was a lot more content from you.
@chrishoben8270 Жыл бұрын
Thank you so much! We were using Brackey's tutorial on 2D movement (and his script), but when it came to stuff like Dashing it was almost impossible to implement. Thank you!
@cornmoss6382 жыл бұрын
Dude thank you so much, I decided to remove the lines of code that collect the gravity info which makes the player dash straight and also used the box collider I used to see if I am on the ground to determine if I could dash. This allows my dashes to still have gravity effects and to only be performed on the ground, so if the player rolls off the edge they will still fall. Thanks so much mate
@MugStudios20243 ай бұрын
These simple tutorials have been a lifesaver! THANK YOU!
@HarleyKitson10 ай бұрын
Super useful video! Got it done in no time with no bugs! Really helped me out on my coursework, thanks! :)
@Aterbrarum Жыл бұрын
For a top-down game, to dash towards the mouse pointer I used mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePos.z = 0f; rb.velocity = dashingSpeed * Time.deltaTime * new Vector2(mousePos.x - playerUnit.transform.position.x, mousePos.y - playerUnit.transform.position.y).normalized; The rest is pretty much the same. I removed the parts relating to gravity and I had to start the couroutine from FixedUpdate(), not Update(), otherwise I got inconsistent dash speed. Useful tutorial.
@bendux Жыл бұрын
Thank you for sharing! As far as I know, you don't need to multiply by Time.deltaTime if you set the velocity as shown. Maybe I'm wrong, but that's how they do it in the documentation.
@Khud02 жыл бұрын
Woah, I've never seen an IEnumerator used this way before! Oh, all the possibilities this opens! Thank you very much, your short videos are perfect for my procrastination periods. :)
@progCan Жыл бұрын
thanks for the tutorial, i made a more advanced version of it that includes vertical dahsing (both up and down) and diagonal dashing in any direction. i did it by replacing the vector(2) you set the rb.velocity with: new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")) * DashForce
@bendux Жыл бұрын
Thank you for sharing!
@progCan Жыл бұрын
@@bendux you are welcome
@bastienpetit8124 Жыл бұрын
Hello, I tested your system but after a vertical dash, the player continues to climb, keeping the momentum of the dash until falling back with gravity. How can I fix this?
@scorpiusjones5436 Жыл бұрын
This is pretty aweome. Just throwing this out there, but helping out in the comments section and not on a Discord server can potientally help so many more people down the road imo
@shamangrayson8143 Жыл бұрын
Works perfectly! I had done my player turning a little differently so I just made if statements for isFacingRight true or false to dictate the different directions. Thank you so much!
@pyxelgamer2 жыл бұрын
You never mess up while typing. It's so smooth that I have the weird feeling that you make an AutoHotkey script or something in advance. Anyways, good video.
@bendux2 жыл бұрын
I actually use AutoHotkey to avoid mistakes. Thank you!
@pyxelgamer2 жыл бұрын
@@bendux Ok, you put that much effort? I'm suscribing.
@bendux2 жыл бұрын
@@pyxelgamer Haha, yes!
@amaantrieshard Жыл бұрын
Thanks so much dude, I'm a complete noob to this and you made it look easy. I appreciate you.
@SpivSpirit Жыл бұрын
Thanks, it helped a lot. I just love how straight to the point it was.
@kinopiko015 ай бұрын
Thanks for the tutorial. Some of you may have a problem with the dashing as that it only allows you to dash in one direction. To fix this: Change flip's private void to this: private void Flip() { if (isFacingRight && horizontal < 0f || !isFacingRight && horizontal > 0f) { Vector3 localScale = transform.localScale; isFacingRight = !isFacingRight; if(isFacingRight) localScale.x = 1f; else localScale.x = -1f; transform.localScale = localScale; } } And the IEnumenaratorDash to this: private IEnumerator Dash() { canDash = false; isDashing = true; float originalGravity = rb.gravityScale; rb.gravityScale = 0f; rb.velocity = new Vector2(transform.localScale.x * dashingPower, 0f); print(rb.velocity); tr.emitting = true; yield return new WaitForSeconds(dashingTime); tr.emitting = true; rb.gravityScale = originalGravity; isDashing = false; yield return new WaitForSeconds(dashingCooldown); canDash = true; } Hope this helps
@DeltaReviews420 Жыл бұрын
if your dashing in the wrong direction try setting IsFacingRight to true in the player movement code, worked for me.
@matsu47212 жыл бұрын
Thanks for awesome tutorial! Can you do how to wall jump in unity?
@GlitchSound2 жыл бұрын
Yes! That would be awesome
@bendux2 жыл бұрын
I definitely want to make a video about wall jumping in the future.
@mcgwynardplayz54072 жыл бұрын
@@bendux yo is out?? I just watched this.. hehe
@OrabiMix Жыл бұрын
Always best tutorials in those underrated channels.. new sub ❤️❤️
@gamesbyspinola2 жыл бұрын
really clean set up for the dash ability really similar to the one I have but what I really liked was the trail feature. I didn´t knew about that really cool ;) !
@陳柏宇-s6z16 күн бұрын
great tutorial, the video and code are both short and clean, thank you
@YourDoinGoodLad6 ай бұрын
you have the best tutorials for unity
@usamabinmuzaffar692 Жыл бұрын
Do note one thing though. Constantly starting a coroutine can compound the computation cost of your game. Make sure that you stop the coroutine after it is used.
@bendux Жыл бұрын
In this case, it's not necessary to stop the coroutine manually.
@growingupaqueen23982 жыл бұрын
1000 sub dude keep going your videos are short and direct to the point the code is easy to understand Thank you for being here so glad i found ur channel
@oknaa85262 жыл бұрын
thankss
@luanlugo6005Ай бұрын
Edson vence o Larry seu lacrador., amei o video my man.
@OzunaGameplays2 жыл бұрын
This is the most useful video about dashing, thank you so much!
15 күн бұрын
Thanks bro it was short and really effective.
@deswave12 жыл бұрын
Thank you so much this was so helpful, I'm now beginning to program dashing up and down
@bendux2 жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@deswave12 жыл бұрын
@@bendux ok!
@Bierbr3zel2 жыл бұрын
Great video! Can't wait for your next video to be published!!
@derkleinetim452 жыл бұрын
Nice Tutorial and I tried it out directly bc i looked for a simple dash so long. I had a little Problem, when i dash my player gets boosted extremly far sometimes. I edited the code a little so i coul use my own Player Code (so it has stuff like Coins). But still a very good and simple tutorial, you definitly deserve more views!
@computer_head86532 жыл бұрын
Dude you're so funny and your tutorials are awesome.
@SebMakesGames Жыл бұрын
I don't usually comment on videos, but this realy helped me out! Thanks.
@cyberducc2 жыл бұрын
you content is focused and neat! subbed!
@apesyb98122 жыл бұрын
Hey bendux, i am making a game for uni project. never used unity before, you have helped me alot. thanks
@xxzz1956 ай бұрын
Thanks a lot. I don't even know Dash code can be so easy.
@gracetang10252 жыл бұрын
Thank you for making dash so easy! I have implement dash into my game!
@vextor_daddy187 Жыл бұрын
Thank You mans this helped a lot and now my cube can dash.
@XxADONExX Жыл бұрын
you don't know much this helped me. thank you so much!
@leefy_sf2 жыл бұрын
this is very straight forward with a short intro, I love it! Also quick question, I would like to limit the number of dashes the player can have mid-air and when stepping on the floor it refreshes, thanks!
@bendux2 жыл бұрын
The answer to your question goes beyond the scope of a KZbin comment, but I'd still like to help you. Join our Discord server, and let's solve your problem together!
@projectmuirear396 Жыл бұрын
Hi! I had a similar want, I used this fix, maybe it will work for you, in the private void Update() I used the following lines of code, if (IsGrounded()) { canDash = true; } else { canDash = false; } simple but it works!
@bendux11 ай бұрын
@@noobdev6464 It's hard to tell what's going on without seeing your script.
@bendux11 ай бұрын
@@noobdev6464 I advise you to compare your script with the source code in the description.
@bendux11 ай бұрын
@@noobdev6464 rb.velocity = new Vector2(transform.localScale.x * dashingPower, 0f);
@AxXis--2 жыл бұрын
Thank you so much!! I love this short simple and amazing tutorial!!
@Nin10doLetsPlay2 жыл бұрын
Hey I have a Question. How do I make it so that the Player can also dash diagonally?
@bendux2 жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@DevNoob2 жыл бұрын
Great and understandable video! Great job bendux
@heroysake Жыл бұрын
Si quelqu'un a ajouté, comme moi, le wall jump avant ce tutoriel, le "dashing power", pour augmenter la vitesse en dash, n'est pas appliqué. Pour ça, j'ai du ajouter "&& !isDashing" au "FixedUpdate" : if (!isWallJumping && !isDashing) rb.velocity = new Vector2(horizontal * speed, rb.velocity.y); Ainsi les deux fonctionnent ! Thank you for the videos and curious to see the future tutorials :D
@darkknight2825 Жыл бұрын
It's so simple thank you very much 😁
@U2BE4ALL Жыл бұрын
Thanks, it looks awesome!
@BigVideoSmallClip Жыл бұрын
I love these tutorials
@trulybarr5341 Жыл бұрын
Do you know how to make a character Dash forward on a 3D Side Scroller?
@playanoapps2 жыл бұрын
This was very helpful man!
@BILGI_PASA2 жыл бұрын
Thank you bendux. The video helped me so much.
@TheNamelessTO2 жыл бұрын
Awesome video! Short and to the point! I had an idea on how I want to do a dash function but mine wasn't as nice as yours. =) I hope you'll make more videos =)
@borishofficial5 ай бұрын
i know it's been a pretty long time since this was posted, but is there a way to cancel the dash mid-way through, via a jump or key input? this tutorial was really useful for someone learning the basics but i'm wondering if another method would be needed
@amaanmujeeb78637 ай бұрын
U r truly underrated man❤❤
@le-mon Жыл бұрын
Very helpful, thank you, subbed
@vassago6352 жыл бұрын
Hi bendux. First of all, congrat for your effort. I know manage a youtube channel requires time and will, so thank you. I miss something about dashing in your video: usually, dash is used to dodge traps or enemies. How should I do to avoid collisions through the dash moment? If I disable the player collider he can walk through walls.
@bendux2 жыл бұрын
The answer to your question goes beyond the scope of a KZbin comment, but I'd still like to help you. Join our Discord server, and let's solve your problem together!
@blackantz52939 ай бұрын
Nice tutorial, I was thinking of making it so you can dash through enemies without losing velocity, how would i Impliment that?
@CodedGamer972 Жыл бұрын
i would say increese the gravity when the player is done dashing or if the player is in air or not grounded such as jump or falling
@nightfox_69 Жыл бұрын
GOD Tier Tutorial!
@sldeverything431 Жыл бұрын
thanks for the knowledge
@gideon5261 Жыл бұрын
Hello, this was a great easy to understand video. I only have one question and that is how to add a sound effect without you just flying forever until you die and then play the effect.
@gideon5261 Жыл бұрын
no wories, figured it out after playing around with the placement of dashSoundEffect.Play(); in my code
@Mojzer_2 жыл бұрын
pls do more vids because they help VERY MUCH
@funforgingstudio46902 жыл бұрын
Hi! Great tutorial as always! Is it possible to make level system in Unity?) like you rich the end of a level and then you appears in new one. It would be pleasure to see it from you!)
@bendux2 жыл бұрын
I've added it to my list. Thank you for the suggestion!
@Davearmstrong422 жыл бұрын
Great vid! So easy too implement. How do you prefer to deal with wall collisions mid dash?
@bendux2 жыл бұрын
What do you mean?
@Davearmstrong422 жыл бұрын
@@bendux if you dash in mid air... then hit a wall half way through the dash... is it handled normally or do you have to consider a wall collision mid dash vs a jump. Im new to game dev... Does the dash action just stop at a collision or do you handle that differently during a dash?
@bendux2 жыл бұрын
@@Davearmstrong42 Unity automatically takes care of wall collisions.
@tristanp763 Жыл бұрын
Thank you so much!
@artZs-chaos Жыл бұрын
anybody know how to make the player look the other way with a different flip method.
@bendux Жыл бұрын
How do you flip your player?
@zendaki4601 Жыл бұрын
you really need to be more popular then you are your videos are truly amazing you deserve to have your pillows cold and your gas prices lowered
@noodles4s8923 ай бұрын
thank you very much👍
@lukenorfleet Жыл бұрын
this is so helpul thanks you so much
@Skitozzz Жыл бұрын
Very easy to follow thanks so much here is a sub 👍
@amine86896 ай бұрын
hey man ! thanks a lot !!!
@mcredbunny554210 ай бұрын
Thanks for the video!! Can you explain how to put dash in input system?
@bendux10 ай бұрын
We have a solution for that on our Discord server. Feel free to join!
@GuyWithChainsaw4 ай бұрын
Will it work in unity 3d? With 3d movement?
@slickityragnarthegreat3013 Жыл бұрын
Amazing Video! I just had one issue, where my sprite can only dash left. How can I fix this?
@bendux Жыл бұрын
Would you like to show me your code on Discord?
@gabreese_ Жыл бұрын
Hey Hey, i used this in my game and changed it up a bit. Instead of using a transform i just set the velocity to a value. However i do have an issue. Could you think of any way to add jump functionality mid dash while keeping the current x velocity?
@bendux Жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@rydogg51172 жыл бұрын
This is a great video but I'm having an issue. When I click shift it only dashes right. I know this is an issue with the dashingPower because when I make the 24 into a -24 it dashes left. any idea how to fix?
@bendux2 жыл бұрын
It depends on how you flip your player. Would you like to show me your code on Discord?
@rydogg51172 жыл бұрын
@@bendux sure thing! I will join and ask you then
@Kelgorr2 жыл бұрын
@@bendux Hey I'm having the same issue, I joined your discord. If you have the time should I just message you directly? Edit: I used this canDash = false; isDashing = true; float originalGravity = rb.gravityScale; rb.gravityScale = 0f; trail.emitting = true; if (sprite.flipX == true) { rb.velocity = Vector2.left * dashForce; } else if (sprite.flipX == false) { rb.velocity = Vector2.right * dashForce; } yield return new WaitForSeconds(dashTime); isDashing = false; rb.gravityScale = originalGravity; trail.emitting = false; yield return new WaitForSeconds(dashCooldown); canDash = true; Are there flaws to this method at all?
@bendux2 жыл бұрын
@@Kelgorr I'm glad you were able to fix it. Good job!
@dachigobeja84902 жыл бұрын
Thanks for the tutorial man, but the problem I have is that the player's momentum doesn't reset afterwards so it keeps going forwards in that dashing speed
@bendux2 жыл бұрын
Would you like to show me your code on Discord?
@dachigobeja84902 жыл бұрын
@@bendux actually no, I figured it out myself by manually setting player velocity to zero when the dash ended, I just forgot to edit the comment lol Thanks anyway
@bendux2 жыл бұрын
@@dachigobeja8490 I'm glad you were able to fix it.
@lumiinaty8276 Жыл бұрын
Hey, good video, do you know how to do it on a topdown game to dash in the direction the player is moving (the y and x axis ) ? Thanks for the help
@bendux Жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@erentst2 жыл бұрын
2:00 what do i do if my character moves up,down,right and left??
@bendux2 жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@cristophergonzalez11062 жыл бұрын
Hello thank you very much for this tutorial really is very good! I have a question ! how can I make the dash work every 5 seconds? since every time I press the button makes the dash, thank you very much for your time!
@bendux2 жыл бұрын
Increase the dashing cooldown at the top of the script.
@sirgwindortvinuel2 жыл бұрын
@@bendux hey i have one question. So the script works and i did the same as you and yeah trail shows up and all that but we don't actually dash. Like when we press shift it just goes in the speed i was already before dashing. Do you know how to fix this?
@bendux2 жыл бұрын
@@sirgwindortvinuel Would you like to show me your code on Discord?
@frashfries11 ай бұрын
ur genius and thanks so much
@EnemyOTS Жыл бұрын
hmm for some reason I only dash to the right and gravityScale never changes! Edit: I've fixed it since I'm using this flip function:- private void Flip() { facingRight = !facingRight; Vector3 Scaler = transform.localScale; Scaler.x *= -1; transform.localScale = Scaler; } I added:- if(facingRight) rb.velocity = new Vector2(transform.position.x * dashingForce, 0f); if (!facingRight) rb.velocity = new Vector2(-transform.position.x * dashingForce, 0f); so my character will dash depending on facing right or lift variable, the full function would look like this:- private IEnumerator Dash() { isDashAllowed = false; isDashing = true; float originalGravityScale = rb.gravityScale; rb.gravityScale = 0f; if(facingRight) rb.velocity = new Vector2(transform.position.x * dashingForce, 0f); if (!facingRight) rb.velocity = new Vector2(-transform.position.x * dashingForce, 0f); yield return new WaitForSeconds(dashingTime); rb.gravityScale = originalGravityScale; isDashing = false; yield return new WaitForSeconds(dashingCD); isDashAllowed = true; } and for the gravity scale I have no idea why its not changing at all, I'm still debugging. Edit 2: i couldn't figure it out so i had to play around the issue using the dash animation. I had to add keys that change the GravityScale and disables the attacks scripts while dashing and resetting everything at the last keyframe.
@Kazu173_ Жыл бұрын
is there any way you could help me use this to creating something like a wavedash? i want to dash diagonally towards the ground and use that momentum to slide and carry that speed
@Kazu173_ Жыл бұрын
i also want it to gradually decrease the speed instead of instantly stopping
@bobajeff5958 Жыл бұрын
Complete beginner here, but I noticed that the player can dash while not moving. Here's my fix in case anyone else is struggling with this. put this inside the Update method canDash = false; if (Input.GetAxisRaw("Horizontal") == 1 || Input.GetAxisRaw("Horizontal") == -1) { canDash = true; } Flip(); Hope this helps!
@seventwo75822 жыл бұрын
Hi, I'm from Brazil, I have difficulty with English. Your tutorial is wonderful! But I have a doubt: Every time I use the dash, the camera doesn't follow the character immediately, but only after the dash animation ends. How do I make the camera follow the character during dash animation?
@bendux2 жыл бұрын
Would you like to show me your code on Discord?
@venxm243 Жыл бұрын
This tutorial is awesome - but I have one issue. I use a different code for my player movement, and this method doesn't seem to work with it at all. I'm not sure why, because there is nothing about Dash in my script. I'm wondering if its because there is no animation attached to the player? Not sure how to fix this :(
@bendux Жыл бұрын
Would you like to show me your code on Discord?
@Arcann_bhp Жыл бұрын
i don't understand the if (is dashing) return; how does it disable ur movement while dashing so you can only move the direction you started ur dash?
hey could you make an video combining the wall jump/slide and this vid cause i want to incorporate both but adding both codes to the single script is difficult with some of the differences between them as well as world settings for the gravity for these different projects cause i think im having issues with it
@bendux Жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@cnvanims2 жыл бұрын
idk if you still answer questions, but i wanted to make it so that i could dash upwards and downwards. I am new in both unity and c# so i'm kinda confused how to implement that, can you please help me?
@bendux2 жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@Sh1vt8 ай бұрын
hey a little advice please. error CS0246: The type or namespace name 'IEnumelator' could not be found (are you missing a using directive or an assembly reference?) help pls
@bendux7 ай бұрын
IEnumerator
@Nekkka Жыл бұрын
Thank you for your tutorial! But i have a little problem. the length of the dash is different each time, why can this happen?
@bendux Жыл бұрын
Would you like to show me your code on Discord?
@Nekkka Жыл бұрын
@@bendux 👌okay
@malindupraboda19185 ай бұрын
Thank you :)
@alexanderthegreat48173 ай бұрын
Hi my character sometimes dashes into objects and gets stuck, im using your movement with unity input system tutorial and this dash tutorial, any ideas on whats gone wrong?
@whyslАй бұрын
Maybe you shouid add a physic material 2d with friction 0. Just drag this thing to collider and it will probably work.
@ketsueki血液 Жыл бұрын
Can you show us how to add a sound effect to the dash please?
@animationsbelike2 жыл бұрын
Thank you! :D
@GMCorner Жыл бұрын
Can i multiply the y axis of the rgbd2d with dashing power to dash diagonally ? This only allow us to dash horizontally
@bendux Жыл бұрын
We have a solution for that on our Discord server. Feel free to join!
@C4M3R0N037 ай бұрын
Thank you for the tutorial, but my dash only works when moving to the right direction but not the left direction. What can I do to enable both directions in Visual Studio?
@bendux7 ай бұрын
How do you flip your player?
@C4M3R0N037 ай бұрын
@@bendux I’ve copied the “private void Flip()” from the video but I think the game doesn’t know where it’s actually facing to flip. Is it possible to make something similar but with “is moving” instead of “is facing?”
@bendux7 ай бұрын
@@C4M3R0N03 You probably forgot to call the Flip method in the Update method.
@C4M3R0N036 ай бұрын
With the part under…? private void Update() Flip();
@bendux6 ай бұрын
@@C4M3R0N03 Yes!
@surai2622 жыл бұрын
Great vid! can you also do a wall jump and crouching tutorial? thanks! also subscribed
@bendux2 жыл бұрын
Wall jumping and crouching are both on my list for future videos.
@rastythecrab37737 ай бұрын
Hello, i followed your tutorial but when i tried to jump and dash my character just keeps floating until the end of the screen without faling down, can you help me with this ? Tysm!
@rastythecrab37737 ай бұрын
nvm i forgot to move the trail renderer and now i got, thanks for the tutorial !
@isaakfleshman148610 ай бұрын
I was wondering if there is a way to change the button to work when a controller button is clicked
@bendux8 ай бұрын
There are several ways to do that, but I would recommend taking a look at Unity's new input system.
@VibrantFish742 жыл бұрын
Great vid!!! When i dash i just keep floating on got some tips to fix thise?