Make a 2D Platformer Video Game with Unity and PlayMaker (no coding required) [Part 1] | Brandon Wu | Skillshare

Make a 2D Platformer Video Game with Unity and PlayMaker (no coding required) [Part 1]

Brandon Wu, Founder of Studio Pepwuper - a Game Studio

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
11 Lessons (1h 11m)
    • 1. 01 Intro

      0:54
    • 2. 02 Single Sprite

      5:21
    • 3. 03 Multiple Sprites

      9:02
    • 4. 04 Animations Fin

      11:40
    • 5. 05 Animations Finish, 3D View, Conclusion

      7:59
    • 6. 06 Animations Review

      6:17
    • 7. 07 Sprite Sheet Animation

      13:40
    • 8. 08 Introduction to Changing Animations with Input and Import PM

      1:35
    • 9. 09 Key Control Part 1

      4:42
    • 10. 10 Key Control Part 2

      5:02
    • 11. 11 Key Control with PlayMaker Add on

      5:15
25 students are watching this class

About This Class

7a42d2f9

Note: This is part 1 in the series: Make a 2D Platformer Video Game with Unity and PlayMaker (no coding required). Find part 2 here, part 3 here and part 4 here.

Teacher: @theBrandonWu

Now that Unity supports 2D games, we can make a game in one of my favorite genres – a 2D platformer! (Think Super Mario Bros. on the NES... ah those were the days!)

In this series, which is the perfect follow up from class 1 (I recommend you take at least the first 2 weeks of class 1), we’ll go over the basics of Unity 2D, sprites and animations, 2D physics, and all the controls you need to get a 2D platformer going.

And all of this without writing a line of code, thanks to the power of the awesome Unity plugin: PlayMaker!

The class at a glance:

  • Bite-sized, Easy to Follow Video Lessons
  • Self-Paced Online Class with Fellow Student and Teacher Support

Here’s what you’ll learn in this series (it's divided into 4 parts):

  • Part 1: Introduction to 2D space in Unity
  • Part 2: Introduction to our 2D platformed game and setting up player character
  • Part 3: Dealing with Camera – the easy setup vs the complex setup
  • Part 4: Setting up Enemies, HP, and Attack before we wrap up!

Who is This Class for?

This class is for beginners with a basic understanding of Unity and PlayMaker. If you’ve never used Unity or PlayMaker, you can start with this class first. Both courses are adult and kid-friendly! :)

What You Will Need

  • 7-10 hours of free time as we dive into the process of 2D game development. 
  • A modern PC / Mac with 3D graphic compatibility (if you bought your computer in the past 5 years, you should be good to go.)
  • A download and installation of the Unity3D game engine http://www.unity3d.com/. Don’t worry about the seemingly complicated interface, we will go over it in the class – piece of cake!

About Playmaker

  • Students will be provided a special student version of the popular Unity 3D ToolPlayMaker. This is the tool that enables us to create games without writing code. Thanks to Hutong Games, this special student version will include ALL actions in the tool (note: student version not for commercial use).
  • Commercial version of PlayMaker – we strongly recommend buying a license for PlayMaker. Although you can use the student version of PlayMaker for the class, the class is really designed with a commercial version and it allows the use of additional free add-ons and tools to make your game development life easier. It is one of our favorite #gamedev tools ever!

What Students are Saying About Brandon’s Classes

“Exactly what I needed to begin my journey into game development. I will DEFINITELY take ANY other classes taught by Brandon Wu! Thank you Brandon!!”
– Nicholas Mitchell

 

“Time and money well spent. I have no coding experience at all but thanks to this class I feel much more confident about game dev process. Thanks for this amazing class!”
– Sung Kim (Animator)

 

“Brandon Wu’s class was simply the most richest online educational experience I’ve ever had! So much content, so much detail, and so so much fun! I would recommend this class to anyone who has even the slightest of interest in how games are made. I’ve paid 50 times more for an online class, and this has been the best!”
– Brian Anderson

 

“Great class!! Enjoyed making the projects. The amount of information covered in 4 weeks, was just right. Instructor was knowledgeable and supportive.”
– Greg D.

Transcripts

