How to Create an HTML Game Using AI in your Classes (Step-by-Step Guide)

 

HTML CODED-GAMES and Prompts

CLICK HERE TO DOWNLOAD [HTML and Prompt]

> Ready to Play Links [ Team GameMatching Game ] 

Creating your own HTML game is now very easy—even if you are not a programmer. With the help of AI tools like Gemini, you can generate a working game in just a few minutes.

In this guide, you will learn how to create, download, and run your own HTML game step by step.

📌 Important Notes

  • Open the .txt file to view the sample prompt.
  • Copy and paste it into Gemini to generate your own game code.
  • You may also use the ready-made .html file provided.

If you want to customize the game (for example, changing words or emojis), simply give a new command in Gemini:

👉 “Repeat, but replace the words and emojis with the following: _______.”

⚠️ Reminder: This process may take a few tries. Be patient and continue refining your prompt until you get the result you want.


🧩 Step-by-Step Guide

Step 1: Open Gemini

Go to the Gemini website and log in to your account. This is where you will generate your game code.


Step 2: Write a Clear Prompt

The most important part is your prompt. A clear prompt helps the AI understand exactly what kind of game you want.

Make sure your prompt includes:

  • Type of game (quiz, matching, etc.)
  • Design (colorful, simple, kid-friendly)
  • Features (score, timer, restart button)
  • Audience (students, beginners)

🎮 Sample Prompt

The "Balanced Transport Match" Prompt

Create a single-file HTML/CSS/JS game called “Balanced Transport Match” with the following features:

1. Visual Theme & UI

  • Background: Bright orange (#FF9800)
  • Header: White with a green “fuel” progress bar
  • Arena: Blue box (#81D4FA) with a green grass strip
  • Style: Clean, lowercase text

2. Game Elements

  • 14 transports: 🚲 🚌 🚗 🚇 ✈️ 🛵 🚕 🚆 🚤 ⛴️ 🚚 🏍️ 🚁 🚠
  • Floating word labels (e.g., “bike”)
  • Floating emojis that move independently

3. Gameplay Mechanics

  • Drag and drop emojis onto matching words
  • ✅ Correct: disappears + sound + fuel +15%
  • ❌ Wrong: buzz sound
  • Fuel slowly decreases over time
  • Win: match all items
  • Lose: fuel reaches zero

4. Technical Details

  • Use Web Audio API
  • Use requestAnimationFrame for smooth animation
  • Make it mobile-friendly (touch support)

Step 3: Generate the Code

After typing your prompt, press Enter and wait for the AI to generate the code.


Step 4: Copy the Code

Highlight everything and copy the full code.


Step 5: Open Notepad

  • Press the Windows key
  • Type Notepad
  • Open the application

Step 6: Paste the Code

Paste your copied code into Notepad.


Step 7: Save as HTML File

This step is very important.

  • File name: game.html
  • Make sure it ends with .html, not .txt

Step 8: Open the Game

Find your file and double-click it. It will open in your browser.


Step 9: Test Your Game

Try playing your game and check if everything works correctly.


Step 10: Improve Your Game

You can go back to Gemini and improve your game by adding:

  • ⏱ Timer
  • 🔊 Sound effects
  • ➕ More questions
  • 🎨 Better design




Tips for Better Results

  • Use simple and clear prompts
  • Ask for beginner-friendly code
  • Always test your game
  • Use one HTML file for easy setup

With AI tools, creating an HTML game is now simple and fast. You just need to write a good prompt, copy the code, save it as an HTML file, and open it in your browser. This is a great way to create fun and interactive activities for your students.

Post a Comment

2 Comments

  1. Hi, Sir
    Is this going to work if you only have lenovo laptop not a macbook?Thank you so much.

    ReplyDelete
  2. maraming salamat sir, dami ko pong natututunan sainyo.

    ReplyDelete