|Top Previous Next|
This month's snippet tries to replicate the famous "Angry Birds", an iPhone game hit that has propagated throughout all the major gaming platforms, including the PC. Since my graphical skills are close to zero, I couldn't compete with the original; still, the code has enough meat to help you get started with your Angry Birds clone.
The game contains 5 levels; I had a normal childhood, so I didn't want to terrorize you with difficult levels; nevertheless, you can (and you should!) create stuff that's much more complicated.
You are the yellow burd (thank you for the model, Jane!) and your goal is to destroy the black bugs (thank you, Edin!) that have done something really bad to your happy burd family - not sure what they did to you, but it wasn't a good thing. So you've got 2 sliders in the upper left corner of the screen and you can set the horizontal and vertical speed of the burd before launching it. Then, you press the "space" key to launch the burd, hoping that it will knock down the evil bugs.
That's pretty much it; when you manage to knock down all the bugs you'll see a "congratulations" panel, and then a new level will be loaded.
We are also using brick walls in our levels; they can't be knocked down, so you'll have to plan everything carefully. Use the mouse wheel to zoom in / out if you need to.
I also included physics-based spheres in the game; I forgot to mention that all the code is using the new physics engine.
The enemies are counted automatically; their number, as well as the number of available burds, is displayed in the upper right corner, below the "Restart" button.
The picture below shows the last level in the game; it's the hardest level, but you shouldn't have any problems with it. In fact, you can remove the digits that show the actual forces if you'd like to make the game more interesting.
Feel free to create your own wacky levels; just do a search for "angry birds" in Google images and you'll get thousands and thousands of ideas.
This is the "Game Over" panel.
Please rest assured that the code is so heavily commented that I barely managed to carry it on my memory stick ;)