So, The code for my horizontal movement was alright and it worked perfectly. The problem is i added some code for vertical movement and my keys are pretty much doing the opposite of what i want to accomplish.
My right key makes my character go up, my up key makes my character go right etc.
Any help is appreciated.
using UnityEngine; using System.Collections;
public class CharacterMovement : MonoBehaviour { public float MaxSpeed = 10f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate ()
{
float move = Input.GetAxis ("Horizontal");
rigidbody2D.velocity = new Vector2 (move * MaxSpeed, rigidbody2D.velocity.y);
float moveV = Input.GetAxis ("Vertical");
rigidbody2D.velocity = new Vector2 (moveV * MaxSpeed, rigidbody2D.velocity.x);
}