The Not-So-Angry Birds…In Six Simple Steps with Raspberry Pi
Angry Birds have had their day, but you can make your own game with Raspberry Pi in less time than it takes to download theirs! Our version with wings, parrots, and pipes is no pipe dream!
Here at Vilros, we love to bring you the most current DIY projects and games that Raspberry Pi has to offer. In this bird game, after you click the green flag, you’ll use the space bar to get the parrot to flap its wings and fly through pipes, scoring one point for each time you travel through a pair of pipes.
Before we start, you will need to…
Open a new project and choose any backdrop for your stage (one popular choice is “Blue Sky”).
Next, name the new sprite “Pipes” -- this will consist of two pipes with a gap between them.
Note: you can change the location and the size of the gap to increase or decrease difficulty. Move them up or down by dragging the rectangular pipe-sprites. Shrinking or growing them, however, requires code to link that change to the clicking of the flag. Coding is easy with a cause in gold and an effect in purple.
Also, your pipes can be any color and simply the result of copying, pasting, and dragging You can shade your pipes with a fade or ombre. Add another smaller rectangle atop the large one on each pipe to make them seem realer. The possibilities are endless!
What will appear to the player as different pipes will really be clones of the same pipe looped, glided, and deleted in a regular span of time (2 seconds is probably a good length to start)
Try choosing random gliding coordinates – this will create pipe gaps of varying size.
Your next step is to make a bird-sprite whose default state is falling down to the “stage floor.” Give it two costumes: wings up and wings down and place it left of center and shrunken (optimally at x:-50 and y:0 at 25% of its size) when the green flag is clicked.
Now it’s time to name your parrot. We like the name “Flappy” for our parrot, but you can choose any name your heart desires. To get Flappy into flight, connect a tap of the space bar with a change in y coordinate as well as repeating the wings up and down as is called for using code blocks.
Should your animated avian companion hit a pipe, the game, unfortunately, will come to an end.
You can use code blocks to play a sound when the bird sprite makes contact with a pipe sprite and display GAME OVER! on the screen. “Broadcast” and “Stop” blocks of code stop the pipes and Flappy and let them know the game has ended.
As Flappy’s x coordinate position changes and eventually comes to exceed each pipe, that should result in adding one point and possibly a sound. Keep track of a high score so you can continually try to beat your best.
For any more information about this project, you can learn more about your new Flappy friend here. As always, we at Vilros are happy to keep you updated with the most cutting-edge and recent Raspberry Pi projects. Thanks for reading and always remember to keep calm and flap on!
Comments will be approved before showing up.
GET IN TOUCH