itch.io Spring Selects Series A
On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Unity has some InputSystem for Character Movement. you want to walk on a 2D plane, so I recommend you following movement:

Try to use the GetAxis.y-Type. You can look for it in the scripting-Documentation in Unity or in one of those endless youtube-vids^^

I think this is the right type. I dunno, I havent worked so much on the UnityInputSystem, but I've worked on some FPS-Controller, and this System was very useful. You can make it like this:

You get the axis you want the character to move, then place the trigger permanent on the axis. (i.e. like you pressed the 'd'-button permanently on the keyboard if you want to go to the right^^). Then, you can add some mechanics to achieve some boost over time by adding Time.deltaTime to the Speed-Value. So you make this like this (script provided)

Maybe its not so efficient, especially its written in the Update-function, but you can build upon this and look what works better for you^^ To build the gravity-mechanic, you can put a trigger on the spacebar or so.

You can achieve this with the "Input.GetButtonDown(KeyCode.Space)"-method.

I hove I could help you^^

private float speed;
private void Update()
{
    float charMove = Input.GetAxis("Horizontal") * speed; //or vertical, you'll have to try it out. This gives you the Axis to move.
    float charBoost = charMove * Time.deltaTime; //to give the Character the Boost over Time.
    transform.Translate(charBoost, 0f, 0f); //The Movement-Magic^^
}

Wow thank you so much. I was struggling with increasing speed over time with my script. This code should really help me tackle that. I'll try it for sure and let you know ! <3

(+1)

I've forgotten to mention that this script would let your Character go to both sides, left and right. If you dont want to do this, then you can clamp the values to one specific Outcome. Or you let the Input away and use a specific value like the Speed. Like the way you want the Character to move^^

Got it, thanks! Also, do you know how to remove the 'trial version' watermark? Im not using any cracked version and im not in China, Taiwan or HongKong.