I want to save the basic 2D control for a character that the user provides before starting the time in scene.
and can anyone help me by telling the way by which i can move my character according to the input in array.
i’ve made a code but i am sure it doesn’t work but it explains the point well.
using UnityEngine;
using System.Collections;
public class charactercontrol : MonoBehaviour {
// Use this for initialization
void Start () {
int[] instructions = new int[25];
}
// Update is called once per frame
void Update () {
for (int i = 0; i < 5; i++)
if (Input.GetKey ("up")) {
instructions *= 1;*
-
} else if (Input.GetKey ("right")) {*
_ instructions = 2;_
* }*
* else if (Input.GetKey (“down”)) {*
_ instructions = 3;
* }
else if (Input.GetKey (“left”)) {
instructions = 4;
}
}
}*_