Here’s a (big) GIF of me holding down the “TURN” key and “FORWARD” key together, and below is the code:
public void draw() {
GL11.glColor3f(0f, 1f, 1f);
GL11.glBegin(GL11.GL_LINE_LOOP);
{
GL11.glPushMatrix();
GL11.glTranslatef(-x, -y, 0f);
GL11.glRotatef(angle, 0, 0, 1f);
GL11.glVertex2f(x, (y - 10));
GL11.glVertex2f((x + 8), (y + 10));
GL11.glVertex2f(x, (y + 5));
GL11.glVertex2f((x - 8), (y + 10));
GL11.glVertex2f(x, (y - 10));
GL11.glTranslatef(x, y, 0f);
GL11.glPopMatrix();
}
GL11.glEnd();
GL11.glColor3f(1f, 1f, 1f);
}
I don’t know how to rotate the “ship” around the Z axis.
EDIT: Forgot to mention that I did tried many different combinations of “glTranslate()” and “glRotate()” in different spots in the draw() code. They either skew the ship’s vertices around, or they don’t do anything. And I’m getting all confused as to why.