Files
ClearTheZone/Assets/Scripts/PlayerController.cs
T

40 lines
890 B
C#

//Oliver&Morten
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour
{
private int speed;
private Vector3 position = Vector3.zero;
private Text score;
private int points;
private Rigidbody rb;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
position = Vector3.zero;
if (Input.GetKey(KeyCode.W))
{
position += Vector3.forward;
}
if (Input.GetKey(KeyCode.A))
{
position += Vector3.left;
}
if (Input.GetKey(KeyCode.S))
{
position += Vector3.back;
}
if (Input.GetKey(KeyCode.D))
{
position += Vector3.right;
}
}
}