Homework # 2 (Due Date: Saturday November 25 by Midnight)

Submit your homework via E-learning

name your code file Section#_StudentID_FirstName.cpp

Download the framework code Hw2.cpp and add your code there.

In this homework, you are asked to slightly modify the maze game homework of fall 2016

  1. The drawing domain is set in 3D as follows: glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);
  2. When the game starts, there will be two boxes: red (player) and green (target) that set on top of a grey floor.
  3. A box is represented by start position (posStart which is always (0, 0, 0) in our homework), destenation position (posDest), 3 lengths in x, y and z dimensions (xLength, yLength, and zLength) and a color.
    motionDir gives the direction vector that the box need to travel along when moving from its start to destination position.
  4. Pressing 'w' or 'z' rotates the scene around the x axis and pressing 'a' or 'd' rotates the scene around the y axis
  5. Pressing right arrow moves player along +X
    Pressing left arrow moves player along -X
    Pressing down arrow moves player along +Z
    Pressing up arrow moves player along -Z
  6. The maze is built in buildMaze function.
  7. [TODO] Pressing 'p' or 'P' once adds a new wall that appears at (0, 0, 0) and slowly moves towards its destination position. The wall stops when it reaches it destination position.
  8. [TODO] The target box randomaly changes position every 5 seconds. However, the target box should not be placed so that it intersects with any wall or outside the floor boundaries.
  9. [TODO] Times is shown at the top left of the screen.
  10. [TODO] When the player hits the target box you win and the game is over.
  11. [TODO] Pressing 'r' or 'R' resets the game.