Jack Webb's profile

3D Bloons TD game prototype

3D Bloons Tower Defense remake game prototype
This game is a side project that I am slowly chipping away at.
I am using this as an opportunity to practice coding and Unity3D skills. My goal is to recreate Ninja Kiwi's Bloons Tower Defense in 3d, allowing the maps to have verticality which could result in cool map ideas, tower ideas, and new game mechanics 

Bloons (enemies)
The Bloons will move along the level, from the start point to the end point, if they reach the end point, the player will lose health. Towers are placed by the player to attack the Bloons in attempt to keep them from reaching the end point for as long as possible. 
The track is the path that the Bloons will follow. The track is a Bezier curve spline, which is made up of multiple Bezier curves attached to each other, which means I can make a 3D line very easily in the Unity editor. 
This code runs every frame, and makes sure that a bloon will stay on the path. It will also destroy the bloon and reduce the player's health if it gets to the end.
The following code makes the bloon take damage after being hit by an allied tower. The amount of damage required to pop a bloon is called armor. If the armor is reduced to 0, the bloon is popped, producing one or more weaker bloons and lowering the bloon's health by 1. After a bloon is popped the leftover damage from the projectile that hit it (if there is any) will be applied to the bloon until there is no leftover damage. 
If a bloon's health reaches 0, it will be destroyed.
The CheckExceptions() method checks to see if the bloon should spawn any additional bloons when it is popped. Any leftover damage is also applied to bloons that are spawned.
This method that changes the size, color, armor, and damage of a bloon. This method is executed both when the bloon is created, and when it takes damage. 
One thing I learned from these scripts is that I shouldn't use FindObjectOfType in the update method as it is very inefficient. 
Tower (monkeys)
The tower will aim and shoot projectiles at bloons in it's radius. Each different type of tower has values such as attack speed (how fast it shoots), damage (the amount of damage each projectile does) pierce (how many bloons one of its projectiles will go through) and a detection radius which allows it to target bloons only within a certain distance.
There are currently 4 types of tower. These are the Dart Monkey, Super Monkey, Sniper Monkey, and Blacksmith Monkey. 
the first 3 operate in a similar way, they will shoot their projectile at a bloon in a spherical collision detector around them. The Dart monkey is a simple monkey with weak stats, the Super Monkey is like the Dart Monkey but has higher damage, pierce, and attack speed. The sniper monkey is a dart monkey with infinite attack range, and high damage. The Blacksmith monkey however can only target bloons directly below it, and will drop anvils that will fall and pop bloons that it hits.
This is the programming that makes the towers shoot the bloons. If a bloon enters a bloon's radius, it will be added to a list of bloons that are in range. The program then scans this list to find the bloon that is furthest forwards on the track. The tower will then rotate towards the bloon and run the shoot() coroutine, which works differently for each tower.
Recent Additions
the following features have been added to the game (as shown in the screenshots below)
- the track is drawn in 3D
- UI has been added to display available hotkeys
-Towers can be placed down by the player
-A red radius circle will appear if the player tries to place the towers too close to each other
-Each tower has a cost as shown in the bottom right UI which is subtracted from the player's cash when placed
-looking at a tower will cause it to be highlighted in a blue color. pressing the Q button while highlighted will bring up a UI that shows the tower's name, the tower's level, how many bloons it has popped, a button which allows the tower to switch between 4 targeting modes (first, last, close and strong). The upgrade button increase the tower's level by 1, which gives more attacking speed, shooting range, and camo bloon detection . the tower can also be sold for half of the original tower cost.

3 new towers were added
- Grenade monkey, slow attacking speed, projectiles explode on impact dealing damage in a large area
-Monk monkey, doesn't throw projectiles, instead attacks bloons with his fists
-Minigun tower, must be mounted by the player, enabling manual shooting and free aim.
Things I expect to add to this game in the future
- 100 waves of bloons prepared for the player to play against
- new types of towers 
- the player can create their own waves of bloons
- animations, better textures


3D Bloons TD game prototype
Published:

3D Bloons TD game prototype

Published:

Creative Fields