using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5.0f;
public Rigidbody2D rb;
public Weapon weapon;
Vector2 mousePosition;
void Update()
{
// Get input from the horizontal and vertical axes
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
if (Input.GetMouseButtonDown(0))
{
weapon.Fire();
}
// Create a new vector to store the player's movement
Vector3 movement = new Vector3(horizontal, vertical, 0);
// Move the player by the given speed in the direction of the movement vector
transform.position += movement * speed * Time.deltaTime;
}
}