Hey i’m currently making a 2D game based with sprites, I’ve got spritemanager 2 and the sprite sheets ready, could anyone try to explain how i make the character move and animate when i press the ¨right button¨. Like how to make the character movie and animate the right animation for which way i’m walking.
I think you are meaning this
public Animator Anim;
void Update()
{
transform.Translate(Input.GetAxisRaw("Vertical"), 0f, 0f, Space.World);
if (Input.GetAxisRaw("Vertical") == 1)
{
Anim.SetBool("YourLeftMovementAnimation", false);
Anim.SetBool("YourRightMovementAnimation", true);
Anim.SetBool("YourStandingAnimation", false);
//You have to set bools to control the animations in the animation window so then you can play them when you want
}
else if (Input.GetAxisRaw("Vertical") == -1)
{
Anim.SetBool("YourLeftMovementAnimation", true);
Anim.SetBool("YourRightMovementAnimation", false);
Anim.SetBool("YourStandingAnimation", false);
}
else
{
Anim.SetBool("YourLeftMovementAnimation", false);
Anim.SetBool("YourRightMovementAnimation", false);
Anim.SetBool("YourStandingAnimation", true);
}
}
This only for left and right movement and the animation thing, but when it comes to jumping you have to do raycasting or use CharacterController
Hey there:) It seems you are new to this (no worries, I’m not expert either) so I advice you to check some good tutorials on youtube. There is a 2d platformer course made by Brackeys. He teaches you from character controling to camera adjustments, backgrounds, animations, sounds… That course is for Begginners/Intermediates. He teached me mostly all I know at the moment, so i’ll be glad if he can help with your problems:)
Take a look at this:
https://www.youtube.com/watch?v=Oao-A7bkve0&index=3&list=PLiyfvmtjWC_X6e0EYLPczO9tNCkm2dzkm