I'm making a 2d game with a bird and want to make it so when you hold up it stays hovering while still being able to move sideways, but I couldn't find a perfect way to do so.
I'm using physics for the movement and tried making it immovable but that stops it from moving sideways, and also disabling physics but that has the same result.
Is there some way that could just have a constant force against the gravity of the player?
You can set its Y velocity to 0, this should stop it from falling.
Develop games in your browser. Powerful, performant & highly capable.
That works, I tried doing something like that but it stops too suddenly, I'm trying to do something that doesn't keep the player stuck in the y axis, just still if there should be some way.
I tried applying force, but it keeps adding up every tick.
Balancing the object in the air with force will be tricky. Setting velocity is the easiest option. You can try lerping it to make it smoother. For example:
On every tick: Set Y Velocity to lerp(self.Physics.VelocityY, 0, dt*2)