Question by
Sovietpenguin · Oct 14, 2016 at 02:03 AM ·
movementspriteverticalhorizontal
How Would i add animation to this script for vertical and horizontal movement :/ im very new to this and i have no clue
float x = Input.GetAxisRaw ("Horizontal");
float y = Input.GetAxisRaw ("Vertical");
if (Mathf.Abs (x) >= Mathf.Abs (y))
y = 0;
else if (Mathf.Abs (y) >= Mathf.Abs (x))
x = 0;
Vector2 movement = new Vector2 (x, y) * speed;
rb2d.velocity = movement;
Comment
Your answer
Follow this Question
Related Questions
Move the character automaticly with the road 0 Answers
3 lane change scripting with vertical movement problem 1 Answer
What is the best way to change sprite image when making movement? 1 Answer
Hi, got a problem with my vertical axis. 0 Answers
Bug: Unity InputManager sets Horizontal/Vertical input value on Window Focus 0 Answers