I'm new at godot engine. I'm trying to make a space shooter game and I've encountered a little problem.
I am moving my ship with that code:
velocity += Vector2(acceleration, 0).rotated(rotation + deg2rad(-90))
I made it so ship moves to where it's pointing and it works pretty fine. However when I'm moving to degrees between 1 and 89, 91 and 179 etc., both velocity.x and velocity.y keep rising until it reaches maxspeed and that results in my ship moving directly 45, 135, 225 or 315 degrees and not where it's pointing.
I want to make it so when for example velocity.x reaches maxspeed, vector.y gets limited to its current value. Is it possible?
Thank you in advance and excuse me for my english