2018-11-12 22:19:12 +01:00

21 lines
449 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
float horizontal = 0f;
float vertical = 0f;
void Update()
{
horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxis("Vertical");
}
void FixedUpdate()
{
GetComponent<Rigidbody2D>().velocity = new Vector2(horizontal, vertical) * 5f;
}
}