diff options
-rw-r--r-- | src/RobotRace.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java index c7733a3..c4f9aec 100644 --- a/src/RobotRace.java +++ b/src/RobotRace.java @@ -197,7 +197,7 @@ public class RobotRace extends Base { } // Draw the first robot - robots[0].draw(false); + robots[0].draw(gs.showStick); // Draw race track raceTrack.draw(gs.trackNr); @@ -364,7 +364,11 @@ public class RobotRace extends Base { * Draws this robot (as a {@code stickfigure} if specified). */ public void draw(boolean stickFigure) { - if (stickFigure) { + // as the components are drawn with the torso as center, move it up + gl.glPushMatrix(); + gl.glTranslatef(0, 0, torsoHeight / 2 + legLength); + + if (!stickFigure) { // Draw the robot drawTorso(); // Torso drawShoulders(); // Shoulders @@ -375,7 +379,9 @@ public class RobotRace extends Base { // Draw the stick figure drawStickFigure(); } - + + // restore position + gl.glPopMatrix(); } /** |