Devlog #01 - New Input Manager


Introduction:

For the first day of the devlog, I'm adding Unity's new input manager to the game and making basic movements for the placeholder player component. The goal is to create a good functioning player movement system, so that players can zoom around in the battle arena.

Why the new Input Manager over Legacy Input System?

The new Input manager creates an asset that handles all the needed bindings, so we could just focus on adding the logic to it. Using the asset, we could generate a C# script using Unity that handles the player's movements. This also makes it easier to add controller binds into the game effortlessly, as shown in the image below.

new Input Manager
New Input Manager
 

Script to implement the bindings to the player model:

The GameInput.cs is used to apply the movement done using the key binds pressed to the player placeholder model, and also further changes would be made here to add other essential movements like dashing.

This script is done in GameInput.cs
 

We normalize the input vector before returning it to make sure the player moves the same unit distance when multiple directions are given, and hence have the same speed on both straights and diagonals

So What's next?

As per the plan, the next step is to implement dashing mechanics, so the player has some form of way to avoid attacks, and further down the line, shooting mechanics will be implemented.

References:

[1] Unity inputs System (version 1.5.1) - Actions: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.5/manual/Actions.html#...

[2] Vector2.normalized : https://docs.unity3d.com/ScriptReference/Vector2-normalized.html

Leave a comment

Log in with itch.io to leave a comment.