Toast Defense

Egghead Interactive

Created with Sketch.

Toast Defense is a Tower Defense game where the player is allowed to build the path that enemies travel down. Ducks will travel along the path placed by the player, and will attempt to eat the player’s toast, unless they are shooed away by the water towers placed by the player. Toast Defense is the first game released under Egghead Interactive, and was completed in about 2 months before being released on Nov 22, 2020. This game primarily served as a testing ground for publishing games on Steam, Unity and Steamworks integration, and an opportunity for me to develop comprehensive skills by overseeing every aspect of game development


The framework of “Toast Defense” comprises three main elements:

  • Game Manager: Responsible for enemy spawning, wave count management, financial transactions for tower purchases, and overseeing the game’s settings, including difficulty levels and game modes.
  • Tiles: Function as towers, grass patches, or paths, defining the landscape and gameplay elements.
  • Enemies: Ducks with individual health tracking, logic to follow player-designed paths, and logic to respond to player-built defenses.

Game Manager

The game manager has a lot of responsibilities in this game, as it handles the UI, money, setting the game’s settings to match the difficulty and game mode the player selected, loading Save Data and preset Paths, setting what sprite is active depending on what the player selected if they have the DLC, initializing the tutorial, and handles waves/spawning enemies. While the Game Manager ended up containing about 1.6k lines of code, this structure sufficed for my first game despite its workload.


The tile script, for all intents and purposes, is the other script that controls the game. The Tile Script does different things depending on what “type” the tile is. For instance, if it is a grass tile, it plays the grass swaying animation, if its a dirt path then it determines if it is a straight path, a corner path, etc. and displays the correct sprite. If the tile is a tower, then depending on what tower it is it will aim/shoot differently and keep track if the tower is upgraded and act accordingly.


Enemies utilize a foundational Enemy Script dictating duck movement. It encompasses base functions like recalculating health (as enemy health scales over time), managing single-point or damage-over-time (DOT) attacks, deducting health upon reaching the toast, and responding to tower-based deterrents. Each type of Duck inherits from this class, with each one modifying health, speed, amount of Toast eaten, and its sprites.


There are a lot of ways that this game can be improved upon from a code efficiency standpoint. First and foremost, dividing up the responsibilities of each class, using events instead of every script in the game grabbing a reference to the other important scripts, and making each script more clear and structured so it is easier to read are the biggest problems that need to be addressed first. There are also many smaller parts of the game that can be improved upon, such as how the Path is created/read from. Currently when the player places a path, the Tile is given a tag using Unity’s Tag system and every Enemy upon spawning searches the scene for the path with a tag of 1, then searches the scene for the path with a tag of 2, etc. which is highly inefficient and should be changed, even though the game itself has never run into any reported performance issues due to how small the game itself is, and how little resources it takes to run.

The art and sound for the game should be improved dramatically, but this is not my area of expertise and so most of the focus was on improving the game’s mechanics and code base. The entire game was drawn in MS Paint (which is probably easy to tell) and I created both of the sound effects for the game by recording my best impression of them on my phone. While acknowledging the importance of enhancing art and sound design, substantial improvements here would require considerable time, diverting attention from my main objective in creating these games.