Platform Fighter Movement
So it isn’t exactly a secret that I am working on my own platform fighter that is equal parts Mega Man and Super Smash Bros, with a little sprinkling of Tower Fall. These are my inspirations and I will happily admit it. That platform fighter has a current build on the main site called Zone Bots. It’s pretty fun, but something that was brought up by testers and bugged me throughout its development was that moving in the game just felt like it was missing features. So, like any good developer, I went back and looked toward my inspirations to understand what I could be missing and drew the following conclusion: Zone Bots is too Mega Man and not enough Street Fighter. Well, it isn't enough of a fighting game because fighting games have options in both attacking and approaching the opponent. So what Zone Bots is missing is the implementation of choice on its second axis; it’s movement. To get a feel for increased movement options I looked toward Super Smash Bros and King of Fighters to see how they expanded on their movement systems to work in tandem with their more simplistic attack options to create dynamic gameplay. For extra fun, I implemented these features myself in Unity.
Without further ado, let’s really dig into the components of Super Smash Bros movement system and how it works. First comes the basic movement on the ground and even that comes in three flavors. While on the ground the player actually has three options for approach: walk, run, and a break out, repeatable dash. That’s a whopping three different tools the player can use to gain ground and taken almost wholesale from Fatal Fury and King of Fighters (most of the movement is, so I will stop mentioning it now). Next comes the aerial movement, less complex but still comes with a myriad of options. To start the jump, the player either commits to a full jump or a short jump along with going straight up, left, or right. This brings the jump options up to… three times two… a total of six options to get yourself into the air. Then, once in the air, you get a few more options because the developers realized how important aerial movement was when they started making Super Smash Bros Melee. Once you are in the air, you can jump again with only a single height equal to your full jump (again, left, right, or straight up), fast fall to hasten your descent, and a quick dodge in one of eight directions. That brings our full toolset of aerial approach to… six plus eight plus three plus fast fall… a total of eighteen options! Add those two numbers together and the player actually has a total of twenty one ways to position their character and mix up the opponent. Well, I’m really just going to cover everything except the air dodging. That means that I got my work cut out for me to remaketwenty one thirteen ways to move any given character denoting which attributes should be easily customized.
Without further ado, let’s really dig into the components of Super Smash Bros movement system and how it works. First comes the basic movement on the ground and even that comes in three flavors. While on the ground the player actually has three options for approach: walk, run, and a break out, repeatable dash. That’s a whopping three different tools the player can use to gain ground and taken almost wholesale from Fatal Fury and King of Fighters (most of the movement is, so I will stop mentioning it now). Next comes the aerial movement, less complex but still comes with a myriad of options. To start the jump, the player either commits to a full jump or a short jump along with going straight up, left, or right. This brings the jump options up to… three times two… a total of six options to get yourself into the air. Then, once in the air, you get a few more options because the developers realized how important aerial movement was when they started making Super Smash Bros Melee. Once you are in the air, you can jump again with only a single height equal to your full jump (again, left, right, or straight up), fast fall to hasten your descent, and a quick dodge in one of eight directions. That brings our full toolset of aerial approach to… six plus eight plus three plus fast fall… a total of eighteen options! Add those two numbers together and the player actually has a total of twenty one ways to position their character and mix up the opponent. Well, I’m really just going to cover everything except the air dodging. That means that I got my work cut out for me to remake
1: 2D Movement in Unity
If you have ever done a Unity 2D movement tutorial, setting up the bones of this movement should be easy enough: you use the Update method to read input and FixedUpdate to alter the physics of the character. Some people prefer making their own physics rather than use Unity’s built-in implementation of Box2D but I prefer working with what I got. So the first step I take is to set up my character model (shout out to Mixamo) with a rigidbody2D and a box collider2D to work with Box2D. Do the same with block placement, just be sure to replace their box colliders with 2D box colliders. To make sure the player character is heavy enough to mimic more traditional 2D games, we’ll just increase their gravity scale to four, rather than one. You should have a scene like this:
If you have ever done a Unity 2D movement tutorial, setting up the bones of this movement should be easy enough: you use the Update method to read input and FixedUpdate to alter the physics of the character. Some people prefer making their own physics rather than use Unity’s built-in implementation of Box2D but I prefer working with what I got. So the first step I take is to set up my character model (shout out to Mixamo) with a rigidbody2D and a box collider2D to work with Box2D. Do the same with block placement, just be sure to replace their box colliders with 2D box colliders. To make sure the player character is heavy enough to mimic more traditional 2D games, we’ll just increase their gravity scale to four, rather than one. You should have a scene like this:
Next up, we create a C# script (I’m calling it “Mover”), open up that script and add some variables to actually control the thing. Let’s cover basic movement, so we’ll start with a public speed variable, a private reference to the 2D rigidbody, and jump into the “Update()” method. One issue we will run into is that we’re reading input in “Update()” but are best assigning hard value to the rigidbody’s velocity within “FixedUpdate().” To address this, we shall create a Vector3 called “MoveSpeed” to remember the target values we are generating. You should get the following code:
Then I will create a “MoveInput” method that the Update method will call on to process input on the horizontal and vertical axes of movement. Using these values, we will multiply the horizontal one by the created TargetSpeed variable and save these in the MoveSpeed vector. With that input saved, we will now assign it to the rigidbody’s velocity in FixedUpdate. (be sure to assign the public floats in Unity’s editor)You should have the following:
Now, if you move your character, they move sharply and abruptly. Next, we want to add some code to jump. We need some global variables: a float called “JumpVel” (“Jump Velocity”), and a private boolean called “jump.” Let’s go ahead and change Update() to also check for when the Jump input is pressed with another method: JumpInput(). This method checks for the press and makes “Jump = true” when the button press occurs. Then, in MoveMe(), we set the y velocity to the JumpVel when Jump = true. Yay! You did the basic Unity movement tutorial!
2. Let’s Double Jump
Currently, we can just jump jump jump. Forever. Let’s add a private boolean variable, “Grounded” to the object to check if the user is grounded or not and take advantage of Unity’s “OnCollisionEnter2D” method. We will also add a “CanDoubleJump” boolean variable to the script for later. Let’s write the method and check when the user collides with something tagged “Ground.” Well, let’s first add the Ground tag to our project and object.:
“Ground” isn’t there by default, you just have to add the Ground tag to your list of tags. The Ground must also join the layer mask called “Ground,” something you will make as well.
Now, in the Mover script, let’s add “OnCollisionEnter2D” and check when the collision with the “Ground”-tagged object first occurs. When this happens, we want to specifically check when the bottom of the player touches the ground. To do so, we need more set up. Let’s add an empty Transform to the bottom of the player. We’ll call it “GCheck.” Let’s add a public Transform for the Mover script and drag and drop that transform into that public variable.
Now we’ll add a LayerMask variable called “GLayer” to the Mover as well.
Now, we’ll define the OnCollisionEnter2D to draw a physics2D circle and see if anything within that circle is on the Ground layer mask. If it is, we will set “Grounded = true” and “CanDoubleJump = false.” Then we’ll define OnCollisionExit2D to set “Grounded = false” and “CanDoubleJump = true” when we leave an object tagged “Ground”
Next up, we’ll alter the JumpInput method to accommodate…
And now we got double jumping. I know what you’re going to ask: “B-b-but what about fast fall!? And short hopping!? Why are you hiding the information! How dare you!? I’m going somewhere else!”
…
Well, something along those lines. Anyway, let's get to fast fall and short hopping, actually kinda easy implementations.
3. Short Hops
Short hops don’t seem like they add much to the gameplay, but this is a vital amount of control you’re giving the player to feign a hop and keep them on their toes about from where you are coming for. This one we will determine based on how long the player uses the “jump” button. To start this we will add a boolean “JumpCancel” variable to the ever-expanding list of private global variables and set it to false. Furthermore, we need a variable to track our velocity for Short Hopping and I’ll call that “ShJumpVel.” This doesn't need to be defined in Start, if you want you can make it public and define it in the Unity editor. Then, in JumpInput(), we will add an if statement for “Input.GetButtonUp()” and be sure to check when “Jump” is going up. When this occurs, we are checking when the player releases the jump button. Once they do, we set “JumpCancel = true.” Then, in MoveMe(), we check for when JumpCancel = true, we change the current velocity to our ShJumpVel variable.
That’s it, the short hops are done!
4. Fast Fall
This is similar to Short Hopping in that it actually isn’t terribly difficult. Once again, we’ll create a private bool called “FastFall” that we will set to false. This will determine whether or not we can start the fast fall. As we can only fast fall when we jump, we set FastFall to true when the player leaves the ground and starts their jump. Then, in MoveMe, we will check if our y input is less than 0 (we pressed down), if our y velocity is less than 0 (we have started falling), and if fast fall is true. If all of these are true than we multiply our rigidbody’s velocity by 4 and set Fast Fall to false. Once we hit the ground, we check if our gravity scale is greater than our original scale and reset it. For best results, this reset should be done with a variable which stores the original gravity scale:
And now you got movement, short hops, and fast falls
5.
One thing that’s probably bugging you, because I know it’s bugging me, is that the player character moves so… abruptly. That’s not how Smash works at all! Smash has three different movement speeds (walk, dash, run) along with a turnaround speed when you want to quickly change directions. This is where things get… trickier. Let’s try smoothing out the movement so that there’s build up and then a delay when switching directions.
Rather than just hardcoding the x part of MoveSpeed, we want to accelerate to a target speed along with decelerate to 0 or a different target speed. For this, we can start by creating a “CurSpeed” float with the other private global variables and change the MoveSpeed assignment to read “MoveSpeed = new Vector2(CurSpeed, v)” and have “CurSpeed = h * TargetSpeed” before it. Right between ‘em we introduce a new method call when the character is grounded: a method call to “HandleSpeed” which takes in CurSpeed and the speed Target as parameters. Inside this method we’ll… do some things.
I know, I know, “Big block of code scary,” but trust me when I say that it is not that bad. HandleSpeed is merely checking where our “h” input is at, currently and changes CurSpeed to reach the appropriate value. To do so, I’m changing the CurSpeed value by the float value of 0.5, which I just figured yields the best results.
Conclusion
That sets up a lot of the basics of more Smash-like movement systems. Currently, I still need to cover the running and breakout dash actions, phasing through thin platforms by pressing down while atop them, and the 8 way dodge. All these things I have completed and will walk through my implementation of next time I get a chance to post about ‘em. Until next time, I will leave you with a link to my repository with those completed, along with a different implementation including a “controller” script which I will cover in the future.
This comment has been removed by the author.
ReplyDeleteCasino Table Games | Play Online | Casino Table Games
ReplyDeletePlay your favorite casino table games at Casino Table Games. 아시아 게이밍 We 바카라 검증사이트 have all the rules and 여캠 노출 사고 exciting slot games you 온라인 슬롯 사이트 need 강원랜드 for the thrill of Las Vegas gambling
Check out our online 카지노 사이트 gaming within the United Kingdom page for more information. Usually, a high roller bonus amount would have a larger payout but require a larger deposit amount. Many VIP memberships come in different ranges, normally indicated by a Bronze, Silver, Gold and Platinum membership. Go to Ignition’s home page utilizing our link to qualify for the bonus. On the highest right nook of the page, you will notice a button that says "be part of." Click this button to get started together with your account creation.
ReplyDeleteThe best roulette web 메리트카지노 site delivers a incredible player expertise, offers profitable bonuses and the most important payouts. To find out which casino we’ve ranked top for this month take a look at|try} our toplist. Roulette may be a game of likelihood, but it remains vastly popular with gamers the world over. By exploring our guides and knowledge you can to|you presumably can} hone your abilities and data of method to|tips on how to} win more at roulette.
ReplyDeleteThe weekend booster is the most thrilling promotion that isn’t a welcome bonus. The weekend bonus transfers 메리트카지노 zero.5% of your successful in a vault, and this quantity is credited to the participant on Friday next week. Other measures could accompany account verification and age verification. These safeguards make sure that|be positive that} only you have have} access to your participant account and should withdraw money after finishing achievements. If you’ve tried all the ideas and tips around and nonetheless can’t win, then it’s time to get critical about strategy. You can’t follow these strategies for every sport, however they should to} allow you to win extra often.
ReplyDeleteThey lose $1,000 in the first month, they usually decide 1xbet it's time to stop and never bet again. Compare that with a participant who bets $500 a year over three years. They are a extra worthwhile participant than somebody who gambles excessively end result of|as a result of} they are consistent and loyal, they usually've aligned their bets with their budget to be positioned over time. In the first quarter of 2022, cellular sports activities betting and iGaming earned $2.seventy nine billion in income, nearly 20% of all gaming income. Mobile sports activities betting accounted for $1.fifty eight billion of that sum.
ReplyDeleteThe country is way from legalizing casinos for locals or opening additional casinos for 카지노사이트 locals outcome of|as a outcome of} the federal government believes that the social influence of gambling will be detrimental for its locals. Addiction, felony actions, and broken families may end up} from gambling. Koreans are believed to be highly prone to gambling addiction. Their tradition just isn't mature enough to deal with temptations and stresses. Players from South Korea are restricted to a couple forms of authorized betting. Horse racing, bike racing, lotteries, and a few Toto-style sports activities betting options are available.
ReplyDeleteVideo slots play the same, but they might have up to as} 7 reels, every representing three rows of five symbols. Your 우리카지노 probabilities of successful are just about equal for both forms of these machines. Speaking of other casino games, at Slots.LV you may also|you can even} play the likes of video poker, craps, blackjack, and more. In these circumstances, the reels are an entertainment show with a pre-determined consequence primarily based on a centralized recreation played in opposition to other players. Multi-line slot machines have become more popular because the that} Nineteen Nineties.
ReplyDelete