• VOiD1 Gaming

Box Bot - Unity Tutorial 3

[UNITY TUTORIAL] [BEGINNER] [ONE WAY JUMP & VERTICAL DASH DOWN]


Hello, Glad to have you back! So far, we have completed the basic steps to a Simple Platformer. Now it’s time to add some more functionalities to our game. In this tutorial, we will learn how to jump over a platform on One Single Way and we will also learn how to Super Dash Downside. We will make it quick and simple so that it will boost your confidence.


Steps -


1. Open Unity and now you can see the Editor with the default setup we have till now. Now let’s first make our One Way Platform by creating a platform above the Crates. Select one ground object and duplicate it using the shortcut command CTRL+D and Drag it over the Crate.


2. Now adjust the size of the Box Collider 2D by clicking the Edit Collider in the Box Collider 2D component and resizing the box in the Scene View. Resize the Box Collider 2D to the Platform size. Again Duplicate the platform and position it to the side of the previous platform.


3. Now Select the two platforms we have created and head your way to get component and add a Platform Effector 2d. Platform Effector 2D helps in getting the collision within a certain range of angles. This will help in getting our player through one side. Check the “Used By Effector” box in the Box Collider 2D. Multiple Selection allows assigning multiple components to the individual game object we have selected.


4. And yes! Now you can jump over the Platform from standing below it in a single way. It’s time to add super dash in the vertical direction.


5. Open the Movement Script from the Player Game Object by double-clicking on the Movement Script component. To make our Player Super Dash in the vertical direction, we need to make a boolean first to check whether the player wants to super dash and a float to give a magnitude for the Super Dash. Also assign Super Dash as false in the Start function, as we don’t want to Super Dash at the beginning of the game.


6. Let’s Check for the button Press in the update menu and tweak the value of Super Dash. We will check if the button is pressed and the Player isn’t in the Ground then it will Super Dash or else Super Dash is not available in the ground.


7. Again in the Fixed Update we can check for the state of the Super Jump boolean. If the Super Jump is true and our player isn’t Grounded then the Player can do a Super Dash. That is player.AddForce(Vector2.Down * superdashspeed). Where Vector.Down helps in providing the direction of the force, which is downside.


8. And That’s it! We have a working Super Dash Script! Now Save the Code and get back to Unity Editor, Assign a value of Super Dash float to any higher number like 20 and start playing. You can see while we press the button we have assigned for the Super Dash, our Player Dashes down suddenly.


Hereby we have completed our Third Tutorial and now we have Polished our Game even more. However, you can always tweak the values that we have set and can play around the Physics component to get much better gameplay.


Project Files - Box Bot Tutorial Project Files

Graphics Assets - Box Bot Graphics Assets