0% found this document useful (0 votes)
4 views

Final_2D_Platformer_Dev_Project_with_Definitions

The document outlines the development process of a 2D platformer game called 'Shadow Leap' using Unity, covering aspects such as game concept, design, programming, and deployment. It includes C# code examples for player movement, enemy AI, collectibles, and UI management, aimed at postgraduate learners in game development. Additionally, it defines key terms and components used in 2D game development within Unity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Final_2D_Platformer_Dev_Project_with_Definitions

The document outlines the development process of a 2D platformer game called 'Shadow Leap' using Unity, covering aspects such as game concept, design, programming, and deployment. It includes C# code examples for player movement, enemy AI, collectibles, and UI management, aimed at postgraduate learners in game development. Additionally, it defines key terms and components used in 2D game development within Unity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Design and Development of a 2D Platformer Game Using Unity

This document details the full development lifecycle of a 2D platformer game titled 'Shadow
Leap' using Unity. It includes conceptualization, design, programming stages, C# code
examples, testing, and deployment strategies. The content is aimed at postgraduate-level
learners exploring professional game development workflows.

Game Concept and Planning


Define game genre, target audience, and gameplay features.

Create a Game Design Document (GDD) with storyline, levels, and characters.

Unity Project Setup


Create a new Unity 2D project.

Set up folders: Scripts, Scenes, Prefabs, Sprites, Audio.

Player Movement Script


Basic player movement is handled with Unity's physics system using Rigidbody2D.

C# Code Example:
```csharp
public class PlayerMovement : MonoBehaviour {
public float moveSpeed = 5f;
private Rigidbody2D rb;
private Vector2 movement;

void Start() {
rb = GetComponent<Rigidbody2D>();
}

void Update() {
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}

void FixedUpdate() {
rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
}
}
```

Jump and Gravity Handling


Implement jump with Rigidbody2D velocity and add grounded check.
C# Code Example:
```csharp
public float jumpForce = 10f;
public Transform groundCheck;
public LayerMask groundLayer;
private bool isGrounded;

void Update() {
isGrounded = Physics2D.OverlapCircle(groundCheck.position, 0.1f, groundLayer);
if (Input.GetButtonDown("Jump") && isGrounded) {
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
}
}
```

Enemy AI (Simple Patrol)


Add patrol logic for basic enemy movement.

C# Code Example:
```csharp
public class EnemyPatrol : MonoBehaviour {
public Transform pointA, pointB;
public float speed = 2f;
private Vector3 target;

void Start() {
target = pointB.position;
}

void Update() {
transform.position = Vector3.MoveTowards(transform.position, target, speed *
Time.deltaTime);
if (transform.position == pointB.position) target = pointA.position;
else if (transform.position == pointA.position) target = pointB.position;
}
}
```

Collectibles and Score System


Add collectible objects and update the score.

C# Code Example:
```csharp
public class Collectible : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("Player")) {
ScoreManager.instance.AddScore(10);
Destroy(gameObject);
}
}
}
```

UI: Health Bar and Score


Display player health and score on screen using Unity UI.

C# Code Example:
```csharp
public class ScoreManager : MonoBehaviour {
public static ScoreManager instance;
public Text scoreText;
private int score = 0;

void Awake() {
instance = this;
}

public void AddScore(int value) {


score += value;
scoreText.text = "Score: " + score.ToString();
}
}
```

Main Menu and Game Over


Use Unity's UI system to create a main menu and handle game over screen.

Level Design
Use Unity Tilemap system to design multiple platformer levels with obstacles and hazards.

Testing and Debugging


Playtest all features and fix issues using Unity Console and Debug.Log statements.

Deployment and Build


Build settings for PC, Android or WebGL export.
Key Definitions in 2D Game Development

Game Design Document (GDD)


A Game Design Document is a blueprint that outlines all aspects of a game before and
during development. It includes game mechanics, story, level design, characters, UI/UX, and
art direction. For developers and teams, the GDD acts as a central reference to maintain
consistency and guide implementation.

Rigidbody2D
Rigidbody2D is a Unity component that allows a game object to respond to physics-based
behaviors such as gravity, force, and collisions. It is essential in 2D games to simulate
natural movement, such as jumping and falling.

Tilemap
Unity’s Tilemap system allows developers to paint 2D game levels using grid-based tiles.
This improves level creation speed and keeps asset management efficient, especially in
platformers.

Collider2D
A Collider2D defines the shape of a GameObject for physical collisions in 2D space. It doesn’t
render visibly in-game but allows the object to interact with other colliders, such as
triggering events or blocking movement.

LayerMask
LayerMask helps specify which layers should be considered during a physics check, such as
raycasting or overlap detection, making interaction checks more efficient.

Game Loop
The game loop is the core structure of a game engine where logic updates and rendering
happen repeatedly. In Unity, this is controlled through functions like Update(),
FixedUpdate(), and LateUpdate().

Prefab
A Prefab is a reusable GameObject stored as a template in Unity. Common uses include
enemies, items, and platforms that can be dynamically instantiated during gameplay.

OnTriggerEnter2D
This Unity method detects when one collider enters another marked as a trigger. It’s useful
for handling events like collecting items or entering new areas.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy