top of page

The Making Of Tank Arena

Updated: Mar 10

 

Introduction

If you have not played Tank Arena download it for free from the games section of this website, the game is a 2D wave shooter in which you much destroy as many enemy tanks as possible to beat your high score, however, there are no health refills so once you take damage you keep it.

 

The Design


Tank Arena has a relatively simple design, it is a wave-spawning game in which the player must destroy as many enemy tanks as possible to earn points and beat their or a friend's high score. It's designed to be played by a single player who will have to overcome wave after wave of enemy tanks that will damage and eventually destroy the player, which creates a loop or cycle of gameplay with the player being able to play another game of quite at the end of the round.


Visual graph of the games overall design

 

The Game Build


Unity game engine was used to build and develop the game, the game consisted of one scene with a predetermined starting location for the player (Indicated by the tank sprite).

Here you can see how the scene and project have been setup and organised overall

The 2D game assets were all developed using Adobe Photoshop then imported into Unity. This sprite sheet was then divided up into the relevant sections needed for the individual graphics as shown in the image below.

This image shows the completed sprite sheet develop in Adobe Photoshop

 

Scripts


The game has around 11 scripts in total each controlling an individual aspect of the game whilst communicating or holding data for each other. In this section, I will explain how a few of these scripts work.


All scripts included in the game

Camera Script


The camera controller script makes use of mathf.smoothDamp. This allows the camera to change its direction gradually over time creating a drag effect, the target location is the player position in this case, which is continuously updating using the void FixedUpdate method.

 

Effects script


The Effects script controls how long the explosion mark sprite remains in the game space before being deleted. The script uses a simple if statement to calculate the amount of time remaining. The script also fades out the explosion mark using the object's alpha channel as shown in the image on the left.


 

Explosion Effect Script


This script makes use of the Destroy method which can either be used to destroy a particular object instantly or be used with a float value that acts as a countdown timer before the method is called. Note that because this is a prefabricated game object, the keywords are used "This.gameObject" to ensure that it destroys this instance of the explosion effect in the scene.

 

Game Manager


The game manager script controls aspects of gameplay that relate to the stopping and starting of the game as well as keeping track and storing any changes to the high score. This script also controls the loading of menus such as start and quit game menus. The script makes use of Unity game engines playerprefs which help create external files for storage of high scores.

 

Enemy Tank


Enemy tanks line of sight and radius behavior guide

The enemy tank script works based on a line of sight. The tank itself consists of two main parts, the tank turret and the tank shell. The tank turret tracks the player's position as soon as it is spawned into the scene, hence the turrets will always be looking towards the player. The movement of the tank is controlled by the tank shell, this works by detecting if the player is within a certain range. Depending on the range the enemy tank will either move towards the player who may be about the leave the enemy attack range or move away from the player if they get to close to the enemy tank. If the player is able to hide behind one of the blocks in the game then the enemy tank will no longer have a positive line of sight on the player and therefore will stop moving and stop firing. The script makes use of raycasting to achieve some of the effects.

 

The Player Controller


The tank controller has two parts similar to the enemy tanks. the turret game object tracks the mouse position, which is then converted into a screen point using Camera.WorldToScreenPoint. The tank body or shell makes use of the horizontal and vertical input keys to control and rotate towards the direction of movement.

 


261 views0 comments

Recent Posts

See All
bottom of page