I was wondering how i could simulate tank like movement.
What i was planing on doing is changing the rotation using left and right keys (Already using a library for input) then moving the tank with both the up and down keys. Usually movements pretty easy as in if the right button is pressed then increase the x coord but i wouldnt know how to do that with rotation. Sorry, its kind of hard for me to explain.
Tank heading += TurningRate * LeftKeyPressed
Tank heading -= TurningRate * RightKeyPressed
Tank X Position += cos(Tank heading) + MovementRate * FwdKeyPressed
Tank X Position -= cos(Tank heading) + MovementRate * AftKeyPressed
Tank Y Position += sin(Tank heading) + MovementRate * FwdKeyPressed
Tank Y Position -= sin(Tank heading) + MovementRate * AftKeyPressed
Well for converting from deg to rad I would use a name instead of the actual number or an inlined function might be even better. It also seems everything is a global variable, why not make a class call it, vec2 use that for position instead, then make a class for tank or entity to hold the position etc...
It's a simple mathematical equation you learn in highschool. 0.017blahblah is just PI / 180. It really is simple when you think about it. 2PI is a complete circle in degrees it is 360, so 2PI/360 is rad per degree (can be simplified to PI/180) that multiplied by any degree will get you the radians, which is what all the mathematical functions use.
Why start a bad habit ? Save it now by removing all the globals before it's too late.