Player
To place a ship down, the game checks if the tile is placeable or walkable. Then, if you have enough gold, you can place a ship.
A simple tower defense game I made to learn more about pathfinding algorithms. The player places ships down to defeat enemy ships. If the enemy ships attack your main ship when you have no more gold, the game ends.
To place a ship down, the game checks if the tile is placeable or walkable. Then, if you have enough gold, you can place a ship.
The enemies follow a path from a start point to an end point, which are manually set. If the enemy reaches the main ship, it will take some gold away. Instead of destroying the game object of the enemy ships, I am using an object pool. This takes the prefab of the enemy ship and sets active true, when "destroyed" it sets active false. This helps the game preform better if I wanted to expand the world or the number of ships that spawn.
I'm using the breadth first search algorithm to create the path the enemies will take. I used this algorithm because it is a good foundation to any pathfinding algorithm, and if I want to expand, I can build off what I have now.