Godot Flappy Bird Writeup

Created August 27, 2026 by Abdullah Khan

Above is a playable version of flappy bird I created in 2 hours in the Godot game engine. I built this completely by myself using no AI whatsoever several months ago and never ended up posting it anywhere, so I've decided to give it a home on this website as the second blog post.

When I built this, I was taking a break from a larger project. All of my projects tend to be very ambitious so I end up spending a lot of time programming with no results. Eventually after months of work on the project, I was beginning to doubt myself. How could I even know if I'm a competitent developer when I've never built a working product? How can I expect myself to make an ambitious project if I'm not a good developer? I determine value by output, not work. Therefore, I had to build something and call it complete.

And then I did it. I decided I wanted to make flappy bird, and then within 2 hours I had this. Including the time it took to draw the bird sprite. So I call it a success. I am a good developer. You can play this game start to finish, physics function well, you respawn after you die, pipes spawn correctly spaced with randomized heights, etc. So let's talk about some of the engineering now.

The first thing I made was an autoload (or Singleton if you're familiar with unity) that keeps the master values for speed, and the distance between the pipes, and the score. There was no reason for me to keep the score in the autoload. The purpose of an autoload is to keep it's values after unloading scenes. All objects in the game are in a scene except for an autoload, and the restarting mechanism works by just reloading the scene, which resets all variables that are in scripts attached to objects in that scene. But the score is supposed to reset. I ran into a bug where it didn't reset the score after respawning, which I fixed by just manually setting the score to 0 in the ready function, but looking back, it would've been easier to just not have the score in the autoload and have it reset with everything else.

The pipes were really janky. I have a node off screen at the right that spawns a pipe on a timer. Remember that distance value I said? That doesn't actually make the spawner node make pipes a certain distance from each other. It's just used to calculate the amount of value for the timer by dividing the distance by the move speed. And the height at which the pipes spawn is determined by 2 more nodes. The 2 nodes are the minima and maxima for the heights of the pipes without them intersecting the floor or being above the viewport. These solutions feel incredibly janky, but they actually give a lot of control. Having the timer be determined by the speed and expected distance is incredibly helpful when I just want to adjust how far apart the pipes are from each other. I can adjust the speed without interfering with the distance between the pipes because, again, they're just inputs to a function. And to adjust the maximum and minimum heights of the the pipes, instead of having to guess and check while manually changing a variable's value, I can just drag around the nodes in my editor's viewport. The rotation of the bird on the other hand, while a mathematical approach would've been more elegant, I just flipped around values from positive or negative and just trial and errored it until I got it feeling right.

This was the line of code to calculate the rotation of the bird every frame: sprite_2d.rotation = max(lerp(sprite_2d.rotation, velocity.y / 1000, 0.5), -0.785)

Will I finish this game? No. I proved to myself that I could make a playable game, and so it no longer has any purpose for me. In order to be a finished game I would have to do just a few things: make a background, use a proper texture for the ground, make a pretty menu, and maybe if I'm feeling ambitious, make a leaderboard. Unfortunately, I'm not feeling ambitious. If you wanna play flappy bird, go google where you can play flappy bird. Plenty of people have made it, and I feel no need to make and publish something that someone else has already made if I can just link to it, especially if it's free. This was a learning exercise and having to draw a background isn't gonna make me learn a whole lot more, so I don't care.