The use of a type is most possibly the best way to do it,
but maybe having instead of having .speedx and speedy you could use .angle in degrees since:
x = x + sin(angle / 57)
y = y + cos(angle / 57)
I think that perhaps you'll have to subtract 90 degress
from the angle, but testing will show if you need to do so in order to make certain that 0 is straight up.
The reason you divide in 57 is that you have to convert degress into radians, and 57 usable, although it's very aprox. If you want a closer value you can easily calculate
the value by doing 360 / (2 * pi).
Woopsie, this may be a little off the topic, but it's very usefull for a Shoot'm'up game.




Reply With Quote