Files
DropToTheRoots/Game/Assets/Scripts/DropletMovement.cs
T

29 lines
613 B
C#

using UnityEngine;
public class DropletMovement : MonoBehaviour
{
public float moveSpeed = 5f;
private Rigidbody2D rb;
private Vector2 movement;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
private void FixedUpdate()
{
rb.linearVelocity = movement.normalized * moveSpeed;
}
}