DevHuzaifa's Portfolio

Blockly Coding Game for Kids

An interactive educational coding game that teaches programming concepts through visual, block based programming

blockly-game-wheat.vercel.app
Loading Gallery...

About the Project

Project Description

An interactive educational coding game that teaches programming concepts through visual, block based programming. Built with Google Blockly and Two.js, the project allows beginners to create JavaScript logic using drag and drop blocks and immediately see the results in a dynamic 2D game environment.

The game includes custom Blockly blocks for movement, loops, conditional logic, and color manipulation. These blocks are translated into executable JavaScript and used to control objects rendered on the Two.js canvas, creating a direct connection between visual programming concepts and real code execution.

The project demonstrates how Blockly can be extended beyond simple code editors to create interactive programming environments where learners can experiment with programming logic and receive immediate visual feedback.

The application is deployed on Vercel and can also be run locally using a Python web server to ensure proper rendering of Two.js canvas objects.

Overview

Learning to program can be difficult for beginners because traditional programming requires understanding syntax before learners can focus on the underlying concepts. This project approaches the problem through visual programming, allowing users to construct programs using drag and drop blocks while seeing their logic execute inside an interactive game.

The application combines Google Blockly's visual programming environment with Two.js's 2D rendering capabilities to create a hands on coding experience.

How It Works

Players construct programs by connecting Blockly blocks that represent programming concepts such as movement, loops, conditions, and color changes.

The generated block structure is translated into JavaScript logic, which is then executed against objects in the Two.js game environment.

The basic flow is:

User builds blocks → Blockly generates JavaScript → JavaScript executes game logic → Two.js updates the canvas

This creates an immediate visual feedback loop between the code a learner creates and the result produced by the program.

Key Features

Visual Programming

Google Blockly provides a drag and drop programming interface where users can construct programs without manually writing JavaScript syntax.

Custom Blockly Blocks

The project extends Blockly with custom blocks representing game specific actions and programming concepts, including object movement, loops, conditions, and color changes.

JavaScript Code Generation

Blockly blocks are translated into executable JavaScript, demonstrating how a visual programming interface can serve as an alternative way of constructing real program logic.

Interactive 2D Environment

Two.js is used to render and manipulate objects on a dynamic 2D canvas. Program execution directly affects these objects, allowing users to see the consequences of their logic.

Learning Through Experimentation

The game encourages users to experiment with programming concepts and immediately observe the results, making abstract concepts such as loops and conditional statements easier to understand.

Technologies

Frontend: JavaScript, HTML, CSS

Visual Programming: Google Blockly

2D Rendering: Two.js

Deployment: Vercel

Local Development: Python HTTP server

Technical Highlights

One of the core challenges of the project was connecting Blockly's generated JavaScript with the state of objects rendered by Two.js.

Rather than treating Blockly as a standalone visual editor, the application uses it as a programming interface for the game. Custom blocks represent actions available within the game, while the generated JavaScript provides the execution layer that translates those actions into changes on the Two.js canvas.

This architecture demonstrates how visual programming systems can be integrated with interactive applications instead of being limited to educational code editors.

What This Project Demonstrates

This project demonstrates practical experience with:

  • Building interactive browser based applications
  • Extending Google Blockly with custom blocks
  • Generating and executing JavaScript from visual programming structures
  • Integrating a visual programming environment with a 2D rendering engine
  • Designing educational programming experiences
  • Connecting user generated logic to real time visual feedback
  • Deploying JavaScript applications on Vercel

Technologies Used

Blockly Coding Game: Visual JS Programming with Two.js | Muhammad Huzaifa