Unity 2D Tutorial (ver 4.6) – Flappy Bird part 1

Hi people! My name is Julio and today we are going to start a new Flappy bird tutorial using the 2D tool of Unity 3D 4.6, our target will be Android; the first possible question is: Flappy who? And the answer will be: were you living under a rock? Here is a link to the web game and a little history:
http://flappybird.io
http://mashable.com/2014/02/10/flappy-bird-story/
The first step will be to launch Unity 4.6 and select a 2D new project:
Click on File -> New, select 2D and change the name to FlappyBird:

Now we need to create a new directory, go to projects tab at the bottom, right click -> create -> folder and change the name to img:

Next Step, save this image in your disk and then drag it and drop it inside the img folder in Unity 3D

sprites


It’s time to cut the sprites, click on the Sprites image, and edit it in the inspector tap at right. Then use the automatic slicer to cut the 2D sprites and apply the changes.

We need to create 5 empty objects, to maintain the order in the scene; click on GameObject -> Create Empty, the object will be background, player, pipes, camera and floor, after that drag the Main Camera inside the Camera Object.

We are going to save the scene now, click on Assets and Right Click inside it, then Create -> Folder change the name to “Scenes” then File-> Save Scene, click in the scenes folder and save the scene as flappyScene

Now we are going to add the Background, click on the Sprites image and open it, then select sprites_2 and drag it inside the Scene Tab, go to the inspector window and change de X and Y to 0,0 and change the name to BlueSky

It’s time to set the camera pixels, Click on File->Build Settings then Choose Android and click on Switch Platform; you need the Android SDK, if you don’t have it please follow this instructions before you switch http://docs.unity3d.com/Manual/android-sdksetup.html.
Then click on the game tab (if you don’t see it, click on Window->Game) and choose WVGA Portrait (480×800) in the video I chose different, please select the portrait mode

Let’s duplicate the BlueSky to make a scrolling background, right click on the BlueSky Object select Duplicate, go to the inspector window and change de X to 6.8 and change the name to BlueSky2

It’s time to create the floor, let’s do the same as the Background, click on the Sprites image and open it, then select sprites_5 and drag it inside the Scene Tab, go to the inspector window and change de X and Y to 0,-4.65 and change the name to BrownFloor, drag the BrownFloor inside the Floor Object, then duplicate the BrownFloor to make a scrolling floor, right click on the BrownFloor Object select Duplicate, go to the inspector window and change de X to 6.8 and change the name to BrownFloor 2, in the end change the spriteRenderer change the Order in Layer to 1 in both objects.


Time to make the Flappy Fly, select the Assets Folder in the project tab and create the folder “Animations” then click in the img folder, select the sprite_1 then press CTRL and select sprite_3 and sprite_4, drag them inside the Scene Tab, find the Animations folder and open it and save the animation as FlappyBird, change the name in the hierarchy tab to FlappyBird and drag it inside the player object.


In the inspector tab change the X position of the FlappyBird object to 0, if you click Play you’ll see the Flappy Bird flying, we can smooth the animation in unity 4.6, to do that we need the animation tab, go to Window -> Animation, click in the animation tab, then select the FlappyBird object in the hierarchy tab, you’ll see 3 rhombus with 2D images, select the sprite_3 in the img folder and drag it to the animation, next to the last rhomb, then click the rec button above the animation to stop editing the animation, click play to see the results.

The last part, drag the Sprite_0 to the scene tab, in the inspector change the X and Y position to 9 and -4.65, change the order in layer to 2, change the name to pipe1, drag it inside the pipes object and duplicate it, change the name of the new object to pipe2, rotate the object by changing the Z rotation to -180, change the Y position to 7.5


Finally select the FlappyBird Object and change the “order in layer” to 3 and that’s it, next tutorial we’ll start coding in unity 3D 4.6 (here – Part 2)
Good Luck

Advertisements

One thought on “Unity 2D Tutorial (ver 4.6) – Flappy Bird part 1

  1. Pingback: Ingresos Financieros, reporte de Noviembre – Diciembre | Single Tech Games

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s