Over the past few months, I have rewritten the character controller for my Super Space Trooper video game three times. Each time I rewrite it, the controls end up better, the code cleaner, and more manageable. Today I added in the acceleration and braking functions for the player.
The acceleration function shoots the player forward over a 1-second span then has them slow to return where they started. Initially I had this plus the camera would follow at an accelerated pace. That didn’t work out, however, as the enemy animation sequences wouldn’t be all that appropriate if they player was already way ahead of them. The same was true for the brakes. Enemies would end up flying way too far forward for the player to be able to hit them with their weapons. So I removed the camera acceleration and braking and just have it on the player’s ship. That way the speed is constant and enemy animations are in sync.
I also bought some more sound effects from Audio Jungle to use for the acceleration sound effect and the braking sounds effects. The character controller is coming along quite nicely now and there’s only a few minor tweaks (though I’m sure I’ll be pulling my hair out) that need to be done.