Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

Quantum Jumper ๐ŸŽฎ

A beginner-friendly 2D platformer game built with Phaser 3 and TypeScript, featuring dimension-shifting mechanics and a fluent API for easy level creation.

Quantum Jumper TypeScript Phaser Vite

๐ŸŒŸ Features

  • Dimension Switching: Toggle between Light and Dark dimensions with unique platforms and collectibles
  • Fluent API: Beginner-friendly, chainable methods for creating levels
  • Grid-Based Design: Simple 15x15 tile system for easy level creation
  • Comprehensive Documentation: Step-by-step tutorials for absolute beginners
  • Modern Tech Stack: Built with TypeScript, Phaser 3, and Vite
  • Educational Focus: Heavily commented code and extensive learning materials

๐ŸŽฏ Game Mechanics

  • Movement: Arrow keys to move, Spacebar/Up to jump
  • Dimension Switching: Press X to switch between Light and Dark dimensions
  • Collectibles: Coins worth different point values in each dimension
  • Power-ups: Speed boosts, extra lives, and special abilities
  • Portals: Transport between levels and unlock new areas
  • Lives System: Multiple chances with respawn mechanics

๐Ÿš€ Quick Start

Need detailed setup instructions? See our comprehensive Installation Guide for step-by-step instructions.

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Modern web browser

Installation

# Clone the repository
git clone <repository-url>
cd quantum-jumper
# Install dependencies
npm install
# Start development server
npm run dev

The game will be available at http://localhost:5173

Building for Production

# Build the game
npm run build
# Preview the build
npm run preview

๐ŸŽฎ How to Play

  1. Start the Game: Press Enter on the start screen
  2. Move: Use arrow keys to move left and right
  3. Jump: Press Spacebar/Up to jump on platforms
  4. Switch Dimensions: Press X to toggle between Light and Dark dimensions
  5. Collect Items: Walk over coins and power-ups to collect them
  6. Reach the Portal: Find and enter the portal to advance to the next level

Scoring System

  • Bronze Coins: 10 points
  • Silver Coins: 25 points
  • Gold Coins: 50 points
  • Ruby Coins: 100 points
  • Dimension Bonus: Extra points for collecting in alternate dimension

๐Ÿ“š Documentation

For Beginners

Code Examples

// Creating a simple level with the fluent API
this.gameBuilder = createGameScene(this);
// Add a player
this.gameBuilder
 .addPlayer()
 .withLives(3)
 .withScore(0)
 .atPosition(3, 12)
 .withSpeed(200)
 .withJumpPower(800)
 .build();
// Add platforms
this.gameBuilder
 .addPlatform()
 .atCoords(0, 13)
 .withCollider()
 .setSolid()
 .setDimension("both")
 .build();
// Add collectibles
this.gameBuilder
 .addCoin()
 .atCoords(6, 10)
 .withTexture("bronze-coin")
 .animated()
 .setDimension(Dimension.LIGHT)
 .build();
## ๐Ÿ—๏ธ Project Structure

quantum-jumper/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ main.ts # Entry point โ”‚ โ””โ”€โ”€ game/ โ”‚ โ”œโ”€โ”€ constants.ts # Game constants and enums โ”‚ โ”œโ”€โ”€ scenes/ # Game scenes โ”‚ โ”‚ โ”œโ”€โ”€ LoadingScene.ts โ”‚ โ”‚ โ”œโ”€โ”€ StartScreenScene.ts โ”‚ โ”‚ โ””โ”€โ”€ Levels/ # Level implementations โ”‚ โ”‚ โ”œโ”€โ”€ Level1.ts โ”‚ โ”‚ โ””โ”€โ”€ Level2.ts โ”‚ โ”œโ”€โ”€ utils/ # Builder classes and utilities โ”‚ โ”‚ โ”œโ”€โ”€ GameSceneBuilder.ts # Main level builder โ”‚ โ”‚ โ”œโ”€โ”€ PlayerBuilder.ts โ”‚ โ”‚ โ”œโ”€โ”€ PlatformBuilder.ts โ”‚ โ”‚ โ”œโ”€โ”€ CoinBuilder.ts โ”‚ โ”‚ โ”œโ”€โ”€ PowerupBuilder.ts โ”‚ โ”‚ โ”œโ”€โ”€ PortalBuilder.ts โ”‚ โ”‚ โ”œโ”€โ”€ AudioSystem.ts โ”‚ โ”‚ โ””โ”€โ”€ TextureGenerator.ts โ”‚ โ””โ”€โ”€ types/ # TypeScript type definitions โ”‚ โ””โ”€โ”€ index.ts โ”œโ”€โ”€ public/ โ”‚ โ””โ”€โ”€ textures/ # Game assets (SVG graphics) โ”œโ”€โ”€ docs/ # Documentation โ”œโ”€โ”€ index.html # HTML entry point โ”œโ”€โ”€ package.json โ”œโ”€โ”€ tsconfig.json โ””โ”€โ”€ README.md


