diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-11-29 00:56:49 +0100 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-11-29 00:56:49 +0100 |
commit | a6a7578b864469743261c84c2a5c041bc000dbf7 (patch) | |
tree | 16c5630636ea76bcf56400516664793c2683650a | |
parent | c04d638460e9094cdefcafb9c3f003b138ca35c2 (diff) | |
download | 2iv60-robots-a6a7578b864469743261c84c2a5c041bc000dbf7.tar.gz |
Robot: fix flying stick figure and length calculation
-rw-r--r-- | src/Robot.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Robot.java b/src/Robot.java index ca2622b..c71168c 100644 --- a/src/Robot.java +++ b/src/Robot.java @@ -218,11 +218,16 @@ class Robot extends BetterBase { gl.glTranslatef(0, 0, -legLength / 4); drawBeam(legWidth, legWidth, legLength / 2, Direction.Z, Color.DARK_GRAY); - // draw feet! + // for the stick figure, the "foot" is just an extension of the leg line + // and therefore stays at the same y-position + float foot_y = 0; if (!asStickFigure) { - gl.glTranslatef(0, legWidth / 2, -legLength / 4 - footHeight / 2); - drawBeam(footWidth, footLength, footHeight, Direction.Y, Colors.GRAYISH); + // go to the heel and then move to the center of the foot + foot_y = -legWidth / 2 + footLength / 2; } + // draw foot! + gl.glTranslatef(0, foot_y, -legLength / 4 - footHeight / 2); + drawBeam(footWidth, footLength, footHeight, Direction.Z, Colors.GRAYISH); // Restore position gl.glPopMatrix(); |