1. 01 Intro: so we know that unity has added a two D component to the system. And, uh, scores. I want us would have introduced you to how you can create unity to D game using some of the new features talking in this two D update and also how you can use some of the knee animator and information tools to help you create these animations. So, for example, here we have a very simple basic fish swimming in the scene, and it's got some basic animations, and everything here is done inside unity. Using the animation tools eso we will show you how to do this to start with, and then we'll go into some of the other things they can do with the new unity to D tools. 2. 02 Single Sprite: so that's start any project and see how in set this up. Of course, you can t one and down here you can set up a defaults for two day instead of three D. And what this does is when you import a new texture in the image, it's going to treat it as a sprite, which is something that were used for two D and also for some of the physics, a swell. So let's do that. And if you forget about this, if you forgot, them can also go in and go into the options later and change that. So don't worry too much about it. If you forgot about this, but said that two d create project now, ready to concede We don't have anything in the asset. Now notice that there is a two D button. This is new. So when you click on it, which is show you the two D V off your scene, you can switch back and forth, right, So this sort of gives you the flexibility of combining both two D and three D elements in a scene that project settings and then attitude. Those is where we can switch between for the default behavior. Mod could switch between three D and two D. And as I was mentioning, this is where If you forgot to set it earlier, you can do it here. Just make sure it's two d. OK, now we want some two D images in the game, right? So go back to D, and I'm going to import a fire into this thing. And I'll make these available for you to download its bow. So I'm gonna track the fish image into my asset photo. You can see that there is now there's the button that you can click, And that's because if you click on this image can see that this is set to be Sprite instead of a texture. And, uh, we'll get into this a little bit later. But this basically shows you the difference slices inside the sprite that you can use right ? But that's just, um, one second I'm going to change this to one column. They are. It's just a little bit easier for me. I like I like that better. Simpler as you can see now we have that and then we have fish. We'll talk about that in a bit. So all you need to do is track this into a scene. You can see that now you have fish die on the screen on. You can do all the basic things you could dio in three here into the Israeli move. I can rotate and you can scale. Okay, But you noticed acting the news in the transform A different hand of different style, right? So, for example, if we click on the camera, you see that this is a different Kendall. But on the fish, now we have the square looking thing with different buttons, and I'll tell you more about it in a minute. But basically, that happens. One assistant decided. Okay, this is a sprite. This is for two D component, and we're gonna need different things for now. This is good, because you could do scale and rotation directly on this object, which will be very handy when we start during animations. Okay. I'm gonna reset. Okay, so So that's it. That's does We now have a fish in the scene, and it's not animated. So another thing we could do Oh, uh, also I forget to mention if you click on the fish you play could see that the immunity Let's go to the free TV. Unity automatically creates a mesh. The theory matched to contain this, uh, this two D image. Yes, you can see. So it's really nice. If you want to add a collider, it could be off exact same shape. And unity is taking care of all the work you need to do in order to show this to the image on in. It's in the 30 World. So when we talk about unity to two games, you're still setting everything up in 30. But with these tools for you to make it easier, right, So So you can see that. That's sort of the boundary off that image. This is the mashed that was generated for the still fish. 3. 03 Multiple Sprites: and I just realized I forgot to check one thing which is in the man camera on the main camera. He want an author graphic camera V. So? So everything looks flat instead of a prospective me where things can start to look bit more three D privacy. You can use that to your advantage as well. But for two games that set this to also graphic camera. Okay, good. Now, uh, I want to do next is introduce you to a few more things that we can use now. Obviously, bringing this to D Ellman into the game was fairly easy, but I want to start animating different parts on this image, and that requires a different set up. So I have this image that has all the different parts of the fish. We got the body, get fins, I highbrow and they tied it a tale. And this is going to be the image we want years. And let me just show you why Importance first. Okay, so it's here. That's open a preview. It looks just like the amazed I just Shojaei on and here we want to go up to Sprite mode. We want you to know that this is going to be a sprite. This is gonna be a Nimitz. Would several sprite in it click on Sprite edited? Okay, so here is where you can slice up this image into separate several different parts that you can use. Click on sly eyes and you can do it two ways. You can dio are their grit slice. If you do that, then these are going to be the sort of separate parts that you can use. But that's not exactly how we set of the original image. And we'll do that in the the next later on in cores where you will have a different set up where we want to use script. But for now, we're gonna use automatic, and I think everything I was fine, but a delete existing slices because that's incorrect. We're just clicking supplies and you can see that Unity has found the different parts. He this image start with my 12 years, and if you click on each one of them, you can sort of tweak them a little bit. So I'm gonna rename some of these things. I'm gonna rename this one friend, uh, that beyond, uh, left, and then this one will be right on A This is just so them. We later on animate. We will know that where, uh, which objects are related to which image? Right. So another thing you can do is you can change the pivot point on. This sort of determines how the image, what we positioned, then rotate it. It's similar to what we did with 30 objects, so I'm just just manually creating changing some some of these these air. Okay, uh, for this one. Let's see. Okay. Does too. Okay. There, there again. Okay, so I've got everything set up properly or think chance t to that part. Okay? It apply. So changes a replied close this. Now you can see that instead of just having one sprite. Now, have several of these components. Okay, Show them. Just disable this one. So that was Theo originally, fish. Now we have this fish part. That's, um drag the body and and then start reconstructing this fish. Now, let me show you what happens if you just drag this thing and I can't actually do that. That basically just grabs the very first component and different first subject and that's not what you want. So another thing you might try to do as you might grab all them dragged them in. What this end up doing is it will try to create an animation from all these different images. And we'll use that, uh, a little bit later. But for now, we kind of have to just sort of reconstruct them that the fish from these different parts. Okay, so just gonna track them all to saying okay and then moving around live, and I'm gonna turn off white frame. Okay, so there, in roughly the right positions, but you can see that some of them are supposed to be behind the others. And and it's not the optimal set up right now intensive which insurance should go on top of the other. But the way we saw these different image images as by creating a sorting later, and then we'll tell unity which one should be on top of the others. Right? So it's good to sort of layer, and you can either use the default, but I kind of like having having their new on just so that would know which one is being used for different objects. So go back, Teoh all these different parts, and then it's just go fish body, keep body at zero. And I I think I wanted to go on top of it. So the higher the number in the layer in the order in layer the it's going to go on top of the images. That's a lower number. So if I changes to to see that the body is now on top of the I said so that zero eyebrow, it was gonna be on the one. Actually, it's going to go to make sure that this is the right player, the fin on the left. That's for this to negative one. It's gonna be behind the body. Anyone, right? It's gonna be It's pretty in there, too. And tell me, keep it at zero. So I think tail and body should I think it's just it's fine if they're the same, have the same order. Okay, as quickly safe seeing. Okay, so now we have all these different parts on screen. Let me just sort of reposition them a little bit more. Okay? No. So I want this is a bigger just so that we can see it a little bit better with my chins that back in a bit. But the next thing on the deer is, we want to make sure that they're all the same object so we can animate them better. So I want to do is just gonna grab everything except body because I just decided that's gonna be my parent object. I'm just gonna grab these. So now that's my fish. See, that's my new fish trade it. And the reason why we want to do this instead of having this thing here, it's obvious, e all sort of having that terror is now we can go in and we can actually enemy given quiet on this fish. 4. 04 Animations Fin: next thing I wanna do is animating this first, right? So I kind of want this Finn to rotate when the sorts of that exactly. Swimming on the I to me, Um, maybe do something we defend at the tail as well held. We do that right. So very quickly. That's first disable fish. We don't need it anywhere and click on this fish, and then let's go to window animation. All right, so this is the animation tool that we're gonna be using to animate different parts off the fish. We're gonna put this down here so it's a little bit easier to manage the concept of animating something. It is very simple, right? So it's over a period of time. You want something to change. So that's the basic idea of animation. And the animation tool basically allows you to do that was your There's a time long time going up there and here you're gonna add all the different things that needs to change When the game stars when we go through time, be yes. Click on this animation. When we look at the animation tool, we noticed that there is no there's nothing here. Right click on this. Drop down many where if you have animations ready, then see them down here. But there's nothing there. So click on this we can simply click on creating Club. This allows you to create a new animation clip for for this object. So that's create name this swim. So that's gonna be the swing animation and a couple things happened. One. We have a new swimming animation file. We also have this new animator file. What does the animated you So that's click back home, this subject considering now over sudden there's a new up component to the subject called Animator. If you double click on it, you anti opens up, opens up the animator control window. You can see that the others the stream animation In there, The animator basically controls the animations that you have for the subject. We're gonna come back to the animators soon, but for now let's just focus on the animation as long as we know that the swim animation is inside the animator and the animated is inside the object. Now we know the animation will be controlled properly, so let's go back to the scene, okay? And, uh, a couple more things here is he because the timeline you can left click and drag on the timeline to see the animation? Once we have something down here that were animating and you can zoom into now using your middle mouse button and the school wheel and down here it is a samples 60 and that means we're going to have 60 frames in a second Now you can use those to speed up or slow down on animation and will be more obvious once we get going. But basically, that's how many friends you're going to define inside a second. How many friends you want. So that's C that's enemy this Finn. First, this fit in the back, it's left fin. Now you notice that there is this red button that when I click on it, the entire but intends red the controls up here also turns red. And that means we're recording man. So anything that's changing in the scene is going to be recorded into the animation on this frame. Now we're at the very first friends. You're a frame here. So what I want to do is I want to say OK, the 30th frame. I want this to be down here. We can see that from zero. It was appear. 30 is frame. Now the fin is down here. If we click drag across, Timeline can see that moving. Forget play. You'll see the animation playing now that the animation doesn't quite loop because it goes from 0 to 30 to 60 and then, actually it was a 30 then it jumps back 20 which is where the things up all the way up here and that's not what we want. So let's create another key. All right, So what we're doing here is there are all these different frames and we had a key to it, and we have a key on a frame. It records the variable number and then basically calculates what's necessary for it to move from this number here. Petition here to this number here, and everything in between is calculator dramatically. So all we need to do is manually adding these key frames, and then the system will take care of everything you between, so that's very convenient. Now let's go to Teoh frame 60 just completeness loop and I want to do is double click on this here. I had a key friend. Then a key frame is where we record the variables would want to be at a certain position or rotation or number. Right. So, uh, you can double click on it. Or you can click on this button here. Yes, well, kind. Now we want this number to be the same as this. So he basically goes here, and then we'll taste back to the original so you can click on this copy click on this again and paste. So now you can see that the number is to say so. You'd expect an emissions to go defend to go down and then back up again. Okay, Can play cancer. That looks Quicken. Let's do the same thing with the other thing. All right, On this time I'm gonna do it slightly differently. I'm going to do is I'm going. I'm going to click on add curve. So instead of directly manipulating object and have the animation to recording it, I'm simply going to add the object from the ad curve menu. And what at curve means is it's adding an animation curve. We'll talk about animation curves a bit, but let's click on that select the component we want enemy. I want to be fit on the right and the rotation. And what you notice is when you do that, we used the ad curve button. It created two key frames, created the getting one and and one and then they have the exact same number. That's zero, and that's also zero. So that's a nice way for you to create something that loops back to its original position. Now, OK, and then click home the key from here from 30 and I want to do here is click on the skin and a sense. See where it should be that, say, maybe down here. Right, So zero there. Come on. We can't even move this a little bit so that the two things aren't us synchronized. Right? Okay, so I think that's that's quite nice. You could play. Have you looked right? Actually, remove this up here so you can see it in the game. The right. So that's what the animation looks like in the game. Now I noticed that THEA, towards the end of the animation, is a slight sort of pop. It's never smears towards the end when it comes back up. This a doesn't look very smooth to me, and I saw I just want to double check something here. Let's click up curves. So we've been using animation tool in the dope sheet married, which is basically showing you time and the key frame. So that's very easy and simple to use. If you click on curves, that shows you the actual curve of the animations, right? So if you look at can now, we're looking at the rotation value on this right fin object, and this is the actual number that we're looking at for each frame. That's the curve off the value. You can see that tours, and it's very short. So when you loop this animation to this point, it doesn't have a smooth transition. So let me just quickly fix that. You can just click on this note right click and go flat. That's gonna flatten that out. We did the same thing here flat. Now it looks a lot more smooth if you concede it. So this is sort of like if you're looping, this is what it could look like, and it's a lot more smooth, so let's do the same thing for the other rotation here as well. Flat flood. Okay. Compact dope sheet. Also, you can. You can do that. Here is Well, if you just go right click flat. Okay. I will play the information. It looks a lot more smoothly lost. Moved there when it comes back up and down again. Okay, so that's kid, that's good. 5. 05 Animations Finish, 3D View, Conclusion: Okay, so that's quite fun. Let's let's do a see more veg. Let's do more animations to animate Tomo animating on this fish. Okay, so it's trying to sit in also notice when you click on the timeline is automatically gonna go into recording mount, which is which is quite nice. The next thing I want to do is I want to animate the I and the eyebrow off this fish. So let's say I'm gonna do add curve hi and the D position of the I. And here I'm simply going Teoh, move the I back a bit when he's swimming. Maybe somewhere here. Actually, I wanted terrorized. I just want position of the I change, not everything else. I'm just I'm just adding a few more key friends for the eye to enemy. All right, so you can see that now. I have five keys for the I, and it's going to four. Basically, it's going from one position to the other, and it's looping that animation, by the way, Plume animation Did you loot time? This is how you decide if you want the animation to Lou, and oftentimes we do, so let's get okay, so I have to. I position. I also want Teoh animate the rotation of the I just for fun. Right. So that's the rotation thinking. Maybe somewhere here, There. Right, some random animations. Brett, you kind of get the idea we're doing here just to make the fish look a bit more interesting , right? We wanted to come alive. Okay, Next. Let's do it's to the eyebrow. All right, again. Actually, this time that that's used the recording directly. And so I'm just gonna get okay. The initial position is gonna be there halfway theory. I want I brought here. I take it that way. It was end one day I ground to now, this is where I'm just gonna copy and paste to the rotation in the position of the iron ground. Praise it there. So I have the exact im said coffee. So they are back where they should be, right? And then what I want to do now is I'm gonna click and select all key firms here. We're gonna flat them and just gonna make them flat. So all the animations are smooth. Okay, Looks a bit funny. That's okay. Finally, I want to animate a transform off the main parent object. So I can just do position off transform. Okay, so because a little bit so when is moving? Can see that? Well, so get out of the record made. Okay, so? So that's giving. That's you can see that. That's starting to to look like it's swimming. Have some animation there. Now, before we finish with animations, I wanted to show you one thing. That's that's pretty cool. Something you can do because unity is originally a three D engine. So I'm going to animate the tail, But I'm going to animate it in the three d space, right? Could you just tell here? I'm going to wrote I wanted to go Tae this way. So that's the invention I want to use. Okay, so something had curve tell flotation. So now we have the beginning rotation, which is Syria and the and rotation, which was also the room. But in that say here I wanted to hoops. What did I do? Are you okay? Um so we have to tale here. That's at a key friend to tell. So I just double click on the part There want to animate, and I'm simply going t change that a little bit to your own negative 55. And then again them here entertain. 25 My big much. It's just a five on here, you conectiv. 65 Okay, so when we play this, you see that and mention is being played in the three d space were animating to tell sort of insight into the on the easy access will go radio on. Why and the When you go to the two TV, you can see that it's being rotated. Ah, but about on different access, right? So it's it's rotate being rotated through the space instead of the two D space, Having some of these three D elements in the engine where you can combine the two. Sure, I think it's pretty cool. And now we have finished that's been animated in two D space, right? So great. This is what we wanted to dio first, simply animating it. A simple two D image and you can do the animations inside unity. I'm sure you guys can do much better job than I have done here. He looks kind of funny, but but that's the That's the idea. That's how you animate and used a to d imagine, and to start making a to do gaming unity 6. 06 Animations Review: Okay, now let's quickly revealed what we talked about so far. First, we have our sprints where we import when we have the setting set to to demote immunity. When you import an image, it would default Teoh Sprite texture type. So this is name, and we have different sort of sprites we can use. If if the image is a complete character, then we can just set it to a single Sprite made. But if you want to animate it inside unity, you kind of want the different parts off. The character broken up in an image like those and after we imported into unity would go to make sure that the spring mount is multiple. I can click on the spring headed to, and this is where we define where each part has. I remember everything that would define here becomes apart that we can tweak inside the editor. So that's that's very kid, right, and again, you can click on sly eyes and then let unity automatically do that for you, or you can adjust it by yourself. Can also just drag a rectangle to define a new part. Right. New slice, Um, and again we can define the pivot point as well. On this is used, right? So, for example, we had a point down here for the left thing, and you can see that when I rotate. It's rotating based on the pivot point here, right? So that's quite useful. Is something with the tail. We will take the tail. It's rotating around the pivot point that we could find game the sliced tool you can see it's down there, so so it's very useful, very cool. And obviously you can sort of here now change of you if you just want to see the Alfa, sometimes a little bit easier to slice them up without seeing the colors. And when you create an image to use, just make sure that they allowed the parts. The parts to be sliced into a tangle shapes so for them. But if this thing overlaps with that, I would say, if if this the eyes other up here, then you can't have it clean rectangle slides. So just be aware of that. So I made quite a bit of empty rooms. It's not optimized, but it's just a little bit cleaner closed. That gonna apply. So that's our Sprite. Okay, Once we have that, we can reconstruct the character accordingly. Which is dragged the different parts into the scene. No, I don't need a separate. All right, delete that. So we have a fish after we've constructed it. And the next step was to add an animation to the fish and we click. We open up our animation window. You can do it from the window, huh? Animation or click on the still putting here. And they could have need tab animation. I just need one and click on this drop down menu. Create any clip. What that does is it creates a new animation swim, which is the one defined here and canned, recused record button to record the fish on different frames. Talked about the frames. Oh, and, uh, I don't think we talked about samples, so you can see that this is how fast it's being animated for change. Simple to 30. It's gonna go slower now. Each second only has 30 frames and with defined 60 frames here, So that means to go through the entire 60 framing dimension is gonna take two minutes. I mean, two seconds, but if we made that 120. So we think one second we're gonna go through 120 frames and our entire loop is a 62nd 60 frame loop. So it takes half a second to finish animating the whole thing, right? So I usually like to just keep it at 60. That's fine, right? Okay, so that we have our information. We also briefly talked about the animator which controls the animation is attached to this object, and that won't have one, so we don't have to worry too much about it, but it's good to know that it's there. And if you pay attention to this little part when you're in the animator clicking swim animation, you can also just a speed here you did, too. Then it's gonna go twice as fast. So that's just another place where you can tweak things. It's a different type of set up from the tricking, the frame rate directly, but it's also, you know, it's a tool to use. He said that back to one correct. So I think that's everything we talked about, but yeah, so this is how you get an animated character inside Unity 7. 07 Sprite Sheet Animation: another way we can create animations to the animations as by using multiple sprites. Could use a sprite sheet to create animations that outside of unity and which is gonna bring the animation into unity. So we're not gonna be creating animations inside unity. Okay, so, Teoh demonstrate that just three organized my scene for my project. Just gonna me these into the fish photo. And that's starting You seen? Okay. And, um, what I found here as a bunch of resources by South Chester and a personal Linkous brow. So I'm just gonna use one of these characters as an example, Right? So that's that's grabbed a pirate character. So this is a PNG file. This is one image with a lot of different poses. I don't think I could do that directly. So I'm going to say that, okay? And that's on trying to bring this and to you. Okay, so now you can see that again. This is a sprite, and we want to change those to multiple again so we can slice it up here, open up the Sprite ad attack, and here we want a grid set up because you can see that these air properly sort of boxed off characters here. So if we do that 64 by 64 that's offense. The way too big. So what? There is, It's a great I couldn't wanted a feeling of how big these great should be. About 30 to 47 people. Try that. We'll start. Actually, Yeah, that roughly looks right. I am cutting off a bit here. Right? So I'm kind of guessing what's gonna be the best size for this. Obviously, there is a better way of doing this, Actually. Sorry, that wasn't that wasn't very good. So what you can do is let's figure out how big this image is. So it's 1 28 times one night to and therefore Collins and four rows. So we just divide these numbers before, and that would be the grid size. Try that again. Rice. They want money for to you. So that was correct. And then one night to divide before 48. So? So we were right. So there was a good size. Okay, So that 12 just to recap. So now So we know the size of this image is 1 28 That's with by 1 92 which is the when Here we know therefore, grid that we need to fit in here and four on this side. So we divided worth by four and you know, so d lend by four. And that gives us the right size we want to use. Right? Since this does images properly organized. Okay, So if we click on each one of them can start Teoh rename these parts. So I'm just going to say this is so we're just gonna quit communities actually say Okay, get the idea. I'm gonna quickly do this first and then I'll come back. Aim them all now, could it apply? Close this. Now I can see that we have all these individual images ready to go, and we've sliced up this emission Eiseley. Now, how do you create an animation from these images? Right, So, basically, what we're gonna do is what is every four images? Create an animation for this characters to go down. Go left, go right, go up. Right. So it's fairly quick. Really simple. You just select all the animations for the images used in this one in mentioning Dragon into the scene. And yet he's gonna assume that you're creating any animation based on these parts based on these objects. So we're going to say this is and a mission is going down. Just sit down. Well, try. There's our character. Die. I do want to make one change, which is here. Pixels. Two units. Now, this what this means is basically, you're telling the system how you want to map the pixels in two D into units in 30. Remember, in unity, everything is in three D, even two D games. And these are your unit inside Unity. Right? So that the scales want 11 for this character. Now, if we changed pixel to Unit 2 50 because you got the character is getting bigger because there were saying 50 pixels equals one unit instead of 100 pixels equaling 21 unit. So that's gonna make character a little bit figure. So I'm just gonna actually remember one thing that's go back to the cameras, make sure everything set up here. It's fine because the original image is smaller. So I am just gonna make it just gonna tweet this. Remember that smoking, see a but easier just dio stupid team and also filter matter. Let's make it a point so we don't apply any filters, so we can sort of see, I think often times for two D images. You want to do that so that it stays short. Okay, So I'm just going to reset the position, This little character instance in the middle, Right. Okay. Now you notice that we have this object called down serial, and it's got the enemy there created, and it says, I got the animation that we, uh, created earlier when we saved the animation. And if we just play this, see that we have the animation. Now it's automatically grabbing all these four images and combining them into one animation . And again, we could go to animation tools. Ham can tweak those. All right, so we noticed that we can actually make this, but bigger that you can actually see each image here in the animation tool. 10 is telling you what Sprite is being used for that frame. Now we're simply a little bit fast. So it's I came here here. All right, so this is a fairly fast walk cycle, so I'm gonna change this. 26 Yeah, I think this. So let's go with scores six. Okay, I'm going to save the scene before I forget. Okay? I never have to walk cycle when he's walking down. Now that's just created rest of it. But let's click on the next four frames they want to use for the left. Animation Walking left on a mission Andi consume Backtracked this into the subject and your prompt Create an animation given name. Now you have to walk left animation. It's not going to create any animator because we tried the sprites into this one object. Not just gonna read three. Name this to pilot, and, uh, there won't be just to be consistent. The animator to be piratas. Well, okay, Come back to the parents. You can see that now. Have to walk left animation and it's pretty quick again. So we're gonna go change. Too simple, too. Six. All right. Okay. You can see gonna measures down here sprints. Okay, very quickly. That's finished. The rest just into pirate on in. This hurts again. Yes, you have down six that six. So now we have for for animations there. Excellent. Now if we take a quick look at the animator, see that we have multiple just get rid of that. I was playing around with this over there. Eso we have all our state here for our animations. So remember, we create it for animations have made it's got redefined. Just reconnect that trait. Um, just do that again. Okay? Could we have all four animations here? You notice whenever I drag in the animation into the object? Yeah, it's automatically add this into the enemy. That here, I kind of like Teoh take advantage off the video editor and just positioned them accordingly. So we have this walk animation up down, right. We have all foreign emissions. That's great. Now, if we that's me, move this down here this time. And when we play this game, you can see that we're in tow. Walk down intervention. You mean the animator? Whatever is being emitted, it will be highlighted like this. So in the next video, we'll talk about for the next step. We're gonna talk about how we can control the different animations depending on user input . So we're gonna make this character go up down that friend, right? Using the arrow keys 8. 08 Introduction to Changing Animations with Input and Import PM: So the next thing we want to do is to start letting the player control affect the animations we play, right. So we're gonna add a little bit of interactivity to the game. And as you can see right now, I'm using the arrow keys to control the animations. As you can see that every time I press a different key, the animator here is playing a different animation. So So that's what we're gonna do and agonize with. Noticed that ive got playmaking imported, have mine state machines set up. And I also have this little script and I will talk about this in a little bit. But if you haven't gotten playmaker imported, delegated from confined link in the resource section in class and you could go and down with the student version off playmaker. And once you have that, go to assets important package Tustin package and you go and click on that student version of Playmaker Click on open. I know where it shows your files you need to import and you just simply click on import. And that will give you the playmaker plugging, which we're going to use for creating these interactions. As you consider already half that imported I was 1/2 that playmates agree object here 9. 09 Key Control Part 1: because so the basic idea is very simple. All we need to do is telling the system. When I pressed a different key, we're gonna play a different animation. Right? So let's that set that up in Playmaker First to go to Playmaker, playmaker, editor. And I am gonna move us down here again. Okay, So I'm gonna add a state machine to the pirate object. Gonna change the first state to be I don't And, uh, we're gonna create a few different states. One's for each animation. So let's go to the action browser. And we want to get key down, which tell us what to do when a sudden key is pressed. Right. So I'm gonna say, OK, let's go fine up Arrow key. So when the up arrow key is pressed an event and that's creating a few events here, we want up, event down, laugh and right. So that's the four events for the four different keys. So up arrow gonna do the event it's gonna tell you, or we don't have the event ready. So let's do that as well. Transition and left, right. So if you're your kind of on familiar with this, the first class is gonna have some information on Playmaker. And it would be a good refresher as well. You feel kind of for gotten how to do it. So I'm going to kind of go through this quickly, but also copy and paste a link to the refresh rate if you need it. Okay, So when people pressed up Arrow, we're going to send them to the up state, Okay? And I'm just gonna copy and paste this a few times, and that's do for the other cases. Well, down Pero is gonna send people to down transition, which goes to but their event that we're down state that will do next. Took up these keys, so the right arrow goes right there. Okay. Obviously left. Okay. Say that. Okay. So in my upstate, the first thing I'm gonna do is the opposite of get key down. I'm gonna get key up. So when the key is lifted, I want the state machine to go back to the Idol state. So very similar. Gonna dio if I could just find your bear. Okay. Here. I'm going to use finished. So if Thea Pero is released them, we're going to send the player bank to the Idol state. You know, crop. It is a few times, so this is slightly tedious process, but But it's we'll try to get through this quickly, so it's hook up all the states rich. Okay, now it doesn't. It's not going to do anything just yet, but, uh, I can't even set up the state's first so we can make sure that that power is taking care of . So if you press play, it's just select the sleep mission. Here's Hortencia. All right, so when I pressed up, it's gonna go to upstate when I release the button goes back toe Idaho SANDF over the other case. So that's good. So that means we're going to different things when these Keys will be impressed in these different states. Great 10. 10 Key Control Part 2: canal. We have these states set up and what we wanna do is in these states. We want them to do something related to the animator, right? So we want the upstate to say will play the walk up animation. We went down, stay to say the same thing. Walk Teoh, walk down, Information left. We want to play the walk left animation. So you get the idea. So we need some actions here to manage the animator if you are using. If you've purchased Playmaker than it comes with all these adults that you can add to the system and it's got a nice mechanism animator animated package that you can use if you're using the student version. However, since custom actions or not allowed, we're gonna be using a script, sort of, um, component that that I've created to help you manage the animator from within. Playmaker. So I'm gonna tell you how to do both. Are they using the add on If you have the commercial version of flame maker or using the script if you're using student version, Okay, so you can go to the class page and you'll find a link to download the script and I have it here called Animator Helper. You want Just grab it instead of trump this into your scene, right? Pretty scripts. Okay, so it's there. And next you want to drag the animator help onto the pirate character, right? So now we have that there. And what this allows you to do is we can now manage the animated from this script, and that's that's see how that's done. Right? Okay, so now we make sure that we have that animator help script and also gonna rename this state machine so they would know what they're doing that's go to the upstate and click on the action browser. And what we want to do is we're on a sent message. Now it's the same message. Action allows you to communicate with other scripts on the same object, right? So this allows us to talk to the animator, help. So if you click on the method name this little arrow next method name we want to do is we'll find the play method and then click on perimeter choose string, and this is where we're gonna end to the animation name, which in this case, is walk up so we're gonna enter the name of the animator State, which is the name of this thing here. Okay, so if I just, uh please play, I just want to show you quickly how this works, right? So it's playing the default animation, which is this one down here the D for animation is always in orange And if we click on a different one, we can make a different animation the default. But now we have to walk down information as default canali When I click on up, See that the animation is now playing a different one. Nowhere in this walk up animation state because we've told the script we're gonna play this particular animation. Okay, so that's a quick way of how you can switch to a different animation in the Animator. And I'm just gonna quickly go through or four of these. So you get an idea of how that works, right? Just going to copy and paste. So what? Change the names off the state? We're gonna change the animation state. So best states inside the animator different animations there. Okay, so I finished that. And here I'm gonna turn off proactive state here, So we don't see that label on the character play again. Yes, and now we have animation's Working properly. Great. And then the next video, I will show you how to do this Worth E ad on from Playmaker. 11. 11 Key Control with PlayMaker Add on: Now, if you have a commercial license of Playmaker, you can utilize the free animator. Add on that allows you to control the enemy feature in unity. So I've imported the commercial version of Playmaker here and I'm just going to recreate what we are just created. Basically, the using the keys to switch animations on the pirate character have reset the scene to just have the pirate and the man camera and I would remove the other components so that we can start fresh here. So the first thing you wanna do is culture assets import package custom package and you want to find that playmaker animated actions package that you can download from their website. Also, add the link in the class website as well. So once you've downloaded that, that's selected here, you pour it and we want to just import everything into your project. I would have this play make it animator photo with all these new actions in there and also a local motion for you with more actions that we can use its there are a lot of very, very powerful actions related to animation. Then immediately But we're get we're just gonna use some basic ones. So let's first recreate the keys for the control. The key, different states. And I'm just gonna do this quickly s so that we can get to the important part. There would state machines, the first class. The second module has a lot of information about this, that we can all add a link. So if you want to have a refresher, can take a look there as well. Basically, I'm just creating these different states. Um, I'm gonna fast forward. I'm gonna cut to where I'm done with this. And thats is the same thing as in the other video where I'm recreating these teach. Okay, so now I have the states set up again and, uh, just quickly go over this, have the key down actions that detects a narrow key and sent to the correct responding states. And in a state when the kids lifted, Then we're gonna go back to that. Is that so? See that cover got there, was hooked up properly. Okay, Now we want to call the animations, and because you have the ad on the animator had on imported, so we can just go to action browser, click on animator and we're just gonna dio the animator play drag that in there. It doesn't really matter where it is in the state. And then which is going to call it find? Do you walk up Animator State? Right? And let's give this a quick test Look play, Okay, we go up. Can see that now is playing the up walk up animation seeing this Walk of Animation state so we can just quickly there. Similarly, just copy and paste that into of the other states and change name of the animation state that we want to play in these states. Okay, so now place the right animation depending on the direction the character is walking Now that's one way of managing your animations Game might not be the best way to do it, but it's a quick and dirty way of calling different animations that you might want to dio rather quickly and play make it so in the next video. Actually, in the next series of videos, we're going to start creating a simple platformer, and we're gonna be using the parameters down here and basically have the animator intelligent like select which animations to play, and that's coming up very quickly now