I’ve built a clone of Flappy Bird in PlayCanvas.
Check out the project here:
https://playcanvas.com/project/375389/overview/flappy-bird
All I had to do to make the game is download the game’s sprite sheet and watch a YouTube video of the gameplay. I think I got pretty close to the original. There’s a little more tuning and tweaking but it’s nearly there. Pretty cool!
The game should run at 60FPS on pretty much any device. It’s only 280KB so loads super fast!
My one biggest take away from making the game:
I now use events for most inter-entity communication. So instead of doing:
ENTITY A:
var thing = app.root.findByName('Thing');
thing.script.myScript.doSomething();
ENTITY B:
doSomething: function () {
console.log('Let's do some work...');
},
I do:
ENTITY A:
app.fire('someevent');
ENTITY B:
initialize: function () {
app.on('someevent', function () {
console.log('Let's do some work...');
}, this);
},
This made my code way cleaner. I can’t believe I’ve only just started to use the event system in my games!! Check out the game’s source to see how I used events in more detail. I’m not saying it’s the best structured code in the world (it’s not tutorial-grade) but it should be of interest.