Hi darkness, thank you for ur elaborated explanation. I really think your suggestion is good.
Code:
// will be using a shrunken rect to represent round ball
Ball
-shrunkenX:double // coord of top left corner of shrunken rect
-shrunkenY:double // in pixel
-x: double // coord of ball
-y:double
-x_vector:double // vector of ball movement
-y_vector:double
This time i will keep two double attribute x_vector and y_vector instead of angle. Each time i need to update the position of the ball. I simply do a
Code:
x +=x_vector;
y +=y_vector;
i can also change the magnitude of the vector to determine the speed of the ball.
Reflection is a matter of change the sign of x_vector and y_vector as you mentioned.
Now i can start coding the actual game. Once again, thanks!