🎮 AI Coding

Build a Survival Game from Scratch

Ages 10-14 Zero Experience Learn by Playing

Use Cursor + AI magic — code by speaking

🤖 What is AI?

AI = Digital Brain

  • Computation: You ask 2+2=?, it answers 4
  • Understanding: You ask "feeling down?", it suggests "listen to music"
  • Learning: After 1000 cat photos, it recognizes the 1001st
🧠⚡💻

Like Iron Man's JARVIS
Like Doraemon's magic pocket
Understands you and solves problems

🎨 What is AIGC?

AI Generated Content: You describe ideas, AI creates

🖼️ AI Drawing

"Draw a panda on a motorcycle"

→ Image in 10 seconds

📝 AI Writing

"Write a space adventure story"

→ Instant novel

🎵 AI Music

"Write a song in Jay Chou style"

→ Generated music

💻 AI Coding

"Make a monster-fighting game"

→ Runnable code

Key shift: From "craftsperson" to "commander"! Just clearly describe what you want, AI does the rest.

⌨️ What is AI Coding?

AI Coding = Translator + Builder

1. You speak:
"I want a red button that plays music when clicked"
2. AI translates:
Into JavaScript/Python code
3. AI builds:
Assembles into a runnable program

No syntax to memorize, no fast typing, no advanced math needed

Just need: speaking + imagination

🎮 Welcome to AI Gaming!

Today we combine AI's three powers:
Listen + Draw + Code = Create games!

Today's Task: Survival Roguelike

  • Control a stick figure moving on a map (WASD)
  • Dodge red monsters from all directions
  • Auto-fire bullets to defeat enemies
  • Collect XP, level up, learn fireball, lightning skills
  • See how long you survive!

Our magic workspace: Cursor (AI coding assistant)

🗺️ Course Map

Stage 1
🎨
Canvas Basic
Single file · Playable
Stage 2
Phaser Pro
Particles · Effects · Sound
Stage 3
🚀
Free Creation
Your ideas · AI implements
How to use:
1. Open Cursor (or any AI coding tool)
2. Create new file game.html
3. Copy each slide's Prompt to AI chat
4. Click Apply, save, open in browser to play!
1

Basic World: Player Movement

Goal: Create a white stick figure that moves on a black canvas

Verify: Save and open in browser, press WASD to see the ball move, time increases
2

Monsters Attack: Enemy AI

Goal: Red squares spawn at edges and chase you

Game mechanics:
  • Red squares crawl in from screen edges
  • Touch = damage, run!
3

Combat: Auto Attack

Goal: Auto-fire bullets to defeat enemies, earn score

Auto-aim Kill score Difficulty+
4

Level Up! Choose Your Skill

Core loop: Kill → Collect XP → Level up → Learn skills

This is the soul of survival games! Kill, collect gems, level up!

5

Skill Variety

Fireball, ice arrow, multi-shot! Mage or archer?

🔥 Fire Mage ❄️ Ice Archer ⚡ Multi-shot

🚀 Engine Upgrade!

Canvas Basic

  • Manual drawing
  • Simple shapes
  • 100+ lines
  • Plain effects
✏️

Phaser Pro

  • Built-in physics
  • Particle system
  • Lighting & sound
  • Cleaner code
🎨✨🔊

Like upgrading from pencil sketch to digital art! Now we have a "magic toolbox"

6

Migrate to Phaser

Keep all features, add particle trails and glow

Now deaths have explosions, movement has trails, XP orbs glow!

7

Ultimate Effects: Lightning & Fire Ring

Screen shake, glow filters, chain lightning!

⚡ Lightning 💥 Fire Ring 📳 Screen shake
8

Audio & Feel

Add sound, hit feedback, impact

Now the game has sound! Put on headphones for that satisfying "boom"!

📝 Prompt Tips

Learn these "spell formulas" to make AI build any game!
↓ Switch down to see each tip

Change colors/appearance:
"Change player to blue glowing sphere, enemies to purple zombies, background to starfield"

📝 Prompt Tips

Add new skill:
"Add shield skill: Space for 5s invincible, golden particles around body, 10s CD"

📝 Prompt Tips

Adjust difficulty:
"Add beginner protection: first 30s half spawn rate, first Boss at 60s"

📝 Prompt Tips

Universal Debug spell:
"Game error: [paste error], current logic: [describe intent], please fix and explain"

🚀 After-Class Challenges

Copy these Prompts to upgrade your game!

Boss Challenge

Add Boss: every 60s a huge Boss (3x size, 100 HP), shoots 8-way bullets, defeat for full XP + 50 HP

Map Traps

Add lava pools (red, damage) and grass (green, +20% speed)

Save Feature

Local storage: record best survival time, show "Best: Xs" on next open

🎓 Summary

Today you learned: create worlds by speaking

No syntax to memorize, no fear of errors

Just: clear description + bold tries + keep debugging

Golden Rule

"Speak boldly, try bravely, ask AI when stuck"

Now go brag to friends:
"I made this game by speaking!"

🛠️ Tool List

Essential Tools

  • Cursor: cursor.com (free AI editor)
  • Browser: Chrome/Edge/Safari (run games)
  • Notepad: save as .html

Learning Resources

  • Phaser: phaser.io/examples
  • MDN: developer.mozilla.org
  • AI: ChatGPT/Claude (ask anytime)

For Parents

No coding background needed. Focus on logical expression and creativity. Kids learn to collaborate with AI through describe→verify→refine.