Lesson 6: Tuning the Glide
It has been a smooth and painless ride so far, setting up the foundation of this little game. The basic mechanic is in place and the visuals get the point across. Jippity's AI took care of the heavy lifting of the code but left me plenty of opportunities to tinker and pick up some skills.
Now I want to go a little deeper and dig into the details of the way the bird glides. I am no expert in aviation or ornithology, so I will rely on Jippity to help me translate from ideas spelled out in words to functional code. I am going to have to describe what I want as precisely as I can — even with AI, nothing is for free! — but I am not going to worry about jargon. I also expect to tweak some numbers by hand according to my taste. Let's settle in and upgrade this bird's flight.
I'm not afraid of writing a long message. Details help! I fire off two prompts:
Let's work on the flying mechanic. I still want to control the pitch of the bird with A and D but I want to prevent the bird from tilting more than 60 degrees in either diretion from its starting position. I don't want the bird to fly backwards or upside down.
The bird should always keep flying to the right. Its speed in both x and y directions will depend on its angle. But just prevent A and D from inducing additional rotation when the limit is hit.
Jippity offers some updates to my code and does a good job summarizing its thinking:

The code does what I asked for: it prevents backwards or upside-down flight, but now I realize I should have asked for more. The bird should accelerate as it falls because of gravity; right now it always falls at the same speed. I ask for the changes, test them out, and repeat the cycle. Along the way I might tweak some numbers — it is hard to say if the strength of gravity should be 0.2 or 0.3 without testing — but I rely on the AI for any significant changes. Each change spurs new ideas. It's fun to follow the thread of these ideas, especially without soul-sucking bugs impeding my progress.
It takes about fifteen minutes to refine the gliding mechanics into a balanced game that feels sensitive and challenging. Along the way, I get a chance to think through some physics and even trigonometry. Jippity has my back when I need an explanation: [[trig.png]]
I make sure to ask for a Game Over screen when the bird collides with the ground, one that measures my flight distance. That makes the game that much more enticing to play over and over.

Jippity even seems to know what I mean when I ask to make the bird "more like a paper airplane."

After a few more minutes of little tweaks, the game is feeling mechanically right-on. This is a fun, and in fact addicting part of making a game: getting those numbers just right. It's like tuning up an instrument or sharpening a knife. Could do it all day! But at a certain point, it's time to move on to new elements. I'm getting close to ready-to-publish, so I want to add a bit of polish, some visual pizzazz, and then wrap it up.