I am making a simple 2d arcade shooter game and am attempting to have the enemy sprites move in circular patterns.
The enemy's position on the screen is controlled by the two variables: iCurrentScreenX and iCurrentScreenY which are updated and then passed into a separate drawing function.
The issue I have is I can't seem to figure out how have the enemies move in a circular path without them just flying off in random directions. I have found the following formula and attempted to implement it but to no avail:
m_iCurrentScreenX = x_centre + (radius * cos(theta * (M_PI / 180)));
m_iCurrentScreenY = y_centre + (radius * sin(theta * (M_PI / 180)));
I guess my main question is, if you wanted the enemies to move in a circular pattern, what exactly would be the x and y centres, and what exactly would the theta be? (Say for instance I only wanted to use a radius of 32px). And is this formula even correct in the first place?
Each enemy is a 16x16 sprite moving along a 320x500 screen.