Tardy – My First Original Game!

The Game

Inspired by a game that our teacher showed us in class, Tardy places you in a scenario where you’re running late for class, and your teacher has found out. After chilling in the cafeteria, you realize that you’re late for class. At that instant, the principal appears and sees you. Next, you must then run around the cafeteria, trying to avoid getting caught by the principal. He eventually gets tired and calls for help. Stay alive as long as you can!

Mechanics

Tardy starts with you alone in the cafeteria, with only tables blocking your way. However, as time passes, other students trickle into the room with you. Eventually, a principal catches wind of your tardiness and try to run around catching you. The first principal, who uses the A* search algorithm to find you, avoids tables. However, another principal who comes in later uses the Greedy search algorithm and can hop over tables to get to you.

To create this project, I combined a variety of skills that we have learned this year. At the most basic level are the graphics, I used the StdDraw library as I have in the past. Creating a GUI for a grid is very simple - drawing row and column lines on a blank canvas. Then, I painted the sprites (graphics) within that grid. Finally, I erased and repainted the grid and sprites every time the screen refreshed.

I kept track of a list of CellOccupants (people) in the grid (the cafeteria) by using a simple ArrayList. Then, the program runs through this list and call the move() method for each time the screen refreshes. For the monsters (people that move based on the player’s location, a.k.a. principals), I simply used the A* and Greedy search algorithms I created in our previous project. Finally, I added other students who move randomly in the cafeteria (actually, they also use the A* algorithm to move to random points in the cafeteria).


Comments

Popular updates

Braitenberg Vehicles – v1.0

Machine Learning & Half Moon Project

Guessing Game – v1.0