Hello, I’m making a 2D platforming game - with the option of holding down left mouse button to extend your arm and point it at the cursor. However, during this phase of extending the arm, I have a new set of animations to replace the current ones - and I have no idea how to implement this. I’ve done a lot of googling, but so far no luck. I tried expanding my Enum of “States” (such as running, jumping etc) to include the new ones like “RunningNoArm” and “JumpingNoArm” - then adding a whole bunch of IF/ELSE statements, but had no success with that, and just broke the code entirely. And if I had managed to get the correct states anyway, I would then somehow have to add connections between every single animation in the Animator? Surely there’s a better way
Thank you in advance;
A complete beginner^^
Example Code:
private void VelocityState()
{
if(state == State.jumping)
{
if(rb.velocity.y < .1f)
{
state = State.falling;
}
}
else if (state == State.falling)
{
if (coll.IsTouchingLayers(ground))
{
state = State.idle;
}
}
//If an absolute number of movement on x axis is greather than the absolute lowest possible, then use running animation
else if (Mathf.Abs(rb.velocity.x) > 2f)
{
//Moving
state = State.running;
}
//otherwise, use idle animation
else
{
state = State.idle;
}
}
}