Moving Sprites

Hi, how are you guys?
I’m creating a game with the same mechanic us beautiful game : Zombies ate my neighbors.And I, already created my animations for each position, but I cant do my character to move together his animations too. If somebody can show me a script that make a sprite to move, please.
it Follow a example image of my game.

Grateful now!

2655491--187196--1584029061927077.jpg

Here’s a basic example of movement based on the default Horizontal and Vertical axis inputs. These default to arrow keys and WASD, as well as joysticks I think.

There are tons of examples of this across the internet, try googling for a more detailed solution.

using UnityEngine;
public class BasicMovement : MonoBehaviour {
    public float speed = 1;

    private Vector2 input;

    private void Update() {
        // get horizontal input
        input.x = Input.GetAxis("Horizontal");
        // get vertical input
        input.y = Input.GetAxis("Vertical");
        
        // move the object "speed" units per second, in the "input" direction
        transform.Translate(input * speed * Time.deltaTime);
    }
}
1 Like

Thanks Bro It worked!

1 Like