How do I make make my character move?

The game is top down (like how the binding of Isaac is top down) and all the tutorials just say how to do it for a a side scroller like Mario or something. I want W to be up A to be left and D to be right S to be down

Yep, this is a good example for EditorPrefs as this seems to be a preference of this editor class.

3 Answers

3

There are lots of way to move your character. You can use transform , rigidbody or character controller for movement.For this code your character should be attatch with rigidbody and it is faster then transform.position

Rigidbody PlayerRigidbody;
  void Awake()
    {
        PlayerRigidbody = GetComponent<Rigidbody>();
    }

void FixedUpdate()
    {
        float h = Input.GetAxisRaw("Horizontal");
        float v = Input.GetAxisRaw("Vertical");

        Move(h, v);
    }
  void Move (float h, float v)
    {
        Movement.Set(h, 0f, v);
        Movement = Movement.normalized * 10 * Time.deltaTime;
        PlayerRigidbody.MovePosition(transform.position + Movement);
        //for transform  ( Transform.Translate(new vector3(h,0,v) * 10*   time.deltatime)    }

`

esiest way

  1. you need to take an pre-built
    character controller !!
  2. there are many projects on internet which are free to download
    and have a character controller fully animated and ready to use ( standard assets also have one )
  3. which jumps moves here and there ohk! and all have W,S,A,D assigned
  4. and you dont need to put your brain in animation and scripting!
  5. For top to down you can add a camera which is placed above the character in any angle now put the camera in the character so that, when your character moves the camera also moves !
  6. so easy! this is the best way to do so

hard way

  • if you are a scripter then make your
    own scripts take an character from maximo and include all animations
  • rigid body script
  • movement script
  • camera script also
  • all this you have to make

i recommend using easy way!

@Rihit5 if I use the pre-made one would I be able to use my own characters

@HerdexX
Yes I think you can.