Evolution prototype V.0.2 Tower
Tower construction (script)
the next part of the game that I worked on was the tower construction mechanic. The way I created this mechanic first was once the player clicked on a certain area with a piece of code attached to it would instantiate at that point a tower.
Basic Tower (script)
I next created a tower scripts which would allow the tower to shoot a projectile at the enemy is through the use of tags. This takes the enemy's information the amount of health and then subtracts one every time a collision with a projectile is met meaning that once the enemy object is hit six times the enemy will self-destruct.
in this script it contains information about the tower such as what projectile the tower will fire at the enemy this is labelled bullets the speed that this bullets will travel at also the fire rate the fire radius and also the cost of this tower as well as the name and it is clear that this tower will start that this is all customisable through the script so that's this can be customised out will the balance out the tower and also when the tower becomes upgraded these variables can be affected through scripts.
Destruction (script)
when the bullets are created through the tower it is an instantiated objects and created a destruction script which would destroy these bullets after a certain amount of time so that these objects would not be floating around in the game.
Money manager (script)
Then I included a UI money manager which was a script that was placed upon the UI which would calculate the amount of resources the player had I then used the variable from the tower and subtracted it from the amounts that the Ui money manager was holding in order to create a money system in which once towers were constructed they would minus a certain amount from the money manager and wants the money manager did not have enough left in order to construct a new tower it would disable the ability to instantiate a tower.
The energy display is the text object which is used to display the amounts of money the player has this can be assigned to any text based game object.
No comments:
Post a Comment