//Oliver
using UnityEngine;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour
{
    [SerializeField] int speed;
    private Vector3 position = Vector3.zero;
    private Text score;
    private int points;
    private Rigidbody rb;
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void Update()
    {
        position = Vector3.zero;
        if (Input.GetKey(KeyCode.W))
        {
        position += Vector3.forward * speed;
        }
        if (Input.GetKey(KeyCode.A))
        {
        position += Vector3.left * speed;
        }
        if (Input.GetKey(KeyCode.S))
        {
        position += Vector3.back * speed;
        }
        if (Input.GetKey(KeyCode.D))
        {
        position += Vector3.right * speed;
        }
    }
    private void FixedUpdate()
    {
        rb.linearVelocity = position.normalized * speed;
    }
}
