Skip to content

About

3d bricks slider game built using JavaScript

Topics

Resources

Code of conduct

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ 3D Bricks Slider Game

Version 2.0.0 โ€” A fast-paced, reflex-driven 3D brick-swiping game built with vanilla HTML, CSS, and JavaScript.

Live Demo License: MIT Version


๐Ÿ“š Table of Contents


๐Ÿ•น๏ธ About the Game

3D Bricks Slider Game is a fast-paced, reflex-driven browser game where players swipe bricks off the screen to score points while avoiding deadly bombs. As you progress, the game environment dynamically evolves with vivid new background colours as you clear levels, creating an ever-changing and immersive visual journey.

Built entirely with vanilla HTML5, CSS3, and JavaScript โ€” no frameworks, no dependencies, just pure performance.


๐ŸŒŸ Features

๐Ÿงฑ Core Gameplay

  • 3D Rendered Bricks: Real-time 3D projection and rendering with perspective, shadows, and smooth physics.
  • Swipe Mechanics: Swipe bricks using a mouse or touchscreen. Speed and direction affect scoring and physics reactions.
  • Ranked & Casual Modes: Play competitively in Ranked Mode (missed bricks end the game) or relax in Casual Mode (missed bricks deduct points instead).
  • Slow-Motion Power-Up: Smashing special wireframe bricks triggers a slow-motion effect with bonus spawns.

๐Ÿ’ฃ Bomb Hazard

  • Bombs randomly spawn among regular bricks. Do not swipe them! Swiping a bomb immediately ends the game with a dramatic explosion effect and sound.
  • Bombs that fall off-screen are safely ignored โ€” the game continues.

๐Ÿ”Š Sound Effects System

  • Powered by the Web Audio API for zero-latency, hardware-accelerated audio โ€” optimized for both desktop and mobile.
  • Game Start Sound: Plays when the player starts or restarts a game.
  • Splash Sound: Fires on every successful brick smash โ€” supports simultaneous overlapping playback with no lag.
  • Game Over Sound: Plays when the player loses (brick missed or bomb swiped).
  • Dynamic Background Sound: Plays on every completed level when the background changes.
  • Sound Toggle Button (๐Ÿ”Š/๐Ÿ”‡): Mounted in the HUD. Preference is saved to localStorage and persisted across sessions.

๐ŸŒƒ Endless Random Dynamic Backgrounds

  • The game background evolves every time you complete a level (by successfully smashing a required sequence of 10, 15, 20, 25, or 30 cubes) randomly picking from a curated palette of 15 environments:

    # Colour Name Hex
    1 Teal (Default) #65c8a8
    2 Blue Night #1a365d
    3 Cosmic Space Purple #170b3b
    4 Sunset Red/Orange #8a2c22
    5 Digital Green #0f381e
    6 Deep Violet #4a154b
    7 Vibrant Orange #e67e22
    8 Midnight Blue #2c3e50
    9 Bright Purple #8e44ad
    10 Deep Crimson #c0392b
    11 Dark Sapphire #0c2461
    12 Ocean Night #3c6382
    13 Rich Maroon #b71540
    14 Deep Teal #079992
    15 Charcoal #2f3640
  • The game will always begin in the Teal (Default) environment, and all subsequent levels will shift into a dynamically randomized color from the list above.

  • Each transition displays a smooth "New World Unlocked!" milestone notification.

๐Ÿ“– How It Works Guide

  • An in-game instruction menu accessible from the Main Menu explains the game objective, controls, bomb warnings, and background progression system.

๐Ÿš€ Live Demo

โ–ถ๏ธ Play the Game Now!


๐Ÿ“ File Structure

