Skip to content

jonathanwang0111/GemInTheRough

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GemInTheRough

A Gem in the Rough is essentially a highlight of some of the code I wrote previously for a separate unfinished game. The main point of this repo is to showcase some of the code I've written in Unity. The goal of the game is to get the fox to the gem on the other side of the map. There are cherries along the way that act as checkpoints, and all the while the fox is being chased down by an eagle. The artwork comes from the free Sunnyland Unity Package.

Here is a list of what I worked on:

  • Player Movement - The fox can go right and left by using the right and left arrow keys. The fox can jump using the space bar. In order to jump, the fox must be on the ground or against the wall (wall jump). The fox has an infinite number of wall jumps, but only one grounded jump at a time. As the fox goes down the wall, it slides at a slower fall speed. Sadly, since there were no animations available for wall slides, I couldn't make it look particularly pretty.
  • Enemy AI - The enemy AI system is built on the A* pathfinding algorithm. I have put a graph of nodes on the map dictating where the eagle can fly to. These nodes are tagged with a GraphNode tag and the graph is initialized on startup of the scene. Every time the player gets to a new closest node, the path is recalculated. At first, the eagle is in patrol mode (flipping looking right or left). Once the player enters into its vision cone, it goes into the aggressive state in which it uses the A* algorithm to chase down the player. If the player is sufficiently far, it goes back into patrol mode. If the player is caught by the eagle (touches a collider), the scene will fade and the player will get back to its last saved checkpoint and the eagle will be at its starting position.
  • Checkpoint System - Checkpoints come in the form of cherries. Once the player touchesa cherry, it disappears and a checkpoint updated message comes up. If the player saves and quits or is touched by the eagle, then the player will be sent back to its last saved checkpoint. In this scene, there are two checkpoints.
  • The Gem - Once the Gem is touched, the player will see a simple win screen and will be transported back to the title page.
  • Title page and Menu options - The scene that should be run in starting the game should be the Title scene in the Assets/Scenes folder. Press x to confirm choices in menus. After the first title page, there is a list of save slots. Select the one you want to play. The actual game scene will then appear. You can press p to go to a menu screen, where you can either resume or save and quit.
  • Saving - The save file is a binary .data file that stores the last checkpoint the player was at. When the player is saved, the local checkpoint information is saved. When a player wins, the file is deleted.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published