I'm trying to move a character in a 2.5d game im making. I'm not very familiar with C# So this is what I have...Any help would be greatly appreciated
using UnityEngine;
using System.Collections;
//#pragma strict
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start ()
{
int keyboardSpeed = 20;
}
// Update is called once per frame
void Update ()
{
}
void FixedUpdate ()
{
int keyboardX = Input.GetAxis("Horizontal") * keyboardSpeed * Time.deltaTime;
int keyboardY = Input.GetAxis("Vertical") * keyboardSpeed * Time.deltaTime;
int newPos = rigidbody.position + Vector3(keyboardX, keyboardY, 0.0);
rigidbody.MovePosition(newPos);
newPos.x = Mathf.Clamp(newPos.x + keyboardX, -30, 32);
newPos.y = Mathf.Clamp(newPos.y + keyboardY, -12,4);
transform.position = newPos;
}
@script RequireComponent(Rigidbody)
}