How to make an "Angry Birds" style game in 9 events

2

Index

Stats

11,193 visits, 22,937 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 8 May, 2015. Last updated 19 Feb, 2019

In this tutorial, we will add the speedy bird, that speeds up on its flight path while in the air.

If you want to follow along exactly, you will need to save this file:

It's the same size as the regular bird, 33x19.

Setting up the Speedy Bird

Make a new sprite, call it SpeedyBird, upload the file "speedybird" in the image editor, set the size to 66x38, close the image editor, place it at 40, 432, add the physics behavior, set it's density to 0.75, and its elasticity to 0.4. Man, that's a mouthful!

Your layout should now look something like this:

Adding the code for the Speedy Bird

Make a new global variable, name it "BirdType", set the Type to Text, and set the initial value to "Regular".

Add another condition to the 2nd event by right-clicking the word "System" and selecting "Add another condition".

Do this for it:

     System >> Compare variable >> BirdType >> Equal >> "Regular"

Ok, now it only shoots the blue bird if the "BirdType" is equal to "Regular".

On the fourth event, add some new actions, like so:

    System >> Wait >> 4 seconds
    System >> Set value >> BirdType >> "Speedy"
    System >> Set value >> AimingBoolean >> 1


Good. Now click on the left side of the gear next to "System", so it will select the second, third, and fourth events. Copy and paste them.

Now, on event 5, double-click the words "BirdType = 'Regular'" and replace "Regular" with "Speedy". Now double-click the blue bird on the action for event 5, click Back until it shows the object list, select SpeedyBird >> Set Position to another object, and set that object to be "Slingshot". Click Done.

Do the same thing we just did to the actions in events 6 and 7, just double-click the blue bird, click Back until it shows the object list, then select "SpeedyBird", and do the same actions, for example:

    SpeedyBird >> Set angle >> angle(Touch.X, Touch.Y, Slingshot.X Slingshot.Y)

Instead of:

    Bird >> Set angle >> angle(Touch.X, Touch.Y, Slingshot.X Slingshot.Y)

Do that for the rest of event 6 and event 7, and in event 7, delete the last three actions, as they will not be used.

Add another event:

    System >> Compare variable >> AimingBoolean >> Equal >> 0

Add another condition to that:

    System >> Compare variable >> BirdType >> Equal >> "Speedy"

Add a sub-event:

    Touch >> On tap gesture

Copy the second action on event 7 and paste it onto event 9.

We're all done! No more code!

Testing

Save your work.

Click the Run Layout button and see if it worked. If it did what it was supposed to do, you should be able to shoot the blue bird, and 4 seconds after you shoot it, the SpeedyBird will go into the slingshot for you to shoot. After you shoot it, while it is still in the air, you may touch the screen or click the mouse, and it will double in speed. Pretty nifty, right?

That's it for now!

If you have questions or suggestions, please comment.

Thanks!

  • 0 Comments

Want to leave a comment? Login or Register an account!