Project Overview

A strategic 2D shooter featuring grid-based movement, intelligent AI enemies, and collectible power-ups. This Unity 2D game showcases advanced movement systems, enemy AI pathfinding, and tactical combat mechanics with precise positioning and timing.

The project demonstrates proficiency in Unity's 2D physics system, coroutine-based movement, collision detection, and game state management. Players navigate through tile-based levels, strategically positioning themselves to defeat enemies while collecting coins and power-ups.

Key Features

Grid-Based Movement

Precise tile-based character movement using coroutines for smooth animations and responsive controls.

AI Enemy System

Intelligent enemy behavior with target tracking, pathfinding, and dynamic movement patterns.

Combat & Shooting Mechanics

Strategic combat system with precise aiming, projectile physics, and tactical positioning gameplay.

Collectible System

Coin collection mechanics with visual feedback and progression tracking through CoinManager singleton.

Scene Management

Seamless level transitions and game state management with custom SceneLoader implementation.

Physics-Based Collision

Precise collision detection using Unity's Physics2D system for responsive gameplay interactions.

Technical Implementation

Built using Unity's 2D framework with custom C# scripts implementing tactical shooter mechanics through modern game development patterns.

Core Systems:

  • Unity 2D Physics - Collision detection and trigger-based interactions
  • Coroutine Movement - Smooth grid-based character animation
  • Singleton Pattern - Global game state management (CoinManager, GameManager)
  • Component Architecture - Modular script design for maintainable code
  • Animation System - Unity Animator integration for character states

Player Movement System:

Player Input System C# Script
// Grid-based movement with collision checking private void Update() { if (!isMoving) { input.x = Input.GetAxisRaw("Horizontal"); input.y = Input.GetAxisRaw("Vertical"); if (input != Vector2.zero) { animator.SetFloat("moveX", input.x); animator.SetFloat("moveY", input.y); var targetPos = transform.position; targetPos.x += input.x; targetPos.y += input.y; if (IsWalkable(targetPos)) StartCoroutine(Move(targetPos)); } } animator.SetBool("isMoving", isMoving); }

Game Mechanics

Movement & Navigation:

The game implements precise grid-based movement using Unity's coroutine system. Characters move smoothly between grid positions while maintaining tactical shooter precision and responsiveness.

Movement Coroutine Implementation
// Smooth coroutine-based movement IEnumerator Move(Vector3 targetPos) { isMoving = true; while ((targetPos - transform.position).sqrMagnitude > Mathf.Epsilon) { transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed * Time.deltaTime); yield return null; } transform.position = targetPos; isMoving = false; }

AI Enemy Behavior:

Enemies use target-based AI with collision avoidance and dynamic pathfinding:

Enemy Controller Update Method
// Enemy AI target tracking private void Update() { if (target != null) { Vector2 targetDirection = (target.position - transform.position).normalized; animator.SetFloat("moveX", targetDirection.x); animator.SetFloat("moveY", targetDirection.y); animator.SetBool("isMoving", targetDirection.magnitude > 0.1); MoveTowardsTarget(targetDirection); } }

Collision & Interaction System:

The game uses Unity's Physics2D system for precise collision detection:

Collision Detection Method
// Collision detection for walkable areas private bool IsWalkable(Vector3 targetPos) { if (Physics2D.OverlapCircle(targetPos, 0.2f, solidObjectLayer) != null) { return false; } return true; } // Player-Enemy collision handling private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { GameManager.isGameOver = true; } }

System Architecture

Singleton Management:

The game uses singleton patterns for global state management:

CoinManager Singleton Implementation
// CoinManager singleton implementation public class CoinManager : MonoBehaviour { public static CoinManager instance; public int MaxCoins = 8; private int coins; [SerializeField] private TMP_Text coinsDisplay; private void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); } public void ChangeCoins(int amount) { Coins += amount; if (Coins >= MaxCoins) { GameOver("You Collected all the coins"); } } }

Scene Management:

Custom scene loading system for seamless level transitions:

Scene Loader Class
// Scene transition system public class SceneLoader : MonoBehaviour { public GameObject currentCanvas; public void LoadNextScene(int sceneNumber) { SceneManager.LoadScene(sceneNumber); } public void toggleCanvas(GameObject nextCanvas) { nextCanvas.SetActive(true); currentCanvas.SetActive(false); currentCanvas = nextCanvas; } }

Development Challenges & Solutions

Grid-Based Movement Precision:

Challenge: Ensuring characters snap perfectly to grid positions while maintaining smooth movement.

Solution: Implemented coroutine-based movement with Vector3.MoveTowards for frame-rate independent smooth transitions and precise endpoint positioning.

AI Pathfinding:

Challenge: Creating intelligent enemy movement that feels challenging but fair.

Solution: Developed target-tracking AI with collision avoidance using Physics2D.OverlapCircle for obstacle detection and normalized vector calculations for smooth directional movement.

State Management:

Challenge: Managing game state across multiple scenes and components.

Solution: Implemented singleton pattern for global managers (CoinManager, GameManager) with DontDestroyOnLoad to persist data between scenes.

Technical Highlights

Coin Collection System:

Dynamic coin spawning and collection with real-time UI updates:

Coin Collection Implementation
// Coin collection trigger private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player") && !hasTriggered) { hasTriggered = true; CoinManager.instance.ChangeCoins(value); Destroy(gameObject); } } // Coin spawning system public class CoinSpawner : MonoBehaviour { public GameObject coinPrefab; private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Vector3 randomPosition = new Vector3(Random.Range(-1, 1), Random.Range(-1, 1), 0); Instantiate(coinPrefab, randomPosition, Quaternion.identity); } } }

Player Trigger System:

Collision detection for game events and interactions:

Player Trigger System

Animation Integration:

Seamless integration with Unity's Animator system for character states and movement feedback.

Physics-Based Interactions:

Efficient use of Unity's 2D physics system for collision detection, trigger events, and spatial queries.

Future Enhancements

Planned improvements and additional features for continued development:

  • Weapon System - Multiple weapon types with different firing patterns and damage values
  • Power-Up System - Speed boosts, weapon upgrades, and temporary abilities
  • Multiple Levels - Progressive difficulty with unique level layouts and enemy patterns
  • Sound System - Audio feedback for shooting, movement, and ambient music
  • Multiplayer Mode - Local multiplayer support for competitive gameplay
  • High Score System - Player progression tracking and leaderboards