Chris Pollett > Old Classes > PIC197 ( Print View ) Enrollment info Course Info:
Homework Assignments: Practice Exams: PIC: |
HW#3 --- last modified January 15 2019 16:35:19..Due date: May 15, 8:30pm ========= Files to be submitted: p197hw3file1.zip -- zip file of your project and sources ====================== HW3 Purpose: To familiarize yourself with the A* algorithm for creature path ============ searching with obstacles and collision detection. Specification: ============== For this homework you will create the following pseudogame: There is a player (the image of which you can make however you want). It is controlled by the arrow keys. When it slides off the screen on one side it wraps to the other side. There is also a monster (again whatever family-friendly viewing monster image you desire). It uses the A* algorithm to try to chase the player. Finally, there are also obstacles which are randomly added to the screen whenever F1 is hit. Neither the player nor monster can move through an obstacle. When the player and the monster collide they both change colors. Finally, the space key toggles between chase mode and chased mode. In chased mode the monster tries to distance itself as much as possible from the player. The boundary of the player, monster, and obstacles should be approximated by some kind of polygon and it is these polygons that are used to check for object collision and in the A* algorithm. To keep things simple you probably can modify the code for CObject from Demo 4 in the book to also store a polygon. You probably want to extend CObject for the monster with a class like CIntelligentMonster where move makes use of the A* algorithm (look at Demo 6 for inspiration on extending CObject). The obstacles should be reasonably large and not convex (maybe shaped like a really large C). Point Breakdown for HW3 ======================= Documentation...........................1pt Player controls work and wrap works.....1pt F1 key generates a new obstacle.........1pt Monster appears and does something......1pt player and monster can't go through obstacles.............................1pt When player and monster collide colors change................................1pt A* algorithm functions and used by monster...........................3pts space toggles between space modes.......1pt Total..................................10pts |