Walkthrough: Your First Game
Build a tiny browser game with copy-paste prompts. Do the phases in order—do not skip ahead.
Phases complete: 0 / 6
Check each phase when you finish it. All six required phases must be checked for this walkthrough to count as complete (opening the page is not enough).
Do phases in order: 0 → 1 → 2… Copy the “Send this” prompts exactly the first time. Do not polish art until the game can win and lose.
About 45–90 minutes. You only need Grok and a web browser—no Unity, Node, or extra installers. Finished game opens as index.html.
What you will build
Star Clicker Arena — a tiny browser game:
- A player circle you move with WASD or arrow keys
- One enemy that chases you
- Space to attack when close (enemy loses HP)
- On-screen HP for you and the enemy
- You Win / You Lose messages and a Restart button
That is a complete vertical slice: move, fight, win/lose. Not an RPG. Not multiplayer. Not a full art pipeline.

What you need
- Grok installed and signed in (Getting Started)
- Comfort sending a prompt and approving a file edit (First Session)
- A web browser (Chrome, Safari, Firefox, Edge…)
- A terminal window
Permission tip: Stay in default ask mode. Approve file creates/edits for this project folder only. Deny anything that looks unrelated.
Prompt rules for this walkthrough
Name one goal · list constraints · define how you will test · say what is out of scope · attach files with @ when they exist
Ask for “a full game” · stack five features at once · skip verification · invite new frameworks · say “make it awesome” with no definition
| Avoid saying | Why it fails | Say instead |
|---|---|---|
| “Make me a cool game” | No scope, no done condition | The Phase prompts below, copy-pasted |
| “Add multiplayer and levels and shop” | Never finishes | One slice only (already defined) |
| “Use React + Vite + Phaser + TypeScript” | Setup rabbit hole for a first game | “Vanilla HTML/CSS/JS, open index.html” |
| “Just figure it out” | No verification | “I will open index.html and …” |
| “Refactor everything cleanly first” | Polish without play | “Smallest code that plays; polish later” |
Phase 0 — Create the project folder
Do this in your normal terminal (not inside Grok yet).
- Create and enter a new folder
mkdir -p ~/projects/star-clicker-arena cd ~/projects/star-clicker-arena pwdConfirm the path ends with
star-clicker-arena. - Start Grok in that folder
grok - Name the session so you can find it later:
/rename star-clicker-walkthrough
Grok’s interface with an empty or welcome history, typing box at the bottom, and you are “inside” the empty project folder.
Phase 1 — Project brain (AGENTS.md + SLICE.md)
Before any game code, give Grok standing rules and a slice definition as files on disk.
“Set up a game project however you want with best practices.”
Copy everything in the box below into Grok and press Enter.
Goal: Create two markdown files that will guide all later work.
Create AGENTS.md with:
- Project name: Star Clicker Arena
- Stack: vanilla HTML, CSS, and JavaScript only (no frameworks, no build step)
- How to run: open index.html in a browser
- Rules: keep code simple; prefer few files; do not add npm unless I ask
- Definition of done for any task: game still opens via index.html with no console errors
Create SLICE.md with this vertical slice (do not expand scope):
- Player moves with WASD and arrow keys
- One enemy chases the player slowly
- Space attacks if the player is close enough; enemy loses HP
- Player has HP; touching the enemy damages the player on a cooldown
- On-screen HP text for player and enemy
- Enemy HP 0 → "You Win"; player HP 0 → "You Lose"
- Restart button reloads the match
- Out of scope: multiplayer, levels, inventory, sound (unless free and tiny later), particle engines, external assets required to play
Verification: show me the full contents of both files when done.
Do not create game code yet.- Approve file creation if Grok asks.
- Read the files in Grok’s reply (or open them in any editor).
- If scope crept in (React, webpack, and similar options), send:
Remove any mention of frameworks or build tools. Stack must stay vanilla HTML/CSS/JS only. Update the files.
AGENTS.md and SLICE.md exist in the folder and match the slice above.
Phase 2 — Scaffold playable files
Now create the empty structure of the game—still not final combat polish.
“Build the whole game perfectly with beautiful art and a menu system.”
@AGENTS.md @SLICE.md
Goal: Scaffold the game so I can open index.html and see a canvas or playfield with placeholder shapes.
Create:
- index.html — loads css/style.css and js/main.js
- css/style.css — dark background, centered play area, readable HUD text
- js/main.js — starts a requestAnimationFrame loop, draws a player circle and an enemy circle, shows placeholder HP text
Constraints:
- Vanilla HTML/CSS/JS only
- No npm, no bundler
- Keep everything easy to read for a beginner
- Follow SLICE.md scope; movement/combat can be stubs but the page must run
Verification:
1. List the files you created
2. Tell me exactly how to open the game on my computer
3. I will open index.html and should see two shapes and HP text with no browser console errors
After scaffolding, stop and wait for my next message.- Approve creates/edits.
- You open the game:
- macOS:
open index.htmlfrom the project folder in a second terminal, or double-clickindex.htmlin Finder. - Windows: double-click
index.htmlor drag it into a browser window. - Linux:
xdg-open index.htmlor open the file from the file manager.
- macOS:
- Open the browser console (often Right-click → Inspect → Console). Confirm no red errors.
A browser tab with a dark page, two circles (or similar), and HP labels. It does not need to feel “fun” yet—it only needs to load cleanly.
- Tell Grok:
@index.html @js/main.js @css/style.css The page is blank / console shows: [paste error]. Fix only what is required to render the playfield. - Hard-refresh the browser (Mac: Cmd+Shift+R, Windows: Ctrl+Shift+R).
You can open index.html and see the playfield without console errors.
Phase 3 — Core gameplay (the real slice)
Implement movement, chase, attack, damage, win/lose, restart—still simple shapes.
“Make combat deep with combos, crits, status effects, and AI personalities.”
@SLICE.md @AGENTS.md @js/main.js @index.html @css/style.css
Goal: Fully implement the vertical slice in SLICE.md using the existing files.
Requirements:
- WASD + arrow key movement for the player; keep player inside the playfield
- Enemy constantly moves toward the player at a slower speed
- Space: if distance to enemy is within attack range, enemy HP decreases; small cooldown so holding space is not instant win
- Contact damage: if enemy touches player, player HP decreases on a short cooldown
- HUD shows Player HP and Enemy HP as numbers
- When enemy HP ≤ 0: freeze gameplay, show "You Win"
- When player HP ≤ 0: freeze gameplay, show "You Lose"
- Restart button (or on-screen button) resets HP and positions and resumes play
- Keep vanilla HTML/CSS/JS; no new libraries
Non-goals: sound, particles, multiple enemies, spritesheets, mobile touch (optional later)
Verification checklist (respond with each item checked):
1. How to move
2. How to attack
3. How contact damage works
4. How to win / lose / restart
5. Confirm no new dependencies were added
I will playtest manually after you finish. Fix any issues I report next.- Approve edits.
- Refresh the browser.
- Playtest script (you do this):
- Move with WASD — player should move.
- Let the enemy approach — it should chase.
- Press Space near the enemy — enemy HP drops.
- Let the enemy touch you — your HP drops.
- Win once and lose once (you can ask Grok for a temporary debug boost if needed).
- Press Restart — a new match should start.
If something fails, use a bug report prompt (good pattern forever):
@js/main.js @SLICE.md
Bug: [what you did] → [what you expected] → [what happened instead].
Browser console errors (if any): [paste]
Fix the smallest change that solves it. Do not add features.You can move, fight, win, lose, and restart without console errors. Scope still matches SLICE.md.
Phase 4 — Light juice (optional but satisfying)
Only after Phase 3 works. Keep it small.
“Make it AAA quality with cinematic lighting.”
@js/main.js @css/style.css @index.html @SLICE.md
Goal: Small polish pass only. Gameplay rules stay identical.
Add:
- Distinct colors for player vs enemy
- Brief flash or scale pulse on the enemy when hit
- Clearer win/lose panel styling (readable, centered)
- Show attack cooldown or a simple "Ready/Cooling" text if easy
Constraints:
- No new libraries
- No new game mechanics
- Keep performance fine on a laptop
Verification: I refresh index.html, complete one fight, and everything from Phase 3 still works.Phase 5 — Finish line
- Ask Grok for a README
@AGENTS.md @SLICE.md Write a short README.md for beginners: - what the game is - how to open it - controls - what is intentionally out of scope No badges, no install steps for Node. - Rename session (if not already):
/rename star-clicker-done - Celebrate — you shipped a real game with Grok.
You now know how to…
Slice scope, write AGENTS rules, scaffold, implement, playtest, bug-report, polish last.
Natural next upgrades
Second enemy type · simple sound · sprite images · score timer — one at a time with verification each time.
# Example next feature prompt (after finish)
@js/main.js @SLICE.md
Add a score that counts seconds survived until win or lose.
Show it in the HUD. Do not change combat math.
Verification: I can see score increase while playing; resets on Restart.Troubleshooting
| Problem | What to do |
|---|---|
| Grok added npm/React | “Revert frameworks. Vanilla only per AGENTS.md. Remove package.json if created.” |
| Keys do nothing | Click the game page so it has focus; report if still broken with @js/main.js |
| Too hard / too easy | “Lower enemy speed by half” or “player attack damage +1” — one balance change per prompt |
| Session feels confused | /compact keep SLICE and file layout or /new and @ the key files again |
| You over-approved a bad edit | Ask Grok to undo; or copy good file contents from an earlier reply; use Git if you know it |
You can open ~/projects/star-clicker-arena/index.html, play a full match to win and to lose, restart, and explain your controls to a friend.
Related: Building Games (concepts) · Prompt Craft · next walkthrough First App
You finished the game walkthrough. Default next: How App Projects Work then the First App walkthrough. If you only wanted a game, go to Intermediate Day-2 Git with Grok next.