๐ฎ Introduction
It started with a simple idea: what if we built a survival arcade game where a small character dodges waves of incoming viruses? Powered by curiosity and the newly released Amazon Q Developer CLI, we created "Avoid the Virus", a Python-based Pygame survival game that tests reflexes, timing, and a bit of luck.
Using Amazon Q's generative AI capabilities, we iteratively built the game, starting from a single prompt and evolving it into a fully playable experience โ complete with power-ups, sound effects, and a city-themed backdrop.
โ๏ธ Tech Stack
- Python 3.11
- Pygame
- Amazon Q Developer CLI
๐ง Starting with AI-Powered Game Generation
We kicked things off using this prompt in Amazon Q Developer CLI:
Create a complete game using Python and Pygame called "Avoid the Virus".
That alone set up the foundation โ a main game loop, a player-controlled character, and virus-like enemies that home in on the player. With a few refinements and additional prompts, the AI helped scaffold out features like:
- Virus enemy generation
- Player movement using arrow keys
- Collision detection and game-over logic
๐ก๏ธ Adding Power-Ups and Gameplay Depth
To make the gameplay more exciting and strategic, we added two types of power-ups:
- ๐ฆ Mask โ Grants 5 seconds of immunity.
- ๐จ Hand Sanitizer โ Instantly destroys all viruses on screen.
Prompts used:
Add a power-up in the shape of a blue mask that makes the player immune for 5 seconds.
Add another power-up: a yellow hand sanitizer that removes all viruses on screen when picked up.
These additions were surprisingly easy to integrate using Amazon Qโs step-by-step output and Pygame classes.
โฑ๏ธ Score & Survival Mechanics
Every second counts! The game tracks how long you can survive, with the score tied directly to time. Youโll find yourself dodging, grabbing power-ups, and getting better with each run.
Prompt used:
Add a survival timer and display the score in the top-left corner.
And voilร โ a sleek timer and live score appeared on the screen, updating in real-time.
๐๏ธ Game Feel & Visuals
To boost immersion, we incorporated:
- City street/hospital-themed background
- Simple sprite-based visuals using placeholder rectangles (for now)
- Sound effects for picking up power-ups and the dreaded game over
Folder Structure
avoid_the_virus_game/
โโโ main.py
โโโ assets/
โ โโโ player.png
โ โโโ virus.png
โ โโโ mask.png
โ โโโ sanitizer.png
โ โโโ background.jpg
โ โโโ sounds/
โ โโโ powerup.wav
โ โโโ gameover.wav
โ โโโ bgm.mp3
โโโ README.md
๐ Our Prompt Workflow (Simplified)
Stage | Prompt |
---|---|
๐งฑ Basic Setup | Create a Pygame arcade game called "Avoid the Virus". |
โก Add Power-Ups | Add a blue mask power-up that gives 5 seconds of immunity. |
๐ง Enemy Behavior | Make virus enemies move from all directions toward the player. |
๐ Score/Timer | Display the player's survival time as a score. |
๐ Sounds | Play a sound when the player picks up a power-up and another when the game ends. |
๐ก What We Learned
- ๐งฐ Amazon Q CLI is an incredibly efficient way to bootstrap and iterate game mechanics.
- โ๏ธ Prompt-driven development helps you stay in creative flow โ you focus on ideas, not syntax.
- ๐ฎ Even simple games benefit from thoughtful power-up mechanics and sound design.
- ๐ Pygame remains a fun, beginner-friendly tool for building 2D games fast.
๐ Repo
๐ GitHub Repository โ Avoid the Virus
๐ผ๏ธ YouTube โ Avoid the Virus
๐ Whatโs Next?
- ๐ผ๏ธ Custom sprite art (replacing placeholder rectangles)
- ๐๏ธ Difficulty scaling (faster virus spawns over time)
- ๐ Leaderboard for high scores
- ๐ฑ Mobile adaptation using Kivy or Unity
๐ Conclusion
"Avoid the Virus" was born from a simple idea and supercharged by Amazon Q CLI. The fusion of AI-assisted coding and an intuitive Python game engine like Pygame enabled rapid prototyping, fast iterations, and fun development.
We hope this inspires you to try building your own games.
With the right prompts, even beginners can make something amazing. ๐น๏ธ
โ Want to Try It Yourself?
- Install Pygame:
pip install pygame
- Start your own AI-prompted dev session:
q chat
Happy coding and game building!
Top comments (2)
pretty cool, love seeing how simple ideas just keep collecting new features - you think keeping things playful is what keeps momentum up on these projects or is it more about discipline?
Thanks! ๐ I think it's a bit of both. Playfulness definitely helps spark creativity and keeps things exciting, especially in the early stages. But discipline is what turns a cool idea into something sustainable. Play gives momentum, but discipline gives direction. The sweet spot is probably switching between both depending on the phase of the project.