DEV Community

Cover image for Using Amazon Q CLI & PyGame to Build a 3-Level Maze Game (with Hearts & Hazards!)
4 2 2 1

Using Amazon Q CLI & PyGame to Build a 3-Level Maze Game (with Hearts & Hazards!)

🎮 Introduction

Imagine building an entire game just by chatting. No IDE, no boilerplate headaches—just prompts.

That’s what I did with Amazon Q CLI, the AI command line assistant from AWS. In this blog, I’ll walk you through how I built Q Maze Runner, a fun and challenging 2D maze game with:

  • 🔄 3 Levels of increasing difficulty
  • 💖 Heart-based lives
  • 🧱 Maze logic & traps
  • 🧠 Chat-based development flow
  • 🎵 score tracking, and game over screen

Let’s dive in!


🛠️ Setup: My Development Environment

💻 Tools Used

  • Amazon Q CLI (chat-based code generation)
  • PyGame (2D game development library)
  • WSL with Ubuntu on Windows 11 (to run Q CLI and Python)

⚙️ How I Set It Up

  1. Enabled WSL and installed Ubuntu 22.04:
   wsl --install -d Ubuntu
Enter fullscreen mode Exit fullscreen mode

2.Installed Python and pip:

sudo apt update && sudo apt install python3 python3-pip
Enter fullscreen mode Exit fullscreen mode

3.Installed PyGame:

pip install pygame
Enter fullscreen mode Exit fullscreen mode

4.follow the below documentation and install the Q Cli:

AWS Q CLI

5.Launched the interactive prompt:

q chat
Enter fullscreen mode Exit fullscreen mode

And just like that—I was ready to build.

🧠 Prompt-Driven Development: Key Features I Added

Below are the prompts I fed into Amazon Q CLI and the features it generated.

🧱 1. Game Skeleton & Movement

Create a PyGame template for a 2D top-down maze runner game where the
player moves with arrow keys and cannot walk through walls.

Image description

Output:

Image description

  • Got a basic playable maze
  • Player movement & wall collisions

🧵 2. Title Screen

Add a title screen that says "Q Maze Runner" with a start button. Use a clean UI font and center the text.

Image description

Output:
Image description

  • Clean UI with a button to start

💖 3. Lives System (Hearts)

Add 3 heart symbols at the top-right corner of the screen to represent player lives. Remove a heart each time the player hits an obstacle.

Image description

output:

Image description

  • Displayed hearts as images
  • Decreased life count on trap hit

🧠 4. Moving Obstacles (Spinning Traps)

Add red spinning squares as moving obstacles. If the player touches one, reduce a life and restart current level.

output:

Image description

  • Animated red obstacles that move/spin
  • Reset player position after hit

and many more . try out now and find out !!

🔁 List of prompts i used

  1. Create a PyGame template for a 2D top-down maze runner game where the player moves with arrow keys and cannot walk through walls.
  2. Add a title screen that says "Q Maze Runner" with a start button. Use a clean UI font and center the text.
  3. Show the player's current score at the top-left corner of the game screen using a readable font.
  4. Make the game progressively harder across the 3 levels by reducing open paths and adding moving obstacles.
  5. Add 3 heart symbols at the top-right corner of the screen to represent player lives. Remove a heart each time the player hits an obstacle.
  6. Load and display a heart image and reduce lives by 1 when the player touches a trap. End game when lives reach 0.
  7. Increase the player score by 10 every time they reach the end of the level. Show total score after level 3 or when all lives are lost.
  8. After the player reaches the end of a level, automatically load the next maze layout. After level 3, show a 'Game Over' screen with total score.

🧩 Final Features Recap

✅ 3 Maze Levels
✅ Player Movement & Collision
✅ Heart-Based Lives
✅ Spinning Traps
✅ Score System
✅ Game Over Screen

🧠 What I Learned

  • Amazon Q CLI isn’t just for scripts—it can handle game loops, UI logic, and more
  • Prompt engineering truly becomes programming
  • Using WSL + Q CLI makes Windows a powerful dev environment

📦 Try It Yourself

You can try building your own game with just prompts using Q CLI!

💻 GitHub Repo

👉Q Maze Runner GitHub (Demo & Code)

🎥 Watch here

Game Video

🚀 Conclusion

This was one of the most fun and creative experiments I’ve done as a developer. Amazon Q CLI + PyGame = a dream team.
Try building your own project with Q CLI and share it with the community.

Sentry image

Make it make sense

Make sense of fixing your code with straight-forward application monitoring.

Start debugging →

Top comments (1)

Collapse
 
dotallio profile image
Dotallio

Love how you used Q CLI to go from prompts to a full-on game! Did you run into any surprising limitations or funny bugs in the chat dev flow?

Create a simple OTP system with AWS Serverless cover image

Create a simple OTP system with AWS Serverless

Implement a One Time Password (OTP) system with AWS Serverless services including Lambda, API Gateway, DynamoDB, Simple Email Service (SES), and Amplify Web Hosting using VueJS for the frontend.

Read full post