Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tower Defence Game

A simple tower defense game built with Unity. This repository contains the Unity project, gameplay scripts, scenes, and assets used to prototype tower placement, wave-based enemy spawning, and projectile attacks.

Features

  • Buildable nodes with hover material and position offsets (Scripts/Node.cs)
  • Turret placement and firing projectiles (Scripts/Arrow.cs)
  • Enemy prefabs and wave-based spawning with scaling difficulty (Scripts/EnemySpawner.cs)
  • Enemy movement along waypoints and life handling (Scripts/EnemyMovement.cs)
  • Range indicator toggling for towers (Scripts/ShowRange.cs)
  • Basic materials, sprites, and animator controllers included in the project

Setup / Getting started

  1. Prerequisites

    • Install Unity Hub: https://unity.com/download
    • Install a Unity Editor version compatible with the project (recommended: Unity 2021.3 LTS or later). If you have the project on disk, check ProjectSettings/ProjectVersion.txt for the exact version.
    • Git (for cloning the repository)
  2. Clone the repository

git clone https://github.com/Jamwilltim/Tower-Defence-Game.git
cd Tower-Defence-Game
  1. Open the project in Unity

    • Launch Unity Hub
    • Click Add, select the repository folder you cloned
    • Open the project with the installed Unity Editor version matching the project's ProjectVersion.txt
  2. Open the main scene

    • In the Unity Editor, open Scenes/MainScene.unity
    • Press Play in the Editor to run the scene

Controls and Gameplay

  • Left-click on buildable Nodes to place a turret (if you have enough currency)
  • Towers will target enemies and fire projectiles automatically
  • Enemies follow waypoints and reduce player lives if they reach the end
  • Waves increase in size/difficulty according to the values in Scripts/EnemySpawner.cs

Project structure (high level)

  • Assets/
    • Scenes/ - Unity scenes (MainScene.unity)
    • Scripts/ - C# scripts (Node.cs, EnemySpawner.cs, EnemyMovement.cs, Arrow.cs, ShowRange.cs, etc.)
    • Prefabs/ - Prefabs for turrets, hover blocks, etc.
    • Sprites/ - Sprite sheets and animation controllers
    • Materials/ - Material assets (ground.mat)

Common configuration values

  • EnemySpawner contains configuration you can tune in the Inspector or directly in the script:
    • baseEnemies
    • startCountdown
    • enemiesPerSecond
    • timeBetweenWaves
    • difficultyScalingFactor
    • enemiesPerSecondCap

Troubleshooting

  • Missing or mismatched Unity version: If the Editor reports an incompatible version, install the matching Editor via Unity Hub or use the closest LTS release.
  • Missing packages: Open Window > Package Manager and add any required packages listed in Packages/manifest.json.
  • NullReferenceException or missing references: Inspect the GameObjects in the scene and verify required components (e.g., sprite renderers, references to prefabs, spawn points) are assigned in the Inspector.

About

A 2D/3D tower defence game built in Unity, for a group programming project

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages