Crafty Bird, a Flappy Bird clone with CraftStudio

screenshot2I am a little late to the party but I took a few hours to put together a Flappy Bird clone with CraftStudio.

Play it now !

I recommend you to use Chrome as the game loads very slowly in FireFox (at least for me).

You an check out the sources (CS project, the Lua code and the webplayer files) over at my GitHub account or open the project in CraftStudio (if your have it installed).

The game’s art comes from Clumsy Bird, a Flappy Bird clone made with Melon.js by Ellison Leão.

It also use my Simple Hosted Leaderboards system but for some reason I didn’t wanted players to enter their name in the game, so I set out to identify them based on their IP.

Unfortunately, the leaderboard system doesn’t allow to keep arbitrary data along with the player’s name and id so I needed another ways to keep the relation between the IPs and player ids. As the game was made for the webplayer, local storage wasn’t an option either.

So the only option left was keep this data in JSON on the web server.

When you connect to the page, PHP gets your IP then gets you player id from that JSON file. If your IP hasn’t been assigned to a player id yet (because it’s the first time you connect or because your IP has changed from last time) it gets a new id from the leaderboard.

Once PHP got the leaderboard data, your player id and both the page and the game have loaded, a JavaScript function on the index page gets called from the player and sets one of the game variable with you player id so that the game can post your best score in the leaderboard when you increase it.

It would probably have been easier to allow the leaderboard to store arbitrary data (or I could have used the player name to store the IP) than to fiddle with PHP and JS and the game like that but it’s awesome and interesting that you can do this, though !

As some have mentioned, the game is quite easy mostly because the gap between two pipes is generously large, but I spent enough time on this project already.

See you next time !

Comments are closed