DEV Community

Cover image for Building a game using Amazon Q CLI
Myles Ngicu
Myles Ngicu

Posted on • Edited on

3

Building a game using Amazon Q CLI

Creating a Space Invaders Game with Amazon Q CLI

If you think Amazon Q is cool, make a game with it on the CLI and experience the AWSomeness! That's exactly what I did and I marvelled at how easy it is.
Amazon Q as a generative AI for developers. On the CLI, it doesn't have native support for Windows. I hadd a little trouble with that but I found out that I can install it using WSL. After that, just type 'q' and voila, you're in!😎

Launching Amazon Q on WSL

I wanted to create the retro game called "Space Invaders" where a space ship shoots down alien invaders. All I needed to do was give Amazon Q this detailed prompt:

Create a complete "Space Invaders"-style game using vanilla HTML, CSS, and JavaScript. The game should have a player ship at the bottom that moves left and right with arrow keys and shoots bullets upward with spacebar. Rows of aliens move side to side at the top and shoot bullets downward toward the player. Players score points by destroying aliens, the score should be displayed and updated in real time, and the game should show "GAME OVER" if an alien bullet hits the ship. Provide a directory structure with index.html, style.css, and script.js files, well-commented and functional by opening index.html in a modern browser.
Enter fullscreen mode Exit fullscreen mode

Prompting Amazon Q CLI
It requested for permission to run a shell command and I did so by typing 't'(always allow such actions for this session).

Amazon Q's Response

Amazon Q created a folder with the following files:

space-invaders/
├── index.html    # Main HTML structure
├── style.css     # Game styling
└── script.js     # Game logic and functionality
Enter fullscreen mode Exit fullscreen mode

The response included instructions on how to run the game.

Amazon Q CLI response

Playing the game

I navigated to the folder containing the game files and ran the index.html on my browser

File Explorer
As requested in the prompt, the game includes:

  • Player ship that moves left and right with arrow keys
  • Shooting functionality with the spacebar
  • Rows of aliens that move side to side and gradually descend
  • Aliens that randomly shoot bullets downward
  • Score tracking that updates in real-time
  • "GAME OVER" display when hit by an alien bullet
  • Different coloured aliens worth different point values

Playing Space Invaders

Space Invaders game lost

Well, I haven't won a game yet(the aliens keep getting me). I enjoyed how easy it is to create the Space Invaders game using Amazon Q CLI in a single prompt-response interaction. It shows just one of the many capabilities of Amazon Q on the CLI.
I hope y'all create cool games and join the challenge which ends on June 30th 2025.

I ❤️ building dashboards for my customers

I ❤️ building dashboards for my customers

Said nobody, ever. Embeddable's dashboard toolkit is built to save dev time. It loads fast, looks native and doesn't suck like an embedded BI tool.

Get early access

Top comments (0)

Heroku

Build AI apps faster with Heroku.

Heroku makes it easy to build with AI, without the complexity of managing your own AI services. Access leading AI models and build faster with Managed Inference and Agents, and extend your AI with MCP.

Get Started

Announcing the First DEV Education Track: "Build Apps with Google AI Studio"

The moment is here! We recently announced DEV Education Tracks, our new initiative to bring you structured learning paths directly from industry experts.

Dive in and Learn

DEV is bringing Education Tracks to the community. Dismiss if you're not interested. ❤️