This is the second post for a series of games I made to learn game development. This time, its flappy crappy bird.
You might be wondering, “But Solo, why is it called Crappy Bird?”. Well, my friend, there are several known bugs in the game, and I never found time to fix them. Try it out, let’s see how many of them can you find.
Scope
The scope of this project was to create a reasonable working copy of flappy bird, with pretty scrolling background and ambient music.
Process
I started by setting the global projects like viewport (since this is a mobile game). This was followed by adding a separate scene for the bird and adding in a beautiful pixel animation I found on itch. Also attached a script and restricted motion along the x axis, while keeping the gravity as is.
Then I proceeded to creating a pipes scene, using TileMapLayer as the base. It is divided into three parts, a top pipe, a bottom pipe, and a anti pipe Area2D node in between them. I imported my sprite sheet and used the brush tool to directly draw upon the tilemap and make the pipes. These purposes made longer than the required and went outside the viewport so that when we move them, no whitespace is left at top or bottom. Then I have a collision box to the tiles in the TileMapLayer. This was then proceeded with wiring up the signals from the node to the central game.gd script.
And there it was, a flappy bird clone that works (or should I say flies?). Only thing we need is some color to it. So I added the mountains and clouds and trees, by painting over the respective TileMapLayer nodes with different colors. Then ran them towards the -x direction just along with the pipes, with their individual speeds, creating a parallax effect. It wasn’t perfect, but it did its job and so I moved to the next part.
Once the game was functional, I added the score system and game over logic for when the player hits the pipe or the ground. This followed by adding sfx and the background track, along with the ui menus for game start and game over. And there it was, crappy bird was born!
Insights
While creating this game, I experimented with arrays in Godot. I stored all the parallax objects in an array, then repeated the same for their speeds and sprite sizes.
I applied this neat little trick where I copy paste the same exact sprite beside the first one. Let’s say the sprite x dimension is 100 units. The frame at which the sprite’s position becomes -100, I reset it to 0. This causes an illusion of infinite parallax sprites.
I’m not sure if this is a standard way of doing it, its just the way I found to be working for me. If fellow devs are reading this, feel free to reach out to me, if you have suggestions for doing this in a better way.
Another cool thing I did is I used TileMapLayer node and drew directly into using using my sprite sheet as a palette. The other way around of drawing them is aseprite and then importing with Sprite2D node is usually easier, but for game this small and simple, it wasn’t the effort.
So I adjusted the tilemap settings and used the brush to directly draw in the editor window. You’ll feel that the hills are low res and the clouds and trees are high res, because unsurprising they have different pixel sizes. I should have avoided doing that, but hey, we’ll save that for future projects.
Changes
Things I would do differently if I were make this game again:
- Make a flowchart of the game loop. (can’t stress on how much this simplifies the process)
- Use autoloads for global variables and sounds.
- Make sure all pixels in pixel art are of the same size.
Links
Credits
I would like to thank the following folks for making freely available assets, so I can use some of them to make this game.