Create a 2D game in Unity - Flappy bird clone | Petipois | Skillshare

Create a 2D game in Unity - Flappy bird clone


Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
24 Lessons (1h 47m)
    • 1. Course Intro

    • 2. Setting up files

    • 3. Creating PlaceholderArt

    • 4. Creating Scripts

    • 5. Creating Player

    • 6. Creating Obstacles

    • 7. Spawning Obstacles

    • 8. Randomizing Obstacles

    • 9. Creating ScoreUI

    • 10. Create GameOver

    • 11. Adding Scoring

    • 12. GameOver

    • 13. Player Art

    • 14. Obstacle Art

    • 15. Background Art

    • 16. UI Art

    • 17. UpdatingPlayer

    • 18. UpdatingObstacles

    • 19. Fixing Obstacles

    • 20. ScrollingBackground

    • 21. AddingSound

    • 22. UpdatingUI

    • 23. Creating Menu

    • 24. Fixing Issues


About This Class

In this course we will go step by step through the bare basics of the flappy bird mechanics and then we will flesh it out to make a fun and fully featured game.

You will make a flappy bird clone that can be played on PC or mobile. Take the essence of the flappy bird game and make it your own. Come and have fun with this Unity 2D project!

  • Create a 2d project in Unity
  • How to use prototype images
  • Create simple scripts using C#
  • Create pixel art assets
  • How to import assets into Unity
  • Using UI in Unity
  • Adding sounds to your game
  • How to publish your game to the web


