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

2.Installed Python and pip:

sudo apt update && sudo apt install python3 python3-pip

3.Installed PyGame:

pip install pygame

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

AWS Q CLI

5.Launched the interactive prompt:

q chat

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.

0
Subscribe to my newsletter

Read articles from Venkata Pavan Vishnu Rachapudi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Venkata Pavan Vishnu Rachapudi
Venkata Pavan Vishnu Rachapudi

I'm Venkata Pavan Vishnu, a cloud enthusiast with a strong passion for sharing knowledge and exploring the latest in cloud technology. With 3 years of hands-on experience in AWS Cloud, I specialize in leveraging cloud services to deliver practical solutions and insights for real-world scenarios. Whether it's through engaging content, cloud security best practices, or deep dives into storage solutions, I'm dedicated to helping others succeed in the ever-evolving world of cloud computing. Let's connect and explore the cloud together!