I am making platformer controls and want mechanics similar to Celeste, but the way my player movement works (at least horizontally) restricts my ability to do this. This is because I am making the velocity.x = speed * input_axis (input_axis being for left and right) in the process function, and this means that when I’m not pressing any buttons, the velocity.x is always = 0, and when I’m moving its always equal to whatever my speed is. The reason this is an issue for me right now is because I’m trying to make a wall jump and when I try to launch the player back horizontally from the wall it barely works because it instantly just sets the velocity back to 0. In previous versions of this game I got around this for a dash ability by just changing the speed, but that has its own issues and I want to figure out a better way to handle player movement that allows changes like this.
How about not using the input_axis directly, but using it to set a flag indicating direction of movement. The advantage here is then you can overwrite the direction of movement yourself at any time in script, just like you did previously.
Also, you might want both touch controls, joypad and keyboard controls. There is not an input_axis for keyboard, but you can now not worry about the script, as you will just be overwriting the same direction of movement flags, just in a different way.
I’ve used if statements to check for a maximum velocity, and used velocity.x += speed * input_axis. I also put some code to reduce the velocity every frame.
That way the character had some acceleration, rather than a on/off for direction. And I can adjust each item to have the movement feel correct.