Original Post
Hey everybody, I'm currently trying to make an asteroids clone and I'm at the moment trying to create some sort of movement system. I know its movement direction is based on the angle the ship is facing and then when pressing a "thrust" button, the game uses sin(radian) and cos(radian) to get the y and x velocity, respectively. Basically, I'm just looking for the common way of doing this. Here's my dilemma. My ship class's (x,y) values and even its velocity and acceleration variables are set up as integers and I want to keep it that way. BUT, when you take the cos(pi/4) you are going to get a decimal. And if I cast this to my integer velocities, it either converts to 1 or 0. (Because nothing on the unit circle is > 1. SO, I'm thinking... what should I do. I believe I could just multiply whatever I get from my trig calculations by a common value and then apply that value to the velocity but like I've said I'm looking for a common way of doing this. I'm kind of worried that between rotation, particle_systems, and these calculations, I may end up with a considerable performance decrease. I hope this doesn't sound confusing at all. Thanks in Advance for Advice, toXic1337 [EDIT] Not that I think it matters for this is mainly theory, but just in case Using SDL with Dev-C++