using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float moveSpeed; public float dashRange; public Rigidbody2D rb; public Camera cam; Vector2 movement; Vector2 mousePos; void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); mousePos = cam.ScreenToWorldPoint(Input.mousePosition); if (Input.GetKeyDown(KeyCode.Space)) { } } void FixedUpdate() { rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime); Vector2 lookDir = mousePos - rb.position; float angle = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg - 90f; rb.rotation = angle; } this is my current player movement still learning alot but its a simple 2d triangle sprite that i can move around while it points at the mouse and i can shoot projectiles, trying to make a dash when pressing space, either towards the mouse position or even in the last move direction, but having a hard time figuring it out any help would be greatly appreciated
sorry not sure what you mean by use code tags.. im new to coding and forums in general xD thank you for the response though ill try to get it working using the video