Ask questions and chat about this page directly in ChatGPT
Intro
In this short post, I'll teach you what I learned while using Cladue code, to generate a simple 2D platform game. Along with examples of different prompts and approach to set-up a simple, yet effective gaming experience.
A note: this is a second post of this type, similar to the one I had worked on before. I used ChatGPT back then, and I figured Claude (especially the paid version) handled the coding of a side scroller better. Needless to say, both tools grow rapidly, so it's hard to say, which one is my preference as of now. You can read about my previous tries here: https://wp-doin.com/how-to-use-chatgpt-to-generate-a-2d-side-scroller-concept/.
Nature Quest - first versionS
First version of the game was a mixed experience, I provided the Claude with ChatGPT generated assets:
- our hero
- background image
- trees
- enemy image
All of that, via a simple, single prompt:
Use these 4 assets to set me up with a simple side scroller - called, the nature quest.
The hero.png is our character with a healthbar of 5 points, the background.png is a background, which scrolls upon movement, the trees.png are in frount, one tree placed randomly once in a while. Both background and trees move at a slighlty different spead, so that they emulate a parallax.
Use the enemy.png for enemy who has 15 points of health and is controlled by ai.
Make sure the game has red / dark UI, is controlled with wsad, x - shot, z jump, c - defend. Disregard mobile controls. Add simple shot, hit, jump, death sounds. Upon defeat the player explodes, upon win, the monster explodes. The more health you have and the faster you defeat the monster the more points you get.




The end result was pretty good overall: you could walk around the area and fight a single enemy, called the Brute. Needless to say, I felt that the game was lacking something, say: the trees were standing out in front of the screen, both the character and the unit transparencies were improperly cut by the tool, and the game felt a bit boring at first. I realized, I could've been a bit more specific with my prompts.

Via trial and error approach I decided to slowly add new features to the game and improve the communication on what I want to achieve, trying to be a bit more specific this time around. My first few ideas were:
- add the ability to throw the grenades, a powerup,
- introduce the new enemy. Outside of that the game would finish with a boss fight.
My prompts were as follows:
Add grenade throw to the hero, make sure that each point of health adds more bonus than speed.
Remove the cap from speed bonus. Increase the speed of granade throws and change the button to v instead of s.
Now move the trees behind the floor and slightly lower than it starts, so they don't stand out.
Add normal enemy, based on the attached sprite: simple-enemy.png.
The boss is reached after 60 seconds of playing, each normal enemy has 2 hp, add ability to jump on obstacles and one extra level of floor (use the floor sprite for that).
Then add those two powerups from the powerups.png sprite.
Health adds one health bar
Laser shoot laser - 2 points of damage, 15 seconds time
Armor - add 2 armor pieces, displayed below health
Speed - increase speed of movement and shotsPlace them randomly on the map, typically higher than the player, so that he could reach them with jumps.
When you come to boss show a red flashign text boss fight for a while, shake the screen and add a grunting noise.


After a few more iterations, the game started looking more appealing and interesting. You could collect powerups, fight through different enemies, and then, by the end of your journey you had a boss waiting for you. This time around, the game a had a goal associated with it, thus it was a bit more engaing to play.


Play the first version
You can play the first version of the game, directly in the browser, by clicking on the following image. The game is hosted on my website and it's an HTML page. The game doesn't work on mobile, so you'll need a PC and a keyboard to play it.

Nature Quest Next few iterations
With that version of the game I was pretty satisfied with the result. I encountered a single problem however: my prompts were taking a lot of time, and the usage of the Claude was increasing drastically. So, to achieve the desired results faster, I applied for a fairly cheap pro plan, which would allow me to write more prompts and thus obtain more satisfying results. On top of that, I also decided to improve my prompts and assets a little bit.
Henceforth, after a few more tries, I realized that the simplest prompts were the best. I started avoiding long sentences and I decided to stick to something simpler instead, say:
Change controls to:
movement with arrows. Arrow up - jump
block d
attack a
grenade s
or
When tank is open, and nobody is in - show a message above - jump in!
With these, updated prompts, the results were a bit better and the credit usage has dropped down, quite drastically. With brand new motivation and positive energy, I decided to keep on going. I started introducing more assets, simple details to the game. Say, a soldier waiting for a rescue or a tank, that you could drive on your own.


Final Game & Summary
In total, it took me 38 tries to achieve the final result. While working with Claude, I realized that specific and short prompts were better than the ones in which I tried to be polite, generous and write complex statements. To the AI engine, this simply means less work to be done behind the scenes, thus less credits would have been used. You can read more about that topic at: https://mitsloanedtech.mit.edu/ai/basics/effective-prompts/.
Finally, after a few more tries of trial and error, I did achieve my goal and finished a simple game of two levels, I've added multiple characters to choose from, and a different music playing in each level.
You can play the full, finished game, by clicking on the following image.

Extras
- If you want to go through the whole Claude conversation, you can do so at: https://claude.ai/share/c43708c2-ef31-4434-8fc5-3ebefe0967aa.
- If you want to go through some of the ChatGPT prompts, I used to create certain assets, you can do so at: https://chatgpt.com/share/6aa7e7a1-bdb0-83ed-a601-492beb184fb3.
- If you want to check some of my other projects created with Claude, you can do so at: https://wp-doin.com/claude-created-projects/.