1. Course Intro: welcome to be entering to creating Flappy Bird stocking immunity at the schools. We will, how to make a game taken from concept heart to own assets. And we will learn subscript ing poker big as to how to create any swirled and back grilled and also how to creates fording the game play. And we will also have to export it so that others could also benefit from more game something and in creation. So this is the idea off what the game will look like. His press plate could be it. You take like, mouse button screen because you could see and suggests for beginnings. But if it's your first game, even better, be happy to help you. You know, you don't have to make a simple game unity, so please follow it on tape, of course, and good luck with me as a way create 2. Setting up files: So Julia concerned of on a new project. First up, things were going to create a new aspect ratio. So they look like the, um, screen. So you're doing nine by 16. He doesn't know how to create one. Let me take on there. We change the reservation. Well, aspect, kids have already got one here. Be doing that. So next up, what we're going to do, you get to start to create our assets. Now we're hearing takes place. What assets? For now and then later on in the course with world and how to create a pixel in order to replace that. What way Do that in the SL s. It's folder. Okay? And you folded cold streets, then another folder. Cool. Oh, no, soldier, this is just so out work when you this is just so out work for when you see the project. You know, when everything's organized in a holder, it's a lot easier, isn't it? Now, in our inside are what for that we can go directly to create Sprite. You're gonna say triangle. Let's call it player extra, create another one. I'm looking because this time make it a square. I'm going to call that a little create one ball. You're gonna cool that that's this way again. Accents. And I would have free three different sprites and outward. And these will share how show onto the screen in the next video. 3. Creating PlaceholderArt: So now that we have that Celtic, let's start sketching at all. Seen I never gonna change to kick around to sort of kinda on a lovely so like blue, for example, this guy with a drag off flu artwork into the hierarchy See them that we have a white square and under the sprite rendering you've got kinda Each of them have changed that to a dark green that represent Ross. This glass will now what we will do we will use to transform to We will move it down. We'll scan it. Eight on the X on For what? We will also give it a box. Nothing. So that's all floor set up. Save the scene, um, or create new falls Air cooled scenes. Right? Andi, this will be cold. Excellent. That's well safe now. So next will drag in the plan from the artwork. As you see, I can go well wrote Judge Negative 90 on the set so that it will be pointing toe towards obstacles when they come. We'll give it a particle tonight to d and also a originality to d excellent, continue to safe. And if we play that now, what should happen is, it should fall to the ground. So now that we have those two things Okay, that's obstacle. So the obstacle dragging into the hands again this time we're gonna change this bright render a kinda too dark red on two bits slightly above the plan. And then we will change. And the why access on a scale e to good fights. Okay, well, give it a looks good on TV on, and we will duplicate it and control deal commodity on creating a slight gap. So the plant next you know, hierarchy way will create an empty game. Make sure that the transformers reset and we'll call. It was that we'll take two obstacles pipes. I drank those in now, huh? You could always adjust how much of the the pipe is too high to know. But that's all up to how How difficult you would like you're going to be. So they're selected now that we have this fool us again. Is that a transfer? Well, obstacle selected. We will drag that now into a prefab solder. So now you can see it turned blue to leave with seen on every time you want to call it just keep in What? But if we can, we don't doing this would be very arbitrary and very time consuming. So it against the next it's stop ah script for all these things to start working. 4. Creating Scripts: It's the best. We're gonna make our all our suite's best. So need a script for the like shoulder. We'll need a obstacle control way. Need another sweep. Currency shop script create. Hey. Okay, Manager. Okay. Session game section control lie school ring etcetera through the cups of whole player. Andi need some sort way to spawn in obstacles. So let me hopes to pull exit Now we want player. We will drag the plant solder slipped into the inspector on in our precept. Oh, no. Full obstacle in all a mobster who control this ripped on We'll make a new game object. We will call it you lobster rolls. Okay. Another thing we need to do to set up is on the plan to make a type. Um, it says andi also, I think that's it. And now we will actually stop doing scripts. We'll find one 5. Creating Player: from there to create another C sharp spread for the plan instead of going away, which had suddenly of that plan. So they're gonna say create soon shops whipped. I'm just gonna call it and c t we go on the plan. Andi will put that on this component, the accidents or if you have now and we will get the ball rolling. So the idea of having the player and was one that you took on screen or in this maybe person the space bar or clicking a mouse, we want it to up someone to do that. We're going to access its rigid body. Also use Steve Speed we want is one point for effort to mess around with That actually said public float so that you can always adjust that the inspector everyone access again refused to get your body on. That will be called player Stop. We will say you are you can get So now what has happened Now we want to check to see if a mouse is being clipped so say it could get mouse button down. You will say get the place velocity todo up frieze. Uh, see this couple with our name. So just for you, the player. So right. So now that we have that suit, it's just they play out. It's fine with a controlled by change. And then here it has to correspond to this year's Chris Plate. Three. What? So what we will do? Well, mess. You will. Right? Player jump. What do you believe that God can feel to it now? Keep going up and up and up. And so that is our player working. Well, just make sure the gravity scales. So I have sent you here to Sarah 0.6. Tell us to creation detective to 10 years going into a plate on If we play again, we'll see before it hits the ground. So then, yes, you're flapping. Excellent, right? The next step we go to had some control functionality to our obstacles. 6. Creating Obstacles: next, more open obstacle controller and we'll pick five feet way African Strangest rates up. Next. Transform position 23 speed. It'll be pushing to add a heavy at times time but don't turn, which basically means it will run them. What machine you want? One friend, Right? So that's what we need. Rob's could drawn up now. So goodbye. Continue to see guarantor pre fabs. Glad. One of the obstacles that with Chris play what should happen is it should move. Excellent. So now that is not absolute again. We believe on the scene. The next will stop on our storm for creating more obstacles. 7. Spawning Obstacles: So here we are in the obsequious sporting. Do you have time now? We need to wait before Really? School is a place. I just need a game object Three for to see the inspector. This will keep track of the time on whether it's closer to the next time we'll know. Well, Teoh, different shape. Height with Suspiria. Saiz. Okay, then it will be a random between around. So now Hey, Method just won the obstacle. So public obstacle Uh, do you know SSN? She ate the obstacle. And then we'll say the nukes to transform this issue equals transfer clumps. Sure. Yeah. Okay, right. Great for that. Okay. Said when we stop time to get into the update function, I will say, Is this equal to in the time? And we'll say, sense time, Martin this time. So what that means is that every frame, it will keep counting down until it gets to zero. Then it will go back up to the maximum time. Keep counting down, up to here again and now. So that should be what we need for our obstacle. Spooner. So hopefully and the inspector What? We will see who's There's variables being shown up. Excellent. So now you know pre fashion with drag off obstacle into that. See that? It's what supporter and coming to see it. Inspector. So here we have a few Michael's. We could select people. Select. Okay, Green. It was human here so I could live that where we want we could stop here. Stop here. We'll start here. It gives the player Trump's to actually, um, playing well, her months, just me of the player ups to So that's play this and see how this goes. Meat exporting enough place apple yet six. I could see the proof Febreze Air coming in smoothly and that is all small descript. So now we'll need a way creating school and new eyes that will be on next section. 8. Randomizing Obstacles: Okay, Now let's add a variant to the game so that the obstacles were sworn in different ways in order for there to be a variety of gameplay. So we'll open our obstacles, worn a script, the class reps here since one script. And at the moment we have a lot of height fixed, and we are every time we spawn it, where adding this heart to the height off the drugs from position Do you want to do you get rid of this one fixed when you I'm going to make to new flips a public men part. And next, we're going to initialize the men height public with the initials Teoh zero. When our next right it could be any number. It could be less than that. Let's use this for them. Um, And then in the storm obstacle flexion, we will say crate will be equal to, um London range between midnight's safe. Now it's diverse forms like Bible put 617 actually gonna increase the next night. That's it to to to school quality. And now let's to So I press play on at different points. You notice? Yeah, school. If it points, you can see, it's pointed up here that it's one here that down it's working. It's not very, um, distinct. You can see that that what you would different, different heights. So now it well make a variety of game play, which is great. Andi, As we saw at the beginning, there was two generated. So we'll do just remove small obstacles from our start function and again, and that should make that never go away. It was disappointing to time We got one. We could also do the same with the rape of the sport as well. For now, we will keep it. Oh, put for it home to nothing too soon. Okay, so next year we won't so out the game it 9. Creating ScoreUI: Okay, so now we blow. Stop. My great Yinsen! Look at you, Manny. In this episode do score text to make it bold. You changed. Screen size takes three. Change that to three in the middle. Next, it's Anneli up school. Taste on the campus changed the scale with screen size. 1920 10. 80. You said it's transferable script. No apron. That script right at the top. Now that we have with that text, I will say score text text means school because I continued, like in our school text. Well, Jason, back to you, right? What should happen? Yep. You guessed it. It will be easier friends again. We also want a play of C. How to one. The plane hits the ground. It's going to need some sort of gave a screen, um, so that you could be playing. And that's what we were doing next. 10. Create GameOver: next we will create in the canvas. Rick, I hope you come. You. Why? This will be I May he change that to change the It's well create texts. Okay, This it's it's bigger changing. Okay, so how? Well, so what you are button stretch across. This is way have played again. Thanks. And that on? We need a way accessing or great. So real quick. Our game managers and class point game. Okay, on this would be se se I see clipan. We try. People do this for us. I wouldn't. Who took you making this a reality in the next? 11. Adding Scoring: Okay, so here we out and buddy for obstacle. Obstacle to what's contagious. When we have a school section a boxcar load up, which is a square about the went under the box can idea set to trigger on a rigid body Said to kid about it It also has a tag cord score space. This will help us with a score safe. Now we're gonna need a way to access That festival will start off with our game session medical on what we will do will create accessing Give us a manager for pretty strict. So we'll do that by creating what's called a symbol to wait function which is basically called justice looking Teoh before that public. Okay, just I will say it. No, not it's authorities else. So basically this is saying if that's a vaginal script already on scene, destroy it If no, this is it. I keep this Now we will create a mother, but I checked out on the update public What? What? This will do it well. Be a way of up to the Scots Also School? Yes, Full could soon school plus plus Okay, Every time we want to go through something we went back to the school. So now we're going toe a play script. What we will do if, say, Boyd se don't time. It has to You have to talk it exactly the way it is fixed. It will say Okay, Don't had to school. Okay, so no seek this way. Oh, no! Plan Trickett issue See, It departments has entered to date tonight, right? This works correctly every time. It the screen I have been through occurs, you know, it's it would not like to Okay. Yeah. Lucky guy. Now it's very easy at the moment because we haven't left a month ago. 12. GameOver: Okay, So in this section, we will look at whenever we knock into something that is not score space once again to stop Poor's all the game It was screened to show acceptance. What we will do. You open up. Our players worked so more script now in the young should get into to date. We have a section trusted with school spirits. Never gonna say on condition, condition and they will say came session manager because he created that yet in the game section monitor script public Boyd of gain. Um, which basically shows panel together we will also need to do something way. Stop the obstacles from it. We will do that with time dot Initiate that. So whenever a mate was cool, it will stop everything that's being renovated or school every and then shade. We want to make sure that in all stop from the same time. Don't turn scale cruise. Yeah. Now, time the time scale. I realized that So what we will do Stop a check in the reflection Inclusion Enter tooty Because if it's not, uh I just swore spits ever go to any other position? Listen, what? Even if the streets so Let's try sector. Yes, as we forced to ground, we have made the screen infected. Detroit Never gonna get so successfully. Good. If you consider getting hotter and hotter if you tell me plates, it's never the same. I think what we'll do agree what? The player So that we're adding a force instead, so do that. 13. Player Art: Okay, so here we out wigger to know create a plan. Now he's a a software called pixel at it, and we're gonna make four times why they're 13 Fight to the stages of innovation and you could use any, uh, so for you. What a night. Really? That using? It's let it. There are many wants out that. So I'm going to make a plan. So you see, second circle? Yeah. Lives. What is this? You Do You okay? I think so. So you sorry. Green? Yes. To it. What? When it comes Teoh. But much of this more or less shape that we go that dick Dick you, But just slightly. It's with debt. Screen a very, isn't it? Except Yeah, You said that. In what order? Yeah, sank the same I'm saying Should be the same quick it date. Excellent place. Okay. Yeah, that is I want so you can 14. Obstacle Art: similar so up for obstacles without reason. A 32 32 years of 16. 16 got to my house instead of so stop it a cycle that I'm making a special. My obstacle. I have No, it's a color that well school. Okay, now we will explore this. I see. I guess it it could be pipes. Let the video game with that. Good for you. Be anything. It's the theme off in this case, more The kitchen. The P was because player. So if my obstacle flicks, we could be too the next. All right? 15. Background Art: Okay. Now I have a single page document. You're 28 pixels by 120 pixels. I think we're going to create, like, a sharp stick into a kitchen theme. Put some sort of jars and bottles of show difficult that at some color it's Regi took. Come out. Great pilots. Doesn't that ground we've got? Maybe a darker shade of the same color would live this long. It's only going to scroll with backgrounds. We want to make sure that the left side of the screen and And I think this is that and we're going to agonized did you out? This is a quick park up that ground. I mean, I encourage you to spend as much time you want your because it's gonna be I see right shut in here did it. That's pick up on the the president. This cape. Okay, They said like, my dear, just be created se expensive. Here, Jake. Come on. That is it. So next one 16. UI Art: 17. UpdatingPlayer: So help me out. I have my play, a character. I just pixel character. You better make sure like and that's what ground split version. So I want to explore the image earned. What a little. And I save it as a PMT. From now I will go into unity. There is now It's recognize it's a sprite and spread it. Yes, a boy. And very well, too. Wait, we'll say it's just 16 you know, Spread it. I want to do. Also has fainted from single too. Okay, Yes, it would slice it. I get by self size 16. It's cut Very well. So I should say just okay? Yeah, not like this tab. You see all these sports? That's what she maybe three players? No, it is. So I would think that going to and under here you have a sprite maker. It's gonna change that to on. They're also going to I could never removed the bullet Kaleida had. Instead, we're gonna have a sick consumer character. I'm going to edit glider just a little bit more with the ship. Good changes. Say that. See? This is well good. You have to. There is We have successfully How do you play now? What I'm gonna do one have the K selected. So would bear other mention. Just cool it bouncing animation to my assets folder solder operation. And I'm gonna say, uh, he doubts that's for right. Now get back to Outward, Soldier. Yeah, got 123 I'm going to select all great into the first his if you play it back, it's very, very fast. Change started. So who were these key frames? I've got 05 Should be a little bits. Made the transition have a little support. I do have a copy of this frame, so you should have a that one. And if we king selected Window Ana Mater Soupy Bounce is already default automation. They never You could also add the statement, Guys. Yeah, back with the character, I will say animation. We have a new nation, people that pdf You say that now what? I want one frame. Yeah, that will look like that. I made it up animation, but those two and we'll set up to transition those here. Is it, like now to save your scene? Oh, that's playing to what we have. Yeah, he's into question this Well, all right, so next we will continue pipes, and that will create a scrolling break 18. UpdatingObstacles: you hear me out without schools? So this is supposed to be a He's They look at it. Replace on pipes. Were gonna say again, export image. You make sure we are in the right location. This court obstacles want disappeared. G five safe. That is, to open up. It is again. It's like it as a sprite with multiple and five stain. And you do the same change. Obstacle. The one ritual, it's just get will be set. I see mystical scene and the score section slightly. Just it's what's the idea? Oops. Apply. You know this woman safe? This is wise. Okay. The screen to tend them. Spread your back. Absolutely. Just fine. This. Let's see. Yeah. Okay. Okay. Oh, good said, you know, we have the well obstacle. You can see that it's change. Please. My room obstacle. It was just know. And next we will talk about that. Save it. Minutes 19. Fixing Obstacles: so that will fix the issue. Would be obstacles sport that stays in the city. That's ready. So what we will do, We will see and the absolute and I've created a flow of destroyed position, which is to a take a good look to eight. You know that it's completely but the negative. So now I said, if transport position Toe X is less than or equal to this number, but it's good to, we're gonna destroy it. Well, that's suitable. That looks like in practice. So you should see this region when Congress passed that point. Destroy itself. It's good. Stay with the higher up you should see, does it to upset Try it. That is a book. Next on what we land on the ground. We're going to next week the innovation so that it plays a lot 20. ScrollingBackground: so happy out without background kitchen theme with Had 12 and very sorry. Sorry yet. Well, you say that to, uh, older, not good community. It's What? God, What? The six. It's working 16. I drank it in here. See with us. You so good. Skin it. So they talk. Move it to back. Have little creep descript cool e house to a group. I know we said this. Okay, it's free, you know that. Okay, This one just like that, right? You go to that. It's flush. These numbers will be very important. Next step free. So these values will Sure that we get to a seven point in the background. Step two, uh, its previous position. Then it will keep swollen it around. Do that by saying transform position that $3. So time to scroll speed time. Which basically means it's athletes, Peter. But in bringing certainly open get rid. Having lost consistent, we're gonna see if transfer the patient Don't mix, because let's go to the exposition. It is saying to close to still to it, that state sake transform position it because it's a basic. He was saying once the that's the background gets to a certain point. Snap it back to to the starting position. But it was supported. You say that? No good to unity. That's a compile. And we will have people variables where they made this full speed of we're gonna make started. Say it's the 2nd 1 since tipping six by the end of next to Yeah, that's seven. So once it gets to minus it, we're no, actually no sound with skinny way triggering a player. Yeah, make a sound. What? It flexor jumps, But that's what we would do in the next. 21. AddingSound: no sounds file, but there's three like that, so I know that. Okay. I'm saying that you don't get that's what controls. Oh, okay. Okay, So we're acting school. A way to it's a you say at school. Further. Yeah, our That's to school. It's just going to say yes. Shut it certainly hit the belts book. So now it's a virgin. It's here, Suze. Eight today. Suits that. Yes. Okay, so let's see. It's looks. So what we're going to do to change it you with? Ah, wait since Good. You see, uh uh would be nice. It's a little bit graphic place. Uh, yeah. By file. Worlds. Obstacles, please. Yeah. So get recess Canvas getting Teoh. Are you going to add a peas to, like, Quick? You say you Yeah, it's health points to stay alive. What time? No, let's play. See? You know, say that. Go to work Here. That's again. Hey, Leo. OK, you cool? And what is during? Just say by that it is. You should have three, but to say life, it took a lot of these it would create at a bench for you. Sure. That's a to great. No sense. Thank you. one boy, 23 That should be here. Okay, this week. Rotating automation to precepts. Folding, Do you see? That would be dry awful up stippling, But it's a school section needs toe grab zero. It has to be. And on just like the schools. It's a and what's coming said they'll be killed. Well, we have to make sure that the attack is the same. Yeah, okay, now you can actually tonight Section Prefect Oh, just again. Let me personally should see everything. Comedy. Good, Nice. So it's not destroying when that it's because when I had it at school, it's you need to pull. So then we have to say object. Sure. Now okay, Plowing person, please. Yes, we connect it district. Then we go. But it's sound sorted out our or added Let it more visual cues. See for the place people playing your game to be able to see if you notice when I try to look Iraqi, notice what happens every time. There's no three obstacles here, but if you continue playing, just it's what we're here to. Dogo. Very, very sick. Delete off today after that sweet 22. UpdatingUI: So here we are. In Allah, you rely file the pixel edit. I have great. Another going up five area where we get to music for buttons and a little So you highlights . Looks like this will be exported. I got it. Yeah, it's 16. Cool. Please. This would Oh, you sliced it by you. Could that you? This was okay. This will. All right, so now we have. So we're going to I tripped at the source of it, but here we have our paddle head girl, I realized Thanks. Thanks. Right. I just played. Did you just think There? There we go. I don't say that. Did this great. Should be to see they get very upset since we updated. Why? At ports. But you with you, I would do that. 23. Creating Menu: Okay, so now we're going to create many kind of. So we've got a copy. The It may have a kernel that we had duplicate that. Make sure that it's visible. We will change the way I have a good to open this up in the text area. We're going to change it from I want to Okay. You know me on the button text. We're gonna change to play. I want me what to do. Want to suspend the play, huh? From being in the higher upset, Remember, it's active, but make it get active. And then what? Liberty, Stop playing how you should see a happy on screen. So what? We will do it even get you Get back to a plan. Look said with the we've got all the elements ready. And if you look on the button at the moment, it's got the game. Such a letter to retry election. But we want to change that. Oh, well. Script, good fishing my script and we will at public, which is true or false. Thank you. And we're going to call it gonna realize that basically will meet until it's true. We're not gonna be able to do it. And then we will also create a public Boyd start game. You will change that from that trip and then I'm at the top will create that extra. So when the game started, we would take religious sect. Do you also say false? It'll take the player p active. So that's that on in our place script. You want to say, If we hit the screen with the mouse, Andi should Instant stuff they started is equal to truth. Then it will do the action if no, not do the action. You know, obstacle controller. They were the same. Yeah, game session, but it against Don't game started. Actually, we'll put a exclamation mark before it to make it. Also, it's false. 10. Basically, don't do anything else. Under this point, they went. It will be the same obstacle. Sporting better They started. Okay, Now that compliant. When that's changed, we're going to train the function. That's probably object. So it's a game section manager in se stuck Save that have been game manager object. We will drag in our and we would drive in all player, but they all the player itself. We will visualize it. The first place. Now my background was still scroll, but well, we press play now. Okay, Area. And if we we have our animation engine to a different animation and that is the full game, the next woman about how to export 24. Fixing Issues: so that will fix the issue with the obstacles swarmed that stays in the sea. Say what you will do. We will see and and I've created a flow of destroy position. Just making a get a good eight. You know that. It's completely negative. I see. So now listen. If I transform a position, Toe X is less than or equal to this number. But again, we're gonna destroy it. Well, that's suitable. That looks like in practice. So we should see this region when the obstacle race past that point destroy it. I stayed with the higher from here. This should see he does it to upset. That is a book on what we land on the ground. We're going to next week the innovation so that it plays. So now we're going to make sure that we get something we play are dead. So live Claire selected. You can see no other. Probably have p bounce, which is down. Hey, debates. We have peed in the only way to get from people to Peter and I will take away the exit time . Pretty sexy expiration would it should be. It's And then we will make a parameter to make sure that when that what? We could see a list of conditions. This is empty at a list, but it has hit is true then PPI debt Country did that. And I see you should So when that becomes true that it will play this average. Just so now we're going to a strip placement will say Okay, Delicious. It stayed. That's it, Carol Betis! At the end of makes up, we're gonna say to trip. Save that! I said. Now they compile now, Chris Plate! No, Teoh. Make sure that way. Take it. Motivator. There's its components over the attached. Try that again. This is a pilot. You should see. That's what it hits. We have our and that way. See it here. Coming. Thank you. There's on Adaptation for our peace