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.
 
 
 
 

41 lines
922 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float walkSpeed;
private Vector2 receivedInput;
// Start is called before the first frame update
void Start()
{
}
public void SetMovement(Vector2 input)
{
receivedInput = input;
}
public void UpdatePosition()
{
float RunnerX, RunnerZ;
RunnerZ = Input.GetAxisRaw("Vertical");
RunnerX = Input.GetAxisRaw("Horizontal");
//float rotateTo = RotateRunner(RunnerX, RunnerZ);
RunnerZ = Input.GetAxis("Vertical") * Time.deltaTime * walkSpeed;
RunnerX = Input.GetAxis("Horizontal") * Time.deltaTime * walkSpeed;
transform.Translate(RunnerX, 0, RunnerZ);
}
// Update is called once per frame
void Update()
{
UpdatePosition();
}
}