- Basically, the game series focuses on a flock of birds referred to by the same name who try to save their eggs from green-colored pigs. Inspired by the game Crush the Castle🏠, the game has been praised for its successful combination of fun gameplay, comical style, and low price. Its popularity led to many spin-offs, versions of Angry Birds created for PCs and video game consoles, a market for merchandise featuring its characters, Angry Birds Toons, a televised animated series, and two films; The Angry Birds Movie and its sequel The Angry Birds Movie 2. By January 2014, there had been over 2 billion downloads across all platforms 😎, including both regular and special editions
- If you are one of the people who like to learn through videos 😉, you can follow the explanation through a quick video on YouTube 👉
Part 1
Part 2
- In this article, we will create the Angry Birds game using unity 2d and some scripts using C# by following these steps 👉:
- create a new game on Unity Hub and name it whatever you want (in our example it will be Angry Birds)
- on your browser let’s search for opengameart.org to choose the appropriate bird images for our game, in the search bar type a bird and choose this one Link, download the package on your machine then move the images inside to the project on the Assets folder
- select all the images together and grab them to the Scene in order for animation then rename it to Green Bird, now when you run the project you should see :
- go back to opengameart.org and search for background, in my case I will choose this one Link, download it then move it to the Assets folder on the project, drag the background to the Scene and make sure that the Background Order in layer property is set to Zero, then allocate the bird on the left of the background and make it smaller.
- Now select the Green Bird animation on the Hierarchy and add a Rigidbody 2d component in order to make the Bird full down.
- Select the Background on the Hierarchy and add a BoxCollider 2D component, on the Inspector below the BoxCollider 2D click on Edit Collider then make the collider touch the grass line on the background (in order to make the bird full down on the grass line).
- Then select the Green Bird animation on the Hierarchy again and add a Polygon Collider 2D component to take the bird’s shape and make collide with the grass line when full down, now when you run the project you should see this 👉:
8. Now let’s play with the bird a little by changing the bird’s color when we click on it, to do that we have to create a C# script, firstly let’s create a new folder and name it Scripts open it and by clicking the mouse left button create > c# script, name it to bird then open the script with visual studio, add the following code to your bird script :
Now save the changes and go back to Unity and run the project, you should see 👉:
which is cool 😎
9. Then let’s move to the next step by dragging the bird which is easy by adding a Drag method to the Bird script, so let’s do that by adding the OnMouseDrag method so the code should look like this:
- Now you should see this when you run the project 👉:
10. Then let’s make the bird fly by adding the following code:
11. Now we will add some more restrictions to the code in order to restart the game when the bird flies out of the specified coordinates by adding the Update method:
I hope that was easy and clear to read more 😁, you can follow me on 😐