Homework # 2 (Due Date: Thursday November 24 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.
We are going to build a simple maze game where a player is asked to find his way through the maze to get to the exit.
- The drawing domain is set in 3D as follows:
glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);
- A box is represented by its center point (pos), 3 lengths in x, y and z dimensions (xLength, yLength, and zLength) and a color
For example: Box flr(Position(0, 0, 0), 7, 0.05, 6, Color(0.2, 0.2, 0.2));
creates the floor box centered at (0, 0, 0), 7 units in x dimesnion, 0.05 units in y and 6 in z, and dark gray color (0.2, 0.2, 0.2)
- Pressing 'w' or 'z' rotates the scene around the x axis and pressing 'a' or 'd' rotates the scene around the y axis
- [TODO] Inside the function buildMaze, create boxes to represent the maze walls and add them to vecWalls vector
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
As you attempt to move the player you have to check that there is no collision between the player and any of the maze walls. If there is no collision proceed with moving the player, otherwise the player can not move.
To check for collision, use bool Box::Intersection (const& Box other) const;. The function returns true if there is inersection between two boxes.
- [TODO] When the player reaches the winning box you won and the game is over