#Implementation of Dash using New Inputs

1 messages · Page 1 of 1 (latest)

limpid nest
#

I'm new to Unity and gamedev in general, trying to make a dash but not sure what would be the ideal approach while using the new Input System.

Current Code doesn't look like much but there is 2 different "main" scripts, One that handles inputs and the actual player script. Should I use and Event() to start the dash or is there a better alternative?

#

I don't think the code is even necessary but better safe then sorry

thorn oyster
#

        void HandleJumpKeyInput()
        {
            bool _newJumpKeyPressedState = IsJumpKeyPressed();

            if (jumpKeyIsPressed == false && _newJumpKeyPressedState == true)
                jumpKeyWasPressed = true;

            if (jumpKeyIsPressed == true && _newJumpKeyPressedState == false)
            {
                jumpKeyWasLetGo = true;
                jumpInputIsLocked = false;
            }

            jumpKeyIsPressed = _newJumpKeyPressedState;
        }

        //Returns 'true' if the player presses the jump key;
        protected virtual bool IsJumpKeyPressed()
        {
            //If no character input script is attached to this object, return;
            if(characterInput == null)
                return false;

            return characterInput.IsJumpKeyPressed();
        }```

the input
#

        public override bool IsJumpKeyPressed()
        {
            return Input.GetKey(jumpKey);
        }
    }```
#

i dont use the input system but this is a character controller i bought from the asset.. it was built before the input system i believe.. but i'll show u how it works..