I'm making a 2D space shooter in C++, and have now run into a math problem. I'm sure it's easy, but I'm not very good at math.. =(
Here's the problem, I have a class Bullet(float x, float y, int degree) that other classes create. From the passed position and degree, it should start doing its thing (which is basically just travel along..)
But how do I use theese values? I'm pretty certain I should use sin/cos/tan, but I don't know how. I need a value that could be both positive and negative, and I guess it should be 0 at every 180 degrees so that for example a degree of 0 (up) doesn't affect the algorithm for X, only Y.
Any help is apriciated. |