I'm making a breakout game where when the ball hits the paddle, the angle changes based on where it hits. I'm using the speedx = cos(angle)*velocity and speedy=sin(angle)*velocity formulas. The problem is that what gets returned is a fraction, and trying to move an object around the canvas in fractional increments doesn't work. Anything i'm missing or any tips?
Austen520 wrote:well i am storing the speeds as floating points. I can't cast them to (int) because then they would lose the information after the decimal right?
The float data will still exist in the original variable. So you could cast it as an int while adding it to the position into and still have the original speed maintained. You could also just keep track of the position as a float and cast to an into for drawing.