game
physics
mechanics
2D Endless Runner
Build a 2D endless runner game where the player controls a character navigating obstacles while collecting items, with increasing difficulty over time.
Time Breakdown
Planning: ~1 hours
Coding: ~4 hours
Testing: ~2 hours
Difficulty: Beginner Friendly
2D Endless Runner
Project Overview
In this project, you'll create a 2D endless runner game where players control a character that runs and jumps to avoid obstacles while collecting items. The game will feature increasing difficulty and a scoring system, providing an enjoyable experience for players.
User Stories
-
As a player, I want to:
- Control a character that automatically runs
- Jump to avoid obstacles
- Collect items to increase my score
- See my score and high score displayed
- Restart the game if I fail
-
As a game designer, I want to:
- Design the game’s mechanics and difficulty curve
- Ensure the environment is procedurally generated to feel endless
- Implement different types of obstacles with increasing difficulty
-
As a developer, I want to:
- Set up the Unity environment for easy game creation
- Write clean and reusable code for character movement and scoring
- Implement a game over screen and restart functionality
Example Code
Here’s a simple implementation of the character movement:
public class PlayerController : MonoBehaviour
{
public float jumpForce = 5f;
private Rigidbody2D rb;
private bool isGrounded;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
if (isGrounded && Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Ground"))
{
isGrounded = true;
}
}
private void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Ground"))
{
isGrounded = false;
}
}
}
Learning Outcomes
- Understanding basic game mechanics
- Working with physics in Unity
- Implementing basic character movement and collision detection
- Creating scalable and reusable game systems
Project Requirements
Progress Tracker
0 of 8 completed- Design a simple character with basic animations
- Implement infinite scrolling environment
- Add obstacles that the player must avoid
- Include collectible items to increase score
- Increase game difficulty over time (faster speed, more obstacles)
- Implement a simple scoring system and highscore tracking
- Create a pause and restart functionality
- Basic sound effects and music