You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
659 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterMovement : MonoBehaviour {
public float Speed;
//Public movement functions :)
public void MoveLeft()
{
GetComponent<Rigidbody>().AddForce(new Vector3(-Speed, 0.0f, 0.0f));
}
public void MoveRight()
{
GetComponent<Rigidbody>().AddForce(new Vector3(Speed, 0.0f, 0.0f));
}
public void MoveUp()
{
GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, Speed));
}
public void MoveDown()
{
GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, -Speed));
}
}