I am having a real hard time getting my character to move the way I would like. I am trying to create a fighting game like Street Fighter and Mortal Kombat (the 2D versions). The problem is that all the tutorials out there that deal with beat-em-up mechanics are all made the same. By that I mean it’s like a Mario style game, where if you hold down the buttons for walking and then jump, the speed at which you were moving horizontally is applied to your vertical movement, and then you move diagonally. I don’t want that.
The only diagonal movement I want is if my character flipping (acrobatically) in the air, that is performed by either FORWARD + UP or FORWARD + BACK.
I cannot for the life of me figure out how to apply a “diagonal force” on my character.
What am I missing here? (Aside from not knowing WTF I am doing)
playerRB.velocity = new Vector2(515, 5);
playerRB.AddForce(transform.up * 5);
playerRB.AddForce(transform.right * 5);
Then there is the problem where if I hold the jump key, my character is sent up flying in the air like a rocket ship. I would like it where the jump key only applies a vertical force ONCE.
void MovementJump()
{
isGrounded = false;
playerRB.AddForce(Vector2.up * jumpDistance);
anim.SetBool("hasJumped", true);
}
I also would like to know how I can disable reading input. For example, if a character is holding the block button, or is performing some other move and are in the middle of that animation, they should not be able to kick.
For instance, if the character is throwing a fireball and is still in the middle of that animation, I should not be able to move the character left or right, or in the middle of the move perform a kick as well.
Sorry for the loaded questions…