Rumon
  • Home
  • About
  • Projects
  • Contact
Get in Touch
Rumon

Frontend Developer specializing in React.js, Next.js, and TypeScript. Based in Rangpur, Bangladesh.

Pages

  • Home
  • About
  • Projects
  • Contact

Social

  • GitHub
  • LinkedIn
  • YouTube
RUMON
Back to projects
Learning Project / Browser Game

Tetris Game

A dependency-free browser implementation of classic Tetris built as a solo learning project to practice game loops, collision detection, grid math, and Canvas 2D rendering across desktop and mobile.

Live DemoSource Code
Tetris Game — Learning Project / Browser Game main interface screenshot
Category
Learning Project / Browser Game
My Role
Solo Learning Project
Timeline
5 days
Year
2024

My Role

Solo Learning Project

Designed and built the complete browser game independently using vanilla JavaScript and Canvas 2D with no external game engine or libraries.

Key Contributions

What I worked on

  • Implemented piece rotation states, collision detection, simple wall kicks, and row-clearing logic from scratch.
  • Built Canvas 2D rendering for the main board and next-piece preview.
  • Added desktop keyboard controls and mobile touch/swipe gestures.
  • Created progressive fall-speed scaling, score/level panels, and pause/game-over overlays.
Technical Implementation

Architecture & key features

Built in dependency-free vanilla JavaScript, HTML, and CSS using the HTML5 Canvas 2D API. Models each piece as a center block plus per-rotation offsets, validates every candidate move against board bounds and stacked rows, and scales both game and preview canvases to the viewport.

01

Custom collision and rotation logic

Every move is validated against walls, floor, and stacked blocks. Failed rotations roll back, and wall-adjacent rotations nudge into place.

02

Keyboard and touch controls

Arrow keys to move, rotate, and soft-drop; swipe gestures on mobile; Space/P or tap to pause and restart.

03

Progressive difficulty

Fall speed increases with cleared lines from 1000ms down to a 200ms cap, with level progression every 10 lines.

04

Next-piece preview

A second canvas shows the upcoming piece in its own color so players can plan ahead.

05

Responsive arcade UI

The game container scales to the viewport, with Level and Score panels and Paused / Game Over overlays.

Challenges & Solutions

The Challenge

Build a complete Tetris without a game engine or libraries: seven piece types with multiple rotation states, collision against walls, floor, and stacked blocks, row clearing, and a layout that works on both desktop and mobile.

The Solution

Modeled each piece as a center block plus offset squares for every rotation state, validating each candidate move against the board before committing it. Invalid rotations roll back, wall-adjacent pieces nudge inward (simple wall kick), completed rows clear and drop rows above, and Canvas 2D redraws smoothly at any viewport size.

Outcome

What it achieved

Shipped a fully playable, dependency-free Tetris game deployed on GitHub Pages that runs smoothly on desktop and mobile browsers.

Takeaways

What I learned

Building the game loop, grid math, and collision handling from scratch strengthened my grasp of state management with timers and event handlers, while highlighting cleaner future improvements such as matrix-based rotation, hard drop, a ghost piece, and a 7-bag randomizer.

Technology Stack

Built with

  • JavaScript
  • Canvas API
  • HTML
  • CSS
Project Links

Live project & code

Live DemoSource Code

Next project

Workforce Management / Time Tracking

PreciseClock

View Project
PreciseClock — Workforce Management / Time Tracking preview
Open to Opportunities

Looking for a Frontend Developer? Let's connect.

Currently seeking full-time Frontend Developer opportunities. I'm always open to discussing new career opportunities—feel free to reach out!

Get in TouchDownload Resume
shahidhasanrumon2@gmail.com