3d-Bricks-Slider-Game/
โ”‚
โ”œโ”€โ”€ index.html                  # Main entry point โ€” game HTML structure & HUD
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ style.css           # All game styles, animations, menus & HUD
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ”œโ”€โ”€ globalConfig.js     # Global constants: colors, physics, camera, sizes
โ”‚   โ”‚   โ”œโ”€โ”€ state.js            # Global game state, enums, and localStorage high score
โ”‚   โ”‚   โ”œโ”€โ”€ PERF.js             # Performance measurement utilities
โ”‚   โ”‚   โ”œโ”€โ”€ utils.js            # Math, DOM, color, timing, 3D projection helpers
โ”‚   โ”‚   โ”œโ”€โ”€ 3dModels.js         # 3D brick and fragment model definitions
โ”‚   โ”‚   โ”œโ”€โ”€ Entity.js           # Entity class for 3D game objects
โ”‚   โ”‚   โ”œโ”€โ”€ getTarget.js        # Target spawning and object pool logic
โ”‚   โ”‚   โ”œโ”€โ”€ createBurst.js      # Burst/fragment explosion effect on brick smash
โ”‚   โ”‚   โ”œโ”€โ”€ sparks.js           # 2D spark particle system
โ”‚   โ”‚   โ”œโ”€โ”€ hud.js              # HUD rendering: score, cubes left, slow-mo bar, milestone notifications
โ”‚   โ”‚   โ”œโ”€โ”€ menus.js            # Menu rendering and button click handlers
โ”‚   โ”‚   โ”œโ”€โ”€ audioManager.js     # Web Audio API sound manager: preloading, playback, mute toggle
โ”‚   โ”‚   โ””โ”€โ”€ actions.js          # Core game loop, physics tick, milestone & background logic
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ assets/
โ”‚       โ”œโ”€โ”€ img/                # Game image assets
โ”‚       โ””โ”€โ”€ sounds/
โ”‚           โ”œโ”€โ”€ game-start.mp3          # Sound played when starting a game
โ”‚           โ”œโ”€โ”€ game-over.mp3           # Sound played on game over
โ”‚           โ”œโ”€โ”€ dynamic-background.mp3  # Sound played on background milestone change
โ”‚           โ””โ”€โ”€ splash.mp3              # Sound played when a brick is smashed
โ”‚
โ”œโ”€โ”€ feature/                    # Feature specification documents
โ”‚   โ”œโ”€โ”€ BOMB.md
โ”‚   โ”œโ”€โ”€ DYNAMIC-BACKGROUND.md
โ”‚   โ”œโ”€โ”€ HOW IT WORKS.md
โ”‚   โ”œโ”€โ”€ 3-Lives.md
โ”‚   โ”œโ”€โ”€ CUBE-BASED-LEVEL.md
โ”‚   โ”œโ”€โ”€ HOW-IT-WORKS.md
โ”‚   โ”œโ”€โ”€ LEVEL.md
โ”‚   โ””โ”€โ”€ SOUND.md
โ”œโ”€โ”€ Release/
โ”‚   โ””โ”€โ”€ v2.0.0-release-notes.md   # Official v2.0.0 release notes
โ”‚
โ”œโ”€โ”€ CHANGELOG.md                # Full version history and change log
โ”œโ”€โ”€ CONTRIBUTION.md             # Contribution guidelines
โ”œโ”€โ”€ CODE_OF_CONDUCT.md          # Community code of conduct
โ”œโ”€โ”€ LICENSE                     # MIT License
โ””โ”€โ”€ README.md                   # This file

๐Ÿ› ๏ธ Getting Started

Prerequisites

All you need is a modern web browser. No build tools, no package managers, no dependencies.

Installation

  1. Clone the repository:

    git clone https://github.com/mmabiaa/3d-bricks-slider-game.git
  2. Navigate to the project directory:

    cd 3d-bricks-slider-game

Running the Game

Simply open index.html directly in your browser, or serve it with any local static server:

# Using Python
python -m http.server 8000

# Using Node.js (npx)
npx serve .

Then visit http://localhost:8000 in your browser. ๐ŸŒ

Note: Running via a local server (rather than opening the file directly) is recommended to ensure audio assets load correctly due to browser security policies.


๐ŸŽฏ How to Play

Action Result
Click / Tap PLAY GAME Start a Ranked game
Click / Tap CASUAL MODE Start a Casual game
Swipe a regular brick fast Score points + splash effect
Swipe a bomb ๐Ÿ’ฅ Instant Game Over
Miss a brick (Ranked) โŒ Game Over
Miss a brick (Casual) -25 points
Smash a wireframe brick โšก Slow-Motion activated
Complete a level ๐ŸŒ Background changes + sound cue
Press P Pause / Resume
Click ๐Ÿ”Š / ๐Ÿ”‡ Toggle sound effects

๐Ÿ“‹ Changelog

See CHANGELOG.md for a full history of all changes, or read the v2.0.0 Release Notes for the latest major update.


๐Ÿค Contributing

Contributions are welcome! Please read CONTRIBUTION.md for guidelines on how to submit improvements or bug fixes.


๐Ÿ“ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Special thanks to Rajtlak for early contributions and support!
  • Inspired by classic fruit-slicing and brick-swiping arcade games.
  • Audio engine optimized using the Web Audio API specification.

Made with โค๏ธ by Mmabiaa

About

3d bricks slider game built using JavaScript

Topics

Resources

Code of conduct

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages