I have a radar in my game. Right now the radar works using a static X,Y graph that does not rotate based on how you are facing in my game.

I want the X, Y positions on the radar to rotate based on the direction you are facing. Monsters in the front of you will always appear at the top of the radar.

Right now, the radar is static and monsters north of you will always appear north on the radar.

Currently, I have math like this:

int x = (int)(x * Math.Cos(Math.PI * angle / 180) + y * Math.Sin(Math.PI * angle / 180));
int y = (int)(y * Math.Cos(Math.PI * angle / 180) - x * Math.Sin(Math.PI * angle / 180));

Then I add the center X and center Y to the integers above, but the graph is weird and only seems to work from 359~ degree angle. I have tried adding my center X and center Y before calculating it, but it is always off.

Other code I found online differentiated based on the degrees/angle.

if (angle >= 0 && angle <= 180)
{
x = (int)(x * Math.Cos(Math.PI * angle / 180) - y * Math.Sin(Math.PI * angle / 180));
y = (int)(x * Math.Sin(Math.PI * angle / 180) + y * Math.Cos(Math.PI * angle / 180));
}
else
{
x = (int)(x * Math.Cos(Math.PI * angle / 180) - y * Math.Sin(Math.PI * angle / 180));
y = (int)(x * Math.Sin(Math.PI * angle / 180) + y * Math.Cos(Math.PI * angle / 180));
}

What is the correct formula I need to take the Center X(cX), center Y(cY), the angle I am facing and the target X(tX), target Y(tY) to relocate the targets X & Y.