mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -05:00
21 lines
449 B
C#
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;
|
|
}
|
|
}
|