Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Roll in 2D game

Discussion in 'Scripting' started by KadzitsuCross, Sep 26, 2020.

  1. KadzitsuCross

    KadzitsuCross

    Joined:
    Sep 26, 2020
    Posts:
    10
    Hello, I am making a 2D souls-like using this code: https://github.com/Bardent/Platformer-Tutorial Does anyone know how to make it so that when you double-click on the walk key, the player makes a roll (a quick dash to the side he is looking with the ability to slip through the enemy)?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,779
    I imagine a souls-like roll sequence would involve the following elements:

    - disable input to the player
    - initiate the roll sequence:
    ----- turn off colliders that would normally cause damage (or otherwise suppress damage)
    ----- don't turn off colliders that keep you from going through walls or the floor however!
    ----- start an animation in the direction of intended roll
    - finish the roll sequence:
    ----- re-enable damage / colliders
    ----- re-enable input

    You might want to start with those one at a time:

    - get a short dash/roll going
    - disable input during that roll
    - disable damage during that roll
     
  3. KadzitsuCross

    KadzitsuCross

    Joined:
    Sep 26, 2020
    Posts:
    10
    Тhank you