My level is beginner, so i started from the basic movements. Before to write here, i checked all the possible documentations for this method.
this is some of working code of my 4 way movement from my player script that explains how it moves
private void GetInput()
{
direction = Vector2.zero;
if (Input.GetKey (KeyCode.W))
{
direction += Vector2.up;
}
if (Input.GetKey (KeyCode.A))
{
direction += Vector2.left;
}
if (Input.GetKey (KeyCode.S))
{
direction += Vector2.down;
}
if (Input.GetKey (KeyCode.D))
{
direction += Vector2.right;
P.S. up, down,left,right is the shorthands for the coordinates.
But my next step is to movie object in betweens,
logically it should be like this?
if (Input.GetKey (KeyCode.A) && !Input.GetKey (KeyCode.S)) // so the Unity knows that i pressed two button at the same time
{
direction += Vector2.left + Vector2.down;
and this should point at the specific position on the coordinate system
I have doubts because when i press A(left) the object plays not old(left_animation), but new (left_down_animation), even i didn’t press two buttons at the same time. And the right animation won’t play either.
i also use nodes, which contains x&y coordinate parameters & conditions.
So my question, is it possible to complete my 8way movement by using this method? Any suggestions will be welcomed.
Thank you!