Build a Tiny Retro Game with an AI Helper
What if you had a magic robot buddy who could help you build your very own video game? Let's meet PICO-8 and your new AI Co-Pilot!
The Cutest Console That Isn't Real
That's PICO-8! It's a "fantasy console" β a mini game-making studio that uses a language called Lua. Think of Lua as a set of magic words for telling the computer what to do.
But you don't have to memorize them all! You have an AI Co-Pilot who knows every magic word. It's an AI that has studied thousands of real PICO-8 games, so it's the perfect robot buddy for our adventure.
β‘ Quick Quiz!
PICO-8 is called a "fantasy console." What does that mean?
Let's give our Co-Pilot its first job. Instead of a boring question, let's ask it to do something! Seeing your code work is way more fun.
Your First Quest: Ask the Co-Pilot: "How do I print a welcome message in PICO-8?" and see what it says!
βοΈ Your First Challenge: Color Power!
In PICO-8, you can change the text color with the color() command before you print something. It uses numbers for colors, like a secret code!
PICO-8 Colors: π¨ 7=π€(White), 8=β€οΈ(Red), 10=π(Yellow), 12=π(Blue)
Your Mission!
Which block of code below will correctly print "I am a game builder!" in yellow?
print("I am a game builder!")color(10)
print("I am a game builder!")color(yellow) print(I am a game builder!)
π οΈ Intermediate Challenge: Draw a Shape
Text is cool, but games need graphics! PICO-8's screen is like a treasure map. The `x` number tells you how far to go right, and the `y` number tells you how far to go down.
Your Mission: Draw a red, filled-in square that's 20 pixels wide at position x=50, y=50. You'll need to ask your Co-Pilot at the top of the page for two key pieces of information: the command for drawing filled rectangles and the color number for red. It's up to you to ask the right questions to solve the puzzle!
π‘ Advanced Challenge: Design a Function
Professional developers live by a rule: Don't Repeat Yourself (DRY). To stay efficient, they package reusable code into blocks called functions. You can give a function a name, and then "call" it whenever you need it.
Your Mission: You're the lead designer! Create a PICO-8 function called draw_enemy(x, y). Your enemy should be a simple character, maybe a red rectangle for a body with a white circle for an eye. You'll need to ask the AI Co-Pilot (at the top of the page) how to write a function in Lua that takes `x` and `y` as inputs and contains multiple drawing commands (`rectfill` and `circfill`). You are the director; the AI is your assistant coder. Go build it!
This is a real challenge. Think about how you'll break the problem down into small questions for your Co-Pilot. You got this! πͺ
β οΈ Safety Check Moment
Your AI Co-Pilot is your creative partner, not a book of facts. Sometimes, an AI can "hallucinate" β that means it confidently makes stuff up. If it ever says something that seems weird or wrong, show a parent. You're not in troubleβyou're being a smart digital citizen!
Rule #1: Never put your name, school, or any personal info into an AI prompt.
Rule #2: Think of AI as a collaborator. Never claim AI-generated code or art as something you made all by yourself. Be an honest creator!
π Ready for the Real Thing?
The way you just designed a prompt to tell the AI what you wanted is *exactly* how pros use tools like GitHub Copilot. They write a comment explaining the goal (e.g., `// function to draw the player's spaceship`) and the AI generates the code. You're learning the real workflow: Idea β Clear Instruction β AI-Generated Code β Your Review.
- Official PICO-8 Website - Check out the real fantasy console here.
- TIC-80 - A great, free alternative to PICO-8 if you want to start coding right now.
π¨βπ©βπ§ Parent Corner: PICO-8 is a fantastic, self-contained game engine that costs $14.99 (a one-time purchase). It's a safe environment for kids to learn coding without web browsers or complex installations. The free alternative, TIC-80, is also an excellent starting point! The problem-solving and logic skills they learn here with Lua are directly applicable to more advanced languages like Python and JavaScript.
π‘ Conversation Starter: Ask your builder about the "enemy" they designed in the advanced challenge. What does it look like? What kind of game would it live in? This connects their coding exercise to creative storytelling.