## ๐Ÿ› ๏ธ Architecture
### Fluent API Design
Quantum Jumper uses a fluent (chainable) API that makes level creation intuitive:
```typescript
// Traditional approach (complex)
const coin = new Coin();
coin.setX(5);
coin.setY(3);
coin.setValue(100);
coin.setDimension("light");
// Fluent approach (readable)
gameBuilder
 .addCoin()
 .setPosition(5, 3)
 .setValue(100)
 .setDimension(Dimension.Light);

Grid-Based Coordinates

  • World Size: 15x15 tiles (480x480 pixels)
  • Tile Size: 32x32 pixels each
  • Coordinate System: (0,0) at top-left, (14,14) at bottom-right
  • Simple Positioning: Think in blocks, not pixels

Builder Pattern

Each game object type has its own builder class:

  • PlayerBuilder: Creates the playable character
  • PlatformBuilder: Creates solid surfaces and obstacles
  • CoinBuilder: Creates collectible items
  • PowerupBuilder: Creates special ability items
  • PortalBuilder: Creates level transition points
  • GameSceneBuilder: Orchestrates all builders and manages the scene

๐ŸŽจ Creating Custom Levels

Basic Level Template

import Phaser from "phaser";
import { createGameScene } from "../../utils/GameSceneBuilder";
import { VIEWPORT_WIDTH, VIEWPORT_HEIGHT, Dimension } from "../../constants";
import { AudioSystem } from "../../utils/AudioSystem";
import { TextureGenerator } from "../../utils/TextureGenerator";
import type { GameState } from "../../types";
export class MyCustomLevel extends Phaser.Scene {
 private gameBuilder!: ReturnType<typeof createGameScene>;
 private gameState!: GameState;
 private audioSystem!: AudioSystem;
 constructor() {
 super({ key: 'MyCustomLevel' });
 }
 create(): void {
 this.initializeState();
 this.initializeSystems();
 
 this.gameBuilder = createGameScene(this);
 
 // Create player
 const player = this.gameBuilder
 .addPlayer()
 .withLives(3)
 .withScore(0)
 .atPosition(3, 12)
 .withSpeed(200)
 .withJumpPower(800)
 .build();
 this.gameBuilder.setMainPlayer(player);
 }
}

Dimension-Specific Design

// Platform only in Light dimension
this.gameBuilder
 .addPlatform()
 .atCoords(5, 10)
 .withCollider()
 .setSolid()
 .setDimension(Dimension.LIGHT)
 .build();
// Coin only in Dark dimension 
this.gameBuilder
 .addCoin()
 .atCoords(6, 9)
 .withTexture("gold-coin")
 .animated()
 .setDimension(Dimension.DARK)
 .build();
// Power-up visible in both dimensions
this.gameBuilder
 .addPowerup()
 .atCoords(8, 8)
 .ofType("mushroom")
 .animated()
 .setDimension("both")
 .build();

๐Ÿ”ง Development

Available Scripts

npm run dev # Start development server
npm run build # Build for production 
npm run preview # Preview production build
npm run lint # Run TypeScript linter
npm run type-check # Check TypeScript types

Adding New Features

  1. New Object Types: Create a new builder class in src/game/utils/
  2. New Levels: Add scene files in src/game/scenes/Levels/
  3. New Mechanics: Extend the GameSceneBuilder with new methods
  4. Custom Power-ups: Add logic in PowerupBuilder and handle in GameSceneBuilder

Code Style

  • Use TypeScript with strict type checking
  • Follow Phaser 3 best practices
  • Prefer composition over inheritance
  • Include comprehensive comments for beginners
  • Use descriptive variable and function names

๐ŸŽ“ Learning Resources

Beginner Path

  1. Start with Learning TypeScript - Learn the language basics
  2. Read What Makes a Game - Understand game development concepts
  3. Follow the Tutorial - Create your first level step-by-step
  4. Study existing levels - Look at Level1.ts and Level2.ts for examples
  5. Experiment - Modify existing levels and create your own

Video Tutorials

Advanced Topics

  • Phaser 3 Documentation: phaser.io/phaser3
  • TypeScript Handbook: typescriptlang.org/docs
  • Game Design Patterns: Study the builder and factory patterns used in this project
  • Performance Optimization: Learn about object pooling and efficient collision detection

Need Help?

Reach out to a staff member (yellow lanyards and badges) or check-in on the event discord server for assistance.


Happy coding and game building! ๐ŸŽฎโœจ

Built with โค๏ธ for learning game development

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /