DEV Community

Pawan Sharma
Pawan Sharma

Posted on

Building a Super Mario-Style Platformer Game with Amazon Q Developer

⚙️ Amazon Q CLI: AI Right in Your Terminal

To speed up development and minimize context switching, I used the Amazon Q CLI — a command-line interface that brings the power of generative AI right into your local development workflow.

Instead of switching between docs, forums, and editors, I just typed natural language commands directly in my terminal, and Amazon Q responded with intelligent code suggestions, explanations, and fixes.


🧠 What Is Amazon Q CLI?

Amazon Q CLI is a powerful AI tool designed to assist developers via natural language prompts directly from the terminal.

Whether you're building cloud-native applications or something just for fun (like this retro platformer!), Q CLI helps with:

✅ Writing boilerplate code

✅ Generating test cases

✅ Refactoring functions

✅ Explaining unfamiliar code

✅ Looking up AWS documentation

✅ Debugging issues

All without leaving the terminal.


🚀 How I Used It in This Project

Here’s how Amazon Q CLI boosted my workflow while building Super Platform Adventure:

  • Boilerplate generation: I asked it to create the base structure for the Player, Enemy, and Coin classes — saving me hours of setup.

  • Physics logic: Instead of manually tweaking jump behavior, I prompted,

    “Add gravity and jump velocity logic to player class” — and it just worked.

  • Bug fixing: When collision detection wasn’t working as expected, I ran:

    “Why isn’t sprite collision working in my Pygame project?”

    Q diagnosed the problem and suggested using pygame.sprite.spritecollide() properly.

  • Refactoring: Cleaned up repetitive code using natural prompts like

    “Refactor this loop into a method”.


🛠️ Setting Up Amazon Q CLI

Before starting the game, I installed and configured Amazon Q CLI on my system. The setup was quick:

npm install -g @amazon/q-cli
q configure
Enter fullscreen mode Exit fullscreen mode

You’ll be prompted to authenticate with your AWS account, after which you can start prompting away in your terminal.

Amazon Q CLI Setup

Amazon Q CLI felt like having a senior dev in the terminal — available 24/7, understanding natural language, and writing code with context.


For game development especially, where quick iteration and frequent debugging are key, this tool saved me countless hours.

So whether you're building a cloud app or just a cool retro game — give Q CLI a try. It’s a game changer. 🎮


Ever dreamed of building your own retro-style platformer? I did — and with the help of Amazon Q Developer, I finally brought that idea to life using Python and Pygame.

Game Screenshot

Let me walk you through my journey of creating 🍄 Super Platform Adventure, a side-scrolling game inspired by classics like Super Mario, with the power of AI and modern tools.

Game Level


Amazon Q CLI with prompt

🍄 Super Platform Adventure - Game Prompt

Game Concept

Create a Super Mario-style 2D platformer game using Python and Pygame with the following specifications:

1. Player Character

  • Appearance: Blue rectangle (40x40 pixels) with simple white dot eyes
  • Starting Position: (50, 400)
  • Movement Speed: 5 pixels per frame
  • Jump Mechanics:
    • Jump velocity: -15
    • Gravity: +0.8 per frame
    • Can only jump on solid ground
  • Lives: 3
  • Respawn: Return to start when hit

2. Game World

  • Size: 800x600
  • Background: Sky blue (135, 206, 235)
  • Platforms:
    • Ground: full width, height 40px
    • Elevated: multiple brown platforms
    • Solid collision detection

3. Enemies

  • Appearance: Red rectangles (30x30), black eyes
  • Behavior:
    • Patrol platforms
    • Reverse at edges
    • Speed: 2 px/frame
    • Not fall off
  • Combat:
    • Jumping = defeat
    • Touching = damage
    • +100 points

4. Coins

  • Appearance: Yellow circles (20x20)
  • Value: 50 points
  • Behavior: Disappear when collected
  • Win requirement: All coins must be collected

5. Physics

  • Constant gravity
  • Rectangle collision
  • Platform interaction
  • Boundary checks

6. Game States

  • Win: All enemies + all coins
  • Lose: 0 lives
  • Active: Real-time physics, score/lives, 60 FPS

7. Controls

  • Left: A / ←
  • Right: D / →
  • Jump: Space / W / ↑
  • Quit: Window close

8. UI

  • Score: Top-left
  • Lives: Below score
  • Instructions: Bottom
  • Font: Pygame default, size 36

9. Tech

  • Pygame
  • 60 FPS
  • 800x600
  • OOP classes

10. Class Structure

  • Player: Movement, collision, draw
  • Enemy: Patrol logic, collision, draw
  • Coin: Position, collection, draw
  • Game: Loop, manage objects, collisions, UI

11. Platform Layout

Ground: (0, 560, 800, 40)

Platform 1: (200, 450, 150, 20)

Platform 2: (400, 350, 150, 20)

Platform 3: (600, 250, 150, 20)

Platform 4: (100, 300, 100, 20)

Platform 5: (500, 150, 200, 20)

12. Enemies

  • (220, 420)
  • (420, 320)
  • (620, 220)

13. Coins

  • (250, 420)
  • (450, 320)
  • (650, 220)
  • (550, 120)
  • (150, 270)

14. Colors

  • Player: Blue (0,0,255)
  • Enemy: Red (255,0,0)
  • Coin: Yellow (255,255,0)
  • Platform: Brown (139,69,19)
  • BG: Sky Blue (135,206,235)
  • UI: Black (0,0,0)

15. Rules

  1. Collect all coins + defeat all enemies
  2. Touch enemy side = -1 life
  3. Jump on enemy = kill + 100
  4. Coin = +50
  5. Fall = respawn
  6. 0 lives = game over

16. Performance

  • 60 FPS
  • No input lag
  • Smooth collisions
  • State transitions

17. Error Handling

  • Init pygame safely
  • Handle close
  • Module exceptions

🎯 Why I Chose This Game

I’ve always loved platformers — nostalgic, challenging, fun.

Perfect for testing:

  • Physics & collisions
  • Enemy AI
  • Scoring & levels

🤖 Prompting with Amazon Q Developer

Started with:

"Build a basic platformer game in Python using Pygame with coins, enemies, and win/loss conditions."

Q Developer impressed me by:

  • Understanding full context
  • Creating modular classes
  • Suggesting gravity and AI logic
  • Producing working code snippets

Then I kept refining:

  • “Add scoring system”
  • “Make enemies patrol”
  • “Lose life on enemy contact”

Each time: accurate and structured responses 🔥


💡 AI Solutions to Classic Game Dev Problems

  1. Jump Physics
if self.jumping:
    self.vel_y += gravity
    self.rect.y += self.vel_y
Enter fullscreen mode Exit fullscreen mode
  1. Enemy Patrol
if self.rect.left < self.min_x or self.rect.right > self.max_x:
    self.direction *= -1
self.rect.x += self.speed * self.direction
Enter fullscreen mode Exit fullscreen mode
  1. Collisions
pygame.sprite.spritecollide()
Enter fullscreen mode Exit fullscreen mode

⚡ Automation That Saved Time

Amazon Q helped with:

  • Refactoring
  • Bug fixing
  • Full game loop
  • UI states (restart, win, lose)

Prompted:

"Add restart option when the game is over" — it worked perfectly.


🔧 Game Features Summary

  • Physics + gravity
  • Coins + enemies
  • Score & lives
  • Win/Lose logic
  • Expandable design

🐍 Code Snapshot

class Player(pygame.sprite.Sprite):
    def __init__(self):
        self.speed = 5
        self.jump_power = -15
        self.lives = 3
        # Setup player sprite & controls
Enter fullscreen mode Exit fullscreen mode

Full Source Code:

📦 GitHub Repository


🎮 Try the Game

pip install pygame
python super_game.py
Enter fullscreen mode Exit fullscreen mode

🙌 Credits

  • Game dev with 💖 using Python + Pygame
  • AI prompts powered by Amazon Q Developer
  • Code hosted on GitHub

Top comments (0)