So I know this is a mega newbie question, but I am trying to use an angle and hypotenuse to calculate the delta x and y.
Diagram:
The blue dot is a point that I already know, the 5 is a constant, and I know the angle theta. I just need to get dx and dy. My LWJGL is setup so that y 0 is at the top. The player’s position is a vector2f, and I just need to add the that vector.
My code so far:
float speed = Launcher.getSpeed();
float angle = getAngle(player.x, player.y);
if(Input.isKeyDown(Keyboard.KEY_W)){
float dx = speed * (float) Math.sin(Math.toRadians(angle));
float dy = speed * (float) Math.cos(Math.toRadians(angle));
player.x -= dx;
player.y -= dy;
}
Again, sorry for such a newbie question!
CopyableCougar4