35 lines
862 B
C#
35 lines
862 B
C#
using UnityEngine;
|
|
|
|
public class DropletMovement : MonoBehaviour
|
|
{
|
|
private Rigidbody2D rb;
|
|
public float moveSpeed = 5f;
|
|
private Vector2 movement;
|
|
private Animator playerAnim; //for animation
|
|
private float xInput;
|
|
|
|
//helper variables
|
|
private bool isGrounded;
|
|
[SerializeField] private float dashSpeed;
|
|
[SerializeField] private float dashDuration;
|
|
private float dashTime;
|
|
|
|
// 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;
|
|
}
|
|
}
|