21 lines
449 B
C#
Raw Normal View History

2018-11-12 22:15:14 +01:00
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;
}
}