Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need urgent help!

Discussion in '2D' started by Saiony, Dec 10, 2013.

  1. Saiony

    Saiony

    Joined:
    Dec 8, 2013
    Posts:
    3
    I'm playing with unity for 2 weeks because my teacher asked me to do a game with it, but in order to animate the hero I need to improve my playercontroller. So far it's like this:

    using UnityEngine;
    using System.Collections;

    public class HeroControl : MonoBehaviour {
    public float speed = 8f;
    void Update ()
    {
    if (Input.GetKey (KeyCode.RightArrow))
    transform.position += new Vector3 (speed * Time.deltaTime, 0.0f);
    if (Input.GetKey (KeyCode.LeftArrow))
    transform.position -= new Vector3 (speed * Time.deltaTime, 0.0f);
    if (Input.GetKey (KeyCode.UpArrow))
    transform.position += new Vector3 (0.0f, speed * Time.deltaTime);
    if (Input.GetKey (KeyCode.DownArrow))
    transform.position -= new Vector3 (0.0f, speed * Time.deltaTime);
    }
    }


    If someone could tell me what to do to put the animation like those old RPG, that would be great.
    That's the image i'm trying to animate \/
    $131-Noble06.png


    Thx for your help, sorry for the bad english :D
     
  2. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865