- Home /
Question by
oskarhouse463 · Oct 30, 2020 at 06:24 AM ·
topdowndodge
How to implement 2d dodge
i was making a dungeon crawler, i struggle when i want to implement dodging like in enter the gungeon. I want to implement dodge in my movement script with a rigidbody. How do I implemenrt it? public class Movement : MonoBehaviour { public Rigidbody2D rb; public float moveSpeed = 5f; Vector2 movement;
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
}
} `
Comment
Your answer
Follow this Question
Related Questions
dodge roll in mouse direction in a 2D Top down game,Top down dodge roll in mouse direction 0 Answers
Top Down Style Player Position Wrapping 1 Answer
Instantiating a prefab/bullet and sending it to my mouse position?? 0 Answers
2D Rotation for aiming problem 1 Answer
(noob) Weapons in 2D game? 1 Answer