Tower defense - Mutants - Dev 2

Something I have never tried before is working with terrain and placing buildings on top of it. The idea is that you can build everywhere on the map as long as the slopes aren't to steep and there is no building already placed.

The Grid. Although you have the freedom of building a tower where ever you want, the underlying system still works with a grid system. That means that gridpoints can be tagged as "can not build". It also leaves space between buildings which is nice because I don't have to check for colliding with other buildings. The grid displays cubes for every 2 meters. Cubes on a steep slope are colored red. All the other cubes are green and therefore enable building.



Building placement I had a little setback when I had this unusual error in C# (see topic). But instead of using a Pick, I now use Camera Project. It doesn't work entirely the way I want it, but in the end it doesn't look bad. You can see a temporary building being displayed in a green or red color (depending whether you can build it on that location, yes or no). Although the building doesn't exactly follow the camera, it is still accurate enough for good gameplay.



Different towers can require more tiles at once. For instance: the most basic tower is a bunker which only takes 1 tiles. However, an other tower (for instance a radar installation) can take 4x4 tiles. Every tower derives from the tower class. A simple multidimensional variable defines which tiles are necessary.

for instance: [ 1, 1, 1 ] [ 1, 0, 0 ] [ 1, 0, 0 ] [ 1, 1, 1 ] This tower has a hollow shape: 1 is used for building, while 0 is still free to build something else.