Make Games from Scratch (No Coding!) Part 4 - Creating a Doodle Jump style game | Brandon Wu | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Make Games from Scratch (No Coding!) Part 4 - Creating a Doodle Jump style game

teacher avatar Brandon Wu, Founder of Studio Pepwuper - a Game Studio

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

22 Lessons (2h 58m)
    • 1. Introduction

    • 2. Setting Up Player and Platform – Gravity, Rigidbody, Add Force

    • 3. Player Control

    • 4. Going Through Platforms

    • 5. Camera Movement

    • 6. Setting Walls as Child Objects Of Camera

    • 7. Game Over

    • 8. Prefab Adjustments

    • 9. SS wk 4 creating new platforms

    • 10. Fixing SuperJump

    • 11. Scoring

    • 12. Wrap Up

    • 13. Extra – HighScore and PlayerPrefs (Save Player Data)

    • 14. Extra – HighScore – Add HighScore to Game

    • 15. Extra – PlayMaker Template

    • 16. Extra – GUI Layout Button (Unity 4.x)

    • 17. Extra – UI Camera

    • 18. Debug – Freeze X on Player Rigidbody

    • 19. Debug – Stuck on the Wall

    • 20. Extra – Multiple Scenes (Load Level)

    • 21. Extra – Send Events

    • 22. Debug – Going through Platforms

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class


Putting eveything together! 

Follow tutorials to create major systems for this jumping game

Create your own level and releash you creativity!

  • Follow tutorials to create major systems for this jumping game
  • Create your own level and unlease your creativity with everything we’ve learned so far in this re-creation of Doodle Jump!

Meet Your Teacher

Teacher Profile Image

Brandon Wu

Founder of Studio Pepwuper - a Game Studio


Previously a strategist at Sony and a developer at Electronic Arts, Brandon is the founder of a game production company and co-founder of an augmented reality startup. He founded and grew a Seattle game developer community to 2000+ members and is a bestselling author on Brandon has been a mentor and a speaker for Cambridge University, Anglia Ruskin University, Microsoft, Cambridge University Press and many other organisations.

Student Endorsements:

Company: Studio Pepwuper: Twitter: See full profile

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Introduction: we four. Finally, we're here. We are going to recreate a doodle jump style game now if you're not familiar with the Google or YouTube it or figure if you want. Basically, it's about this little guy that Trump's up continues to jump up on these platforms appears they are the game, and then it's a sort of pendulous jumping game, and we're going to recreate it, and a lot of different concepts will talk about, and some of them might be a little too complex. But once you start using these methods are you will start to understand them, and the project this week is going to be a little bit more complicated. So again, if you have questions posed on forums post on the Forum and Indian Army, and once, I think even if he can't really understand what's going on, just go through the exercise. The more times you you've done it, the more you're gonna start to understand what's going on. So s so that's the game and you'll see the first set of videos today, and also I will start recording Supatra features that people have requested and I will release them throughout the week home, make announcements in the forum as well, and now add them to the syllabus. So keep an eye out for those. And if you have any additional things you want to add to your game, cross on the forum as, um a sweet go alone, and I will try to get to them and then try to act as much content as possible. So so you guys can can create sort of diversion of these games that you want to make. Okay, So have fun with that. And I think this project this work is gonna be it's gonna get pretty interesting one. 2. Setting Up Player and Platform – Gravity, Rigidbody, Add Force: I've started a new project for this week's game, and I have also imported the play. Make plugging. So we are good to go. And before we start, I want to rearrange mine Editorial. Little bit since this game is gonna be sort of played in a portrait mode. I wanted to look a bit more like that because it's gonna be we're gonna be using the sort of portrait move. Imagine if you're looking at the phone, right, so that's that's the first thing. And again, I don't like that color too much. It's just a personal preference but can change it to that color. Okay, so let's create some objects in the scene, Um, trying caps off the player and I'm gonna put in center for now. No, have lighting, okay? And let's also start a creative cube. Center it, and that's gonna be our platform. Right? So in a game like doodle jump or any sort of jumping style game, you have all these platforms that the player would jump on top of, and then the player, It kind of you see that continually that the player kind of goes down and then jumped to another platform imagine if there's another one there. Keep jumping up and they're right. So So that's gonna be the set up the platform. I wanted to be just a little bit wider, and then I would be just for individual. Wanted to be that words are just widen, widen it on the sea access. I think that looks good. I'm gonna pull put up the camera back a little bit, just so that it doesn't look so big. Something like that. Just for now. Okay, so I'm gonna also move to platform down a little bit. Okay? So it's gonna be there. Okay, that's good. Um, the next thing we want to do is make sure that the player object react to physics primarily want gravity on the player? Because in the game, we have to you jump up, it sort of gets pulled down by the gravity. So it's nice to have gravity on this player. Object. Let's go to add component physics and add a region party. So this is how you can create objects that interacts with physics and then make sure that we have used gravity checked. Okay, so So that's good. Often awake and concentrate. Can freeze rotation if you want to. You can those of freeze position on the easy access? Because we don't, We don't. We want him t one this character to go front back. But I think for the most part, we're OK for now. I'm not gonna touch that. And let's see if that works. We just want to see if the player has gravity applied to it. Play and yes, goes down just like that. It's very easy, right? So we have gravity on the reach of body on this object. The next thing we need to do is create some sort of bounds effect. Right? So when the player comes, hits the platform, you want the platform to sort of push the player your player to go up. Um, So I'm gonna do this on the platform, object there, different ways to do it. But I'm just gonna do it here. I don't have to play a character that you just made that up and, uh see. Okay, so, uh, create state machine and a person idol. 2nd 1 I'm push, push upwards. Right. So won the game. First stars. I don't want the platform to do anything so the platforms just get gonna be in the idle state. It's nothing in it. So no actions. But why do you want to do is when there's a collision, right? So when the player collides was the platform I want to go to the pushed upwards state. And this is where I'm gonna make the player jump, right? So it's good Action browser, and it's gonna physics and what we're gonna do here is when at force to the player object. So it's a little bit different from the translate that we've been using. But basically, this adds a force to a object that has a region body component that, after you can excuse force to control objects that have physics enabled. So basically, when they have fruit, your body use force to change the way they move right. So I'm going to specify game object, and I'm gonna simply drag the player object here, just dragging that here and again. You can also use this button and just select player, and I wanted to go upwards. So let's see if from just looking Teoh 10 and force mode that this is where you want Teoh Unit. Choose one of the foremost and their various different options. That different situations you want to use different, different image than me actually go over that quickly. All right, so we have forced imposed velocity change a celebration. Now, if we go to the Unity script reference patient out this if you don't use those as fine, this is just sort of it's helpful when you're scripting getting to be a coding, and it also helps with explaining things. So actually, the first thing that lets do this let's click on this question mark from Playmaker to learn it a little bit more about this action, right? So says you can change the forces on the three axes different modes on if you want to do it on every frame. Okay, now let's take a look at the different modes. So I'm gonna also post the links to the websites so you can see it Forced mode at continues for his to reach your body using its mass. Now that's take a look at the mass first, so the player object that's a rigid body and has a mass bearable. Here. Click on the question more. You can see that What is the mast. It's how it's basically the mass of off this object and its arbitrary. So you can you can use any number you want, but in our example, we're gonna ignore that. So that's continue reading this forest mode celebration at a continuous acceleration. We're not actually looking to had a continuous movement. We just want to basically just pushed abject forward once. And then we're done right So the other two were poor. Would be a bit more useful for us impulse at an instant force using his mess. We're not going to use mass, so it looks like we're gonna be using velocity change, which is an instant loss of the change, ignoring its mass. Right? So if you if you don't understand all this, that's fine. It actually doesn't really matter which mold, which is right now in this particular scenario. But But I just wanted to show you that different knows that you can use. So let's go with a velocity change. Go back to the platform. I should public darkness. It's been easier. Okay, so have the ad for his action here and forced mode. I'm going to go Teoh velocity change. So that's the one we want to use. Okay, so that so let's give that a try playing. So what happens? Almost look like it almost looks like there's nothing like nothing happened. But I think it's because the force is so small that you couldn't see the change. Me that pull the Cameron a little bit more and I think we can probably see it just to demonstrate. Could play. Prep it into this. It's very hard to see. Well, it's just that just changed the forests. And then we can say that that was a problem. Stutts, uh, 100 right play, right. We can see that changed a little bit. So it seems like we're gonna need a large, um, force here, which is not ideal State Farm. We could do. You hear? I'm gonna try using the impulse just to see if that makes any difference. Since the masses, it doesn't seem to make a difference. Yeah, shouldn't matter. So let's see. I think we're just gonna have to change this number too big a number. I think they were to stop. That should just work. Okay, let's give that a try. Now it's at 500 right? So so that's a bit better. It it bounds phone a little bit larger training, so that's good. But the problem is, it only does it once. Well, that's because we only added this one's and then it we sort of kept the platform on this state. So we should sort of have a loop for a T to go back to the item state and wait for the collision. Right? So also, that's do that. Now that tradition finished, and then just have it go back, right. Try that. Okay, so that works very well. Have this platform that the player will sort of jump on top of automatically shows. I'm happy with that. That's, uh, wait. Took it out. It's now rotating. This is the problem when we didn't read to limit the the position in the rotation on the region body. So that's does to that now. And I don't want to reel tape. Okay, True, that should fix it right. And you can see that the axis and the rotations a role stained at zero to make sure that you do that if you're seeing problems with the players that is going over the place. Okay, so that's good. Let's move on to the next video 3. Player Control: Let's add a bit of control. Control is going to be pretty similar to what we did with Breakout. Right? So the left arrow key is gonna move to player to the left, the right hair. Okay. It's gonna move politically right now. Of course. If if, for example, if you're if you're making a mobile game, then then what will you tell Control? But I won't be covering that now. So now is just gonna use left and right. Just fine. Line objective. Same. Great. Okay, so let's see player make her. Oh, uh, so apparently I've already done this, but let me just, uh we started this again, so you can see how that's actually I I think I was a glitch anyways, playmaker. And then add the state machine, and then we'll say this is And what do you do here? Okay, so this is if you're not familiar with this, um, you can go back. Teoh this third said wait. We have a video on creating potro's. I just added it very both for how are we going to the X axis? Um, I don't think I had that. Okay at this. I want to get the access the horizontal axis empty in despair, arable multiplier. 10. We know that that's going to determine the speed of when you control the character. And then we'll do a translator. I get asked this and then translate on the expects. This right, Let's play and it's so I can control it. I just saved it now in this game when you moved the character that say Okay, when I moved to character, the way left, I wanted to show up on the other side. Right, So that's that's kind of how a lot of these games behave on debt. See how we can do that. So I'm going t o create a trigger first side of both sides of the screen. Okay, so let's see to just gonna make it a little bit bigger. Something like that make data triggered because I don't need it. Teoh collided with anything, and eventually we're gonna turn off the mash render, which basically turns off uh, the render, so I can't see it in the game. I mean, still see the collider inhabited, but we will probably turn that off later, but it's creates. Say good and see we're gonna day I think, Yeah, create an idol state for the wall. So when the game starts, I don't want to do anything. Actually, that's not do this on the wall. It's terrible that that's when you remove that component. Do this on the player. So this basically says The control says, You know when When you are pressing these left and right, Kiwi moved to move the object. Um, that's at another state machine here. Just because I want her can separate us two different functions, right? So we have the state mission we just created. It's to call this control, right? And, uh, I want to add one more state machine so I could do it from here. Or I can just add another complaining component here as well, Right? So the 1st 1 is control. It's which which managers usurping the 2nd 1 It's not so much about using control. It's more about where the game is gonna place you when you hit the wall. So I'm going to say, uh, that's just called this wall. I might change my mind my later, but that stood out for now. I'm just gonna close thes good, a little bit easier to see. Okay, so wall trigger, I don't really care. I don't want to stay missions to do, to do anything when the game starts. But when player collides or when the player touches the on the wall. I wanted Teoh do something right, so that's add a trigger. And to I'm using trigger instead of collisions. Because the wall is now a trigger instead of collider. Collider is something that you let me just quickly show you the difference Now. Okay, now this is a collider. Play the game. You can see that the player is colliding with it because the player has a physics physics component, and then the collider sort of acts as a solid object. But when it's a trigger, let's play the game again. Theatrical. Just go through. The player object would just go through this Q. Because it's simply a trigger. It doesn't interact with physics. It's just a trigger for you to trigger events, right? So So let's see. My unit is somehow the interface changed. Let me restart, and then we'll come back to this. Okay, so I've restarted my unity ap. I don't know wides doing that. Um, it's been doing that quite frequently lately. I'm not sure what the problem is, but anyhow, so we have the trigger enter. And when? Whenever there's something that enters the player who wanted to do something right, So the first thing we're gonna do is we're going to check. What? What triggered it? It is. So we were gonna attack the walls again. This is covered in with three. So if you are not familiar with some of these concepts, make sure you go back and review it right. Call us. This is the wall. If I'm just gonna create a yes and event for simplicity's sake, right, Sheriff, it's long would go to Yes, otherwise, where you just go to know, right? So, actually, I don't need to note, even if not, then we're just finishing that. Go back to trigger Correcto, Idaho State. Sorry. Um, OK. So what happens when when we hit the wall? Well, that's that's just see if I detected first. Let's play. Go see the ball. It's not detecting it. Let me just try that again. I think I made a mistake of doing the trigger event here instead of here. So the trigger events should be I should probably use Should have used to trigger event up here instead of trigger enter. So I'm just gonna copy. Increase that and removed Trigon toe. Um, do you eat this and, uh, after yes, even here. Okay, so what I have essentially done is instead of using a trigger enter transition which eyes triggered whenever triggered whenever a triggered event happens, so it doesn't actually check the tack. Um, and instead of doing that, we should be using the trigger event. Which tax went a trigger? Answer is what? The object, what the other object is So so and then that that's when we're gonna send the yes event to this state. So it's always good Teoh to test your game while you're doing development. Because you can get confused sometimes. Forget things occasionally, so so that that's always get have just step by step before you finish the whole thing test You're states. Make sure it's working before you go into the next one. Okay, so the next one is gonna be the interesting, interesting state. So we wanna teleport when a teleport the player object from this position on the axe to over here. So let's see if we could do that easily. So if we simply changed the exe valley, I wonder if that would work. So let's go, Teoh. First of all, we need the variable right to control the explosion. And we also need a original Sorry, I should add a new variable original pollution. I'm gonna change this to a new expedition, Right? So when the event happens, when when the trigger event happens, I want to get the exposition off. The player I want to do is I want to just flip it so it goes to the other side. Um and that would work because the the middle part of the screen is zero. So? So this line here, this is zero. So if I just switch the sign of the phone number, then we should be able to do that, do that teleportation fairly quickly. So So that's that's See if that works get positioned original position. And we wanted to be what space? It's fine. Then the float multiplying, and then we're just gonna dio. Actually, it's that's used a different one to use Float operated, So float operated gives you a bit more control over how you many play these foot numbers. So we're gonna do original position times, negative one. And that store that at it's the new position. And then finally would set position set the exposition to the need position. Now, you could have just used one position here instead of having to, um but just for clarity's sake, we're gonna use to. And once that's done, finished, Go back to the ideal state. See that works, right? So it seems like it's working now. Of course, if you pay attention, then you'll see that as soon as the object touches the wall here comes over here, not at the edge of the screen, which is not great for creating that illusion that you're coming over this side and then coming in from outside of that screen. So what I'm going to do is I'm just gonna positions. Position will outside of of the of the screen space so you can actually see a right see married. Feels a bit more natural, right? Great. Okay, so that's something that words. I'm gonna save the game, and I'm going to simply duplicate, right. And I'm just gonna change, thanks to yeah, beside again. Just simple manipulation there. Okay, So I'm pretty happy with that. Skip the next video 4. Going Through Platforms: let's create multiple platforms and see See how that feels like what does he have? The game performs because we ultimately that's what the game is it out. I want people to be able to John puppet down. Using these platforms just just plays in a few of these here, okay? And thats done just a quick test, so I don't know if you noticed, but there's a small problem here. Try again. When I when I jumped up against a platform, it stops me from going three because of the platform. It's blocking you, right? So that's not exactly how we wanted to behave like Game doodle Jump, right? So in doodle jump, he are allowed to go through the platform. And then when you come down, you land on it before you bounce again. And it's actually really easy to change that. Yeah, that's pay attention to this box collider here, right? So that let me click on I'm just select object that's currently blocking the player. If I just disable the box collider, the player will go through right because it's not detecting that collision anymore. It's nautical lighter. The collider is deactivated, so all we need to do now is make sure that when the player is lower than the platform platforms, collider is not active. And as soon as the player is buffet, we turned the collider on and it starts to detect that collision. I cleaned up the scene a little bit, so we can set this a bit easier. So again, that's duplicate the platform. Is that one up here? So I'm gonna be designing used in this one and the original one. I will rename it Teoh. Former original. Just for now, just for, um, just so that it's a little bit clear in the scene. Okay, so let's look at this platform. We need to make some modifications to it so that in neighbors and disables this collider depending on the position off the player, and we already have a statement shit here. So I'm gonna change the name to, uh, player. Just jump. Right? So this is a state machine that controls the movement of the player. One the player lands on the platform. Say that and I'm gonna add another state machine here. And then this is the one that's going to control the collider on the bathroom. So I'll call this. Actually, it's over here. I'm gonna call the state machine. Why did confirm. Okay, Okay, so that that's think about this for a second. What we need to do is we need to find a point near the play object. Well, actually, preferably. We want to find the bottom point the button position the Y position of off this two. Quick point here on the player object. Because if we use the that, if we just used the player object and get position for the object, and we're gonna get position in the middle, which is not what we want, because we want to react to sort of the foot area off this player. Right? This is where we're gonna make the switch when the platform is and when the platform is lower than that tenets. We're gonna neighbor this collider when the platform is above this political point that we're going to let the player go through it. So, as you can see, we need a different point than the center off the player. Right? So that's the first thing we're gonna need that point. I'm gonna compare that with the position off the platform, right So obviously we need to variables. So we're going to say where good and then form, form head. Okay. And, uh, create her financial position. State. This is when if with the game first stars, we want to make sure all the platforms know what they're doing Before the players even started moving. We want to make sure that the platforms are that are above The player knows they are not gonna have the collider, the ones down below that and know that they need to collider. So in the initial ization state we're going to we're gonna do that right away, and then we're going to have state that says Mabel one that says table, I'm just designing the state right now. And then we're gonna need events form this one event for me. That's the other. So I'm gonna have these two events here when a player is above the platform would go to enable collider players below the platform with disabled cold, Wider, right. So that's the first thing with the game stars. Let's define if we want to collect her on the platform or not. And then let's see what? How do we How do we decide that we're gonna need position more positions of these subjects . And let's do this one thing. First click on the player object and then it's Goto game object. Create empty and I'm gonna So this is going to be the point We used to decide if we that this is the sort of like the anchor point that we're going to use. Remember, we're just talking about how we are going to be used a point close to the bottom of the player character play object. So I want to make this a child object off the player, right? And what that does is when the players moving this point moves with it, right. It's relative position to the player. Object is the same now to make this a little bit easier to see because it's an empty game object. I'm going to just added a little icon to it. Okay, now you can apparently said he has an opinion on this as well. But anyway, let's try that again so that I can. So now what this point has a little icon on its We can see where it is, and I'm going to just reset position 2000 Now this 00 position is actually the center of the parent object, and I'm going to just move this down a little bit close to the suit area. But I don't want it to go all the way down. Wanted to sort of leave a little bit of error room there. Sometimes objects to go into each other a little bit, so it's just okay. I think that's a good place to have that foot point. So that's the point we're going to use to detect the position off the player, right? So let's go back to the platform here, and we're going to say, OK, get position specified game object. And instead of using the player object, we're gonna use the foot point right now again because the foot point has part of the player object. Now it's it is a child object of player. When the player, when you moved to player object could see that foot point object is moving with it. So this is get that we can use that as a detection point, right, so that's good. And we're gonna store that in the player foot position. Variable. Do that every frame. Okay, So that gifts as the position of this wire position of this point. Now we want Teoh get another one position, right? And then we're just going to use their own position here and store it as a platform y position again, Every frame. Make sure we're using world space here because we want to compare them, Uh, sort of eating the world space Not did not their local space. Okay, so the next thing we'll do is we'll just gonna do hate. Simple foot compare is trying. Okay, So the float compared action allows you to set different events based on they relationship between two floats. So what we're gonna do is we're gonna compare the player foot position to the platform y position and if it's equal, then we're going to say it's equal down. We're going to say the players below platform, we want the player to go through. It's equal. If it's less than then, we're still want to say OK, you below the platform disabled the collider. But if it's greater if that this position is higher than the middle part of the this this point here, then we want to stay. Okur above the platform. So essentially, what we're doing is we're comparing this point this foot point what? The center of the platform. So we're saying if this point is above, then we're gonna tend you into that silent collider so you can bounce on it. If it's below, then we're gonna let you go through. So I think that's your work. And again, we're gonna do this every frame. Actually, initially, we're just gonna do it once. So I think that's fine. We don't need every frame. Okay, so that's the first step. Now we want to keep doing the same saying one. The game is running not just initially, right? So when the game is running, a might be in a different state. It might be in this state. Where is the Neighbor Collider? And then if the player goes below the platform, want to switch to disabled collider? So here I need to have a new event transition player in the classroom. So when the players below platform this disabled collider and when the player is off the platform, that's really enabled because player object position is constantly changing. So one make sure that we can switch between these two different states. Okay, now that's add the collider in neighborhood. I don't think there is a thief Full action for this, right? It's just a quick look. Yeah, So we're gonna used this particular action called Set Property, and this is a really powerful This is a really powerful action. So what it does is it allows you to get any property from any of the components and from any objects. Right? So what we're gonna do here is we're gonna say, OK, target object is so if object drug game and the property here, we want to you can see that all of the components and different attributes on the platform is this is despite here, Right? But what we are interested in is the collider. So go to collider and enabled. Right? And what we're gonna do is simply check enable because enabling collider, we want to do that here. And I'm just gonna copy that and paste it here and on check enabled. So, that way that would disable the collider, right? Okay. And now we need to do all the same actions here again. We need to compare the positions of these two objects And then if it's too big or too small , then we're gonna send them to send the state attention. The honesty, right? So I'm just gonna select them all control, say, to copy, collapse that and then just paste that right. So And I need adjusted a little bit because we're not going to try to send the state Teoh enabled collider state because you're already in the state. So I'm gonna remove that. Don't need that one. Okay, so we just need that he call in less than event. Let's go to the next state man will do the same thing. I would paste that. And all we care is one player is above the platform. We want to go to the state and make sure they were checking this Every frame just double check right to do that. Every frame. Okay, so safe that and see if that works. So I'm just gonna manually It was this thing about around. You can see that I'm above y position is above the player foot point. So I mean the disabled collider state, And as soon as I move this down, I can see that Dean playmakers start to switch between the two, depending on the positions of the two. And what this does is that safe, perhaps in with this go through and they would jump. No, that was obvious. But let's try that again, right? So I think that that would probably work very well. That's let's go with that safe. And the next once like problem I have with the current set up is I think that the platform switching to to enabling the collider a little bit too soon. Let me just demonstrate that for you. And, uh, you might have noticed this previously, but I'd say if we have to put from here this a soonest object, that player, it goes to the platform that's enables to collider. And its sense basically creates the situation where you have you have the you have to collision of that happening. What the up? Just like that? You have the collision ing events happening. One out check. It should have halfway theory because we're comparing today. We're comparing two fig point with senator of the platform, which is not really ideal, I think ideally, I want to compare the foot point with the top off the platform so let's do that. So we're gonna do the same, say, with foot point. But then here, we're going to just create a top point for the platform, so it should be a quick fix. So again, that's created, and you can just to be anything. Are any main Really? Drop it into the past, and so he's part of it. It's part of the parent and reset the position. So it's now it's sent to and again, I want to give it a label, but an icon so I can see it. Okay, spare. Just position things a little bit. Right? So this top point, I wanted to be close to the edge, but not quite. Maybe somewhere there before, okay? And then in the get position actions we're gonna have to use, um I have to use that point instead of the platform object itself. So we're gonna use top points for that. We're using some points for the other. It's just a trick. Here is a point platform since the points of player. And finally this last state champs that Okay said even play See, this way turns words on. Yeah, that works a lot bigger, so I didn't have the cash but goes through properly, finishes to trump and then jumping. So I think that works a little bit better than we had before did. 5. Camera Movement: next a wrong Teoh. Take a look at the camera, sir, when the player is moving upwards. We wanted to move the camera along with the movement along the jump. And but what we want to do is we don't want the camera to follow the player when a player is moving downwards. And finally, if the player falls out of the view of the camera that that's game over, right? So a few things we want to do with the camera and start creating state machines for the camera and you understand a bit more once we go through this exercise, right? So the first thing I want to do is I want to know, as the player is moving up or down, right? So if the player is moving downwards that I don't want to move the camera, and if you're not too familiar with how do the jump works, you can. You can YouTube it or downloaded on the iPhone and see how the camera works from that game . But basically one the camera. When the player is jumping upwards, the camera will continue moving up along with the player. But that say, if you are here and then the players sort of falls off the screen, and that's game over. And the camera never moves down. Right? So that's kind of the rule of the game. Okay, so so that's it. The first thing I need to do is I need to find out if the player is moving upward down. Let's go to the action browser Physics six. And then we're gonna get velocity, read the description, get the velocity of a game object and store it in very in variables, right? So the game object must have a region body, and that's what we have on the player objects. So that's good. And you might see this warning. Don't click on this because we're not detecting. We're not getting velocity from the camera when we want to get the velocity from the players. So specify came up Jack distracted player here, and that's go to the variables panel language is gonna be one I only care about is velocity on the y. So we're just gonna sign the lost each year are variable here. I want to do it in a frame. Okay, so the next thing I want to do is I want to compare that float. Syria slow compare. So if that float is smaller than zero, then that means the object is moving downwards. Have to float as bigger than zero. Then that means the player object is moving upwards. So we're gonna compare why I've lost tea with zero. And when it's greater than zero, we're gonna go to certain event. I'm ensures checking it. Every frame option here, the Event bay. Okay, we're so I'm gonna add that event, and that's gonna be triggered when the velocity variable is greater than zero. And I'm gonna change the state to state and then out of the state. Right. So when the player is losing upwards, go to the move state and one, the player is moving downwards. We're gonna go back to the stay state, which means there's just just no action here to move the camera. So before I do everything else, just copy these. Go to move state, taste them. And what I want to do is just to create this loop first. Good events. And so when the UAE velocity is smaller than zero again, we're gonna go to the player moving down payment. They're moving down go back. Okay, Let's just see if that works. First, see if we're detecting these movements correctly, so you can see that when the player is moving upwards goes to this state and it's going downwards. It's moving back to this state, so that's working. That's good. Okay, So the next thing we want to do is when the cameras in this move state who want a make sure that it's moving, too, the pyres y position. So it should compare itself if its Y position is larger than the player y position. If it's not family, set the new position as a player. Why position? And if it's if the camera is already larger, camera Y position is already higher than the player that we don't move the camera. So let's do that quickly. Well, first of all, we need to get the positions right. So we need to get the bowl wine and then also so, Cameron, good action about their position. We need to do this first before we consider the move. Just because I wanted to start moving, start looking at potentially moving as early as possible when we move into state. So I am going to grab the player object. It's door. That why positioning, play wine position, do every frame there again. Position kept the user on their hizzoner self y position. Every frame. Okay, so now we get the position of the camera and the player. Okay, let's get. And I want to decide. I want to figure out which one is bigger, and then I'm gonna take that bigger number and apply it to the camera y position. That's how we're gonna move. Teoh that wine. Ask that sound camera. So in order to make this a little bit more clear, I'm gonna create a new venerable because there's gonna be new one condition. Okay? And I'm gonna go to Sloat. Good to math again. So this is where Meteo find out which one is which. One of these two positions or bigger. Right? So we're gonna go float operator, and I want to make sure that we do that after the positions were required. Try and we're gonna say, OK, we're gonna go with we're gonna could play. Why? Position here and self y position here And the operation would be Max. So I want to pick the bigger one among too. And we want to store it. Yeah, new Y position. Make sure we do that. Every frame finally set position. Forget. Make sure we do things in the right order and we're just going to set a position to new Y. Position again, every frame dealing with the world position. So I think this will allow us to move while so, OK, let's let's go through this again when the game starts, detect if the player is going upwards or not. And if it's going upwards, go to the move state and we want to do is we wanted pick. Are they gonna pick the bigger of the two among the player y position? Would it can my position And then we're going to set the new camera position todo leisure after two. And once we start detecting active players going downwards, we're gonna go back to this stay state and then just stop moving camera. Okay, so let's give that a try current, so you can see that the camera is moving whenever the player object as above sort of middle point off the screen again. It's moving, and it doesn't follow the camera there. Camera doesn't follow the player if it's going down with OK, so that's that's the effect. Want very good 6. Setting Walls as Child Objects Of Camera: Okay, A couple more things I want to do with the camera. So I'm just gonna reposition position D view here so you can see that more usually I'm going Teoh. See? I'm gonna disabled it. Playmate! Go, Icon. So when you go to gizmos, you can sort of customize the view in the scene. V I'm gonna check. Make a so have a cleaner view here. Okay, so that's a camera. So one thing I noticed is when the camera is moving upwards, the walls stays the same. Stays in the same position, sir. The player object My venture go way above the walls. And then we won't have those triggers that we created. Just demonstrate that quickly. Here, I can see that the camera is moving, but the wall stays in the same place. So that's that's not really that kid. So simple Fix. It's just parent the walls to the camera. The walls will move with the camera. So we make sure that it's always in the relevant positions for us conceived at the walls, moving with the camera. Just just play that again so you can pay attention to to seeing view here, See, also moving with a camera. That's good. Okay, so that's the first thing I would do 7. Game Over: there's to set a game over condition. So for games like these usually wonder this player character player object falls off the screen. It's game over, right? So so you restore the game or do some other things with the game. But as soon as you fought character falls off screen, it's game over. So how do we do that quickly? So let's go to player, the player object and let's go back to the control statement. She right. So we have the state machine that allows us to control the character. And, um, it works really well. Now I want this statement seems to do one more thing, which is I wanted to control when the game is over and it's really easy. That's, Ah, studious quickly at another state. I call this game over state, and the nice thing about playmakers has this default transition called became invisible. So what that means is, one an object becomes invisible from the camera. Then you'll trigger this event, and what we want to do here is we want a global transition. Now, a global transition allows you to go to this new state regardless of which state you're in . So you can see that instead of going okay, transition and then connected to this requires If we do it this way, this requires the object to be in this particular state. But with a with a global transition like those, it could be in any state. So that's safe. We have, you know, a couple more states here. And regardless of which stayed this object, is it him? As soon as this becomes true, it will go to this state. Basically triggered this this transition effect. So that's that's how you use global traditions on. And it's really useful, especially for things like animations that you want to send a global event to another state machine. Right. So anyway, so let's see how this works, right? So I want to do is well, when the game is running when it starts, Okay, you well, give the players control over this player object. Right. This is where we get we get the keys and translate the axis. But Essen is Thea object. This player object becomes invisible. We're gonna so okay, game over, and then we're just gonna do a something we've done already. Start level. Right. So plain and simple now, One thing you want toe pay attention to is that this become became invisible command or the other one called became visible events. They also count the camera in the scene V. So even if the object is not shown in the game view, if it's here, it will still be considered invisible. So when you test want to make sure that your turn away from the objects or you have something else, there is a, you know, seeing the object. So basically, if the object is to be seen in any of these panels, then this became invisible. Were not trigger. So now I've got that. Let's see what happens. Yeah, sure, I'm gonna turn this off. Just let's just see how the state we'll operate, right? So no problem here have control over subject, but you can see that as soon as the object falls off screen, you went to that became invisible state and game over so we can quickly create it's game over state by using a global transition, a global transition event to detective the objects visible and then, with your inaction inside this state, let's give that a try. Okay. Nice. And then lips game over and restarted game again. So now we have two game over state as well designed and I was fairly simple. Just do that. 8. Prefab Adjustments: Our next step is to create new blocks, new platforms that would fall down as you progress as you continue going upwards. Right? So these games usually have these new platforms that keeps appearing when you keep jumping up this way and the way we're gonna do it is by creating a state machine that generates you're platforms, probably somewhere around the top, and so we can visually see her. And to do that, we have to make some adjustments first, right? So that's that's did at first. First of all, I need to create a pre frappe based on this platform, right as we talked about last week, a prefab. It's something that you can continue to reuse, continue to generate what you need them in the game, and they're all gonna have identical properties. They're gonna have the same component that so that you don't have to keep recreating the same things. But there are a few things that we need to watch out for when we create a prefab. So let me just show it to you. Now let's drag this platform. So we're pretty happy with this one on this. Track it into the project, be can now with created a prefab a platform prefab and you can see that this platform here's got blue tack indicating that this is connected. There's not connecting to this isn't out connected to a prefab. But if we select the prefect and go to Playmaker actually, let me rearrange things a little bit. Gonna put the project voted there. Um, see, if you can change this of it took a So I have the platform selected. Go to playmaker and I can see why state machine you and let's get to the collider control. So far, so good sometimes when you move, when you create a prefab from an object that's got other objects linked to it, for example, we already have. And this prefab we have thes get positions created that's linked to objects in the scene. Sometimes when you when you create a prefab, we would sort of not remember those objects. And you have to. Sometimes you have to change the way it's set up, but seems to be okay so far. So we're gonna leave it as is actually, now you can see the problem from starting Teoh. Okay, here we go. So it might not be immediately obvious, but you can see that we're missing a game object here having problem with getting the top point because the top point is part of the prefab. So it's part of this object. So the proof app has no problem finding it. It's part of this. But pre fabs are by default, not part of the scene, right? So anything that's connected to the scene is gonna get disconnected. Anything that's from the scene is gonna get disconnected. And now we can see that the error checker has cut has caught up to the problems. So we're missing game up tricks here, and that's just fix them one by one. Right? So the 1st 3 are actually the same object, the same problem. All right, so the first they are, we need to get position, game, object to be defined and see. Take a look at this company launched this. The one that's missing is the one where we had the foot point off the player object. So that's the one that's missing something here, missing the food point, missing the foot point. So the way to But just for that is working. Use a fine game object action. And we're gonna put attack on the set point so that we can find that object where the game is running. So let's do that. First, it's got a foot point and had a new tag, right? Come to fit point again. Fit. Right. And then let's go to the prefab platform Prefab. And in the initial initialization state, we're gonna go to Action Browser. I'm gonna get object foreign. Define Came up, Jack. We're gonna dio foot, right? So we're gonna find a game object as attack food, and we need to need to add a new variable new game object bearable. Call this food if it Okay, so coming back to the state, we find the subject with attack food, and we're going to store it in the foot point object. And here, instead of defining her down here, which is going to select Sorry, we're gonna click on this button and then select foot point object. Right? So what that does is instead of dragging the fit point object into this option field here we've defined variable that represents the game object. And we've used this fine game up Jake action to find it in the scene. No, I have to remember, pre fabs are not directly given scene, right? So prefab can be using a variety of different scenes so often times the the objects there directly from the hierarchy is not gonna show up. But using this method, we can tell assistant to dynamically find the object. Right? So when the game is running, the system would go here initialization and find an object for you. Just a quick note. If you have to use fine game object, try to do it in an initialization state. Meaning try to do it only once in a state machine. Otherwise, because it takes the more performance power to find a game up trade. So you don't want to overdo it, Okay? Now that the nice thing about this is now we've got that object stored in the variable. Just used that in these two places as well. So So? So we fix those errors. Now, let's see what the next witness. Okay, so this is the one about jumping. And the one that's missing is the player object. Remember? We added on affords to the player after, so I would go up now I'm gonna use a same technique, so I'm going to define a game objective. Credible. Okay. And also, I'm going to do to add a new state called Centralization. And the sole purpose of Thursday's to fine came up Jake with the tag player player is a pretty find tag. I'm gonna right click on those and then set This s to start state. So in the game, stars will go here first. And then when finish, go to the loop here and then it's come down here and just select the player object here. Okay. So again, when the game starts, we'll go to an initialization ST Fine player story in the player object variable, and then continue. Now, finally, we've been attacked the subject as the play object. Okay, so I think we fix all the errors. They're safe. Good. 9. SS wk 4 creating new platforms: now, the next port is going to be a little bit complicated, but I think we can do it. So being, dude, Oh, John, when you start jumping, when you control your character, that and then you struck going upwards. You notice that your that the game starts randomly generating new platforms. Top. So that's that's trying to recreate that. So the first thing I want to do is creating a trigger again. Cube. I meant it Gonna call this dinner radio, and I'm gonna make sure that that's a trickier. I mean, sure, that's why now, the purpose of having this thing is, what I want to do is when the player object touches this thing, right, So the playoff Jerry is going upwards. When it touches this thing, we're gonna generate new platforms. Top. So this is kind of like a way for us to now, where what position the player is. And if it's going across this line, that would create the objects. So that's that's what we're gonna do here. Okay, so we're gonna get Playmaker Moore's just have a state, a generator state, and in the idle state, we can have the event that were used earlier. And one the player triggers this object. We are gonna send a finished event, and it's gonna go to generate state. And we are going to create an object. I'm here. We were We're gonna so like that prefab that we just created and spawn point. Now, I want this bone point to be somewhere over here at the top. New blocks to be created, new platforms we created off the screen before top of the screen coming above the top of the screen. So I'm gonna create an empty Gamel trick. I'm gonna call this about form and I'm gonna drag this team to the generator again. Now it's become the child object of generator and a good thing about it is again When I moved generator, that's one point. Moves with it in the bed a Nikon so we know where to find it. And I'm going to position it more or less here, okay? And drag us one point here for that. And then I am going to store this instance created object. This object that was just created in a variable, so we can manipulated later, and we're gonna do it here. Okay, so So let's see if that works. Okay, Now you can see that there's a new object being created. I don't know if you saw that. Let's try that again. As soon as the player has this bar is trigger. I'm going to see a new object here. Okay, So that's working. I might move this up a load of it. Just so that show up on the screen. Okay, did. Now, the next thing I want to do is I also want to move this bar upwards whenever the player touches it. Yeah, whatever that player touches, touches, touches. What did I say? That wouldn't touch. Is this this bar? Um, I'm gonna move it upwards. So to compare ourselves to create the next one that's even higher. Right. So So now we're creating block here, and when we're doing that, I want to make sure that this up so that we're creating something of it. They continue to move this upwards, and then that's how we're gonna create multiple layers of objects. Okay, so I'm just gonna do a quick translate on the corner object, and I'm just gonna give it a random member seven. And I'm gonna home check every frame impact per second. I just want to do it once says Let's see what happens when I play goes up there, right? So that's good. That's what I wanted. And then that's at a Finnish state fair. So when the finishes doing these things, it's gonna go back to the out of state, which also means that's pretty to be triggered again. You can see that we're now see more and more blocks generated. See that here? Groups just last. My guy. Let me, um just try to show it to you. What's happening here? Your book generated very good at this game. No one generated and no one Now I don't want them to be all on the same line. So that's the next thing one day to come back to this state machine. And I'm going to define a next position float variable. I'm just gonna sign a random number to it, and it's gonna be between native seven and seven. How do I know that? Well, look at the walls was created here. This one is the negative seven position, and the other one is that seven. So I want to create something between these two, right? So we have that random float and then sign it to the exposition. And then we are gonna set position. We're gonna set the new platforms Exposition Teoh, the one we've just randomized. So just just maximize this so you can see that better re created a Brendan float variable put in the X position. And then we assigned that exposition to the new platform. The object that we've just created here, we're gonna are usti this new variable for its explosion. Let's see if if that works so that part is working. See that more and more platforms have been generated, Tom. Just what we want it. So that's that's good. Oh, yeah. It's hard game. Fine. Tune The positions of these bars will give you better control off how and where you respond this, Boris. Right, Because the position of the new ones are gonna have a huge impact on the game. All right, has So this depends a lot on the speed that the object is moving upwards and how often you generate them. So, huh? A few things you can consider changing is on the generator State machine. You can't change number. How far apart. These boards should be 10. Then they're gonna be sure the part. Which also means I might not be able to jump that high. I said, I guess tennis, too. Let me just change that back. Let's just do fine for now. Okay? So we have our basic set up now. Now, I don't know if you noticed, but there is a probable first of all that some turned off the the rash mender for this trigger because we don't way don't really want to see it in the game. Okay, so? So that would feel one nicer without boy there. But you can see that when sometimes the when the player object is moving up. Was it sort of has this count pound the fact it's that makes it go a lot faster. Oh, something which is kind of a quote fact. But if you don't want toe deal with that, how do we How do we fix that? I guess first of all, we need to figure out what's causing her, right. So let's let's deal with that next. Actually, before we do that, that's just use one thing really quickly. Um, now that we're generating more platforms. We want to make sure that the ones that are down below that no longer in years we just destroy them. We don't need them in the scene, right? So let's go to Project Select a platform. Prefab again. Sometimes it doesn't show up. Selected again. Still isn't sure that Stone just selected from here. Pre fact. And we're gonna do something similar. We're gonna have a destroy state. This is gonna be similar to the game over state of With It over there, we're just gonna do it. Become, can invisible. So when it became invisible, we're gonna destroy platforms, and that's it. Now, let's see if that works. Remember, we have to make sure that we're not seeing the objects in this scene. You are this. I'm gonna walk that I'm just gonna play for a little bit, okay? And then I'm gonna pause the game. It seems you can see that all the ones down here that we had before are gone. And we only have the ones. This one is that one down there. This is this one down here. And that's the player tricked. So we only have the one invisible in the sea still inside, seen the ones visible came view. Still here, the other ones are destroyed. So that's good. That's good. But let's fix that little problem that we had before with that super super charged junk. 10. Fixing SuperJump: I've noticed that there's a weird problem when we have the player object. Go through multiple some forms at one time and if you pay close attention to it, I realize it's a let's see if I can recreate that from it. Basically, the problem begins when when the object, because moving upwards and then somehow addition of forces being added when you go through an object and I think it's because we went when we detected collision with the platform, we didn't check the direction of the player objects. So whenever there's a collusion, we're adding forces, as you can see, then that just keep. We just keeps. We just keep adding forces continuously and it is not holders moving downwards once you get into that state. So we can just checked of los tiene and avoid this problem easily. And let's let's go ahead and you get now. Okay, so make sure making changes to the platform prefab. Okay, so in the idle state Well, first of all, let me create a variable port velocity. Okay? And then in the idle state, which is the status mostly gonna be in that's can philosophy fan. We want the player object osteo. And the good thing is, we already got the player object defined in the initial state, so we can just reuse that here and we're gonna store that lost the why here, we'll check in every frame. So this will tell us if the object is going up or down, right? If the y I've lost, it is positive that is going up if it's negative is going down and we want to make sure that we're not adding more forces when it's moving up. Right? So now we have that we have. What one now the philosophy. Wonder why Texas? Let's go to this push upwards state and all I want to do is I want to do a full compare before I add the force. Right. So I want to compare y velocity would zero. And if it's greater than zero, that means it's moving up When if there is a collision, when the player object is moving upwards, we don't want to admit forces, so we're gonna just simply go to finished state. So if it's bigger than zero and when the collision happens, which is going to go to finish, so we're not gonna add force. Right? Okay. So that should be a safe at into a quick test. Get we fun? Avoided the problem so you can see that four petition of force. It's not added when you go when you have that collision while you're going sue the platform . So that's good. That's where we don't have that super jump again. Excellent. 11. Scoring: Now let's add a little bit of scoring to the game. I think it's Ah, it's always a bit fun when you have scorers that you can compare your best high school with other people or just with yourself, especially with the game like this, that practically never ends. If you're getting, you can just keep going. Having some sort of high school will be be nice. So what I want to do is whenever you jump on a platform, you get one point and only one point. So did he jump on this platform twice? You only get one point. Okay, so how do we do that? Let's say, let's create a Kui tax first. Now a good tax is basically just a way for you to display any sort of text on screen, and we're just going to set the default as their own. That would be your score, basically, and, um, going to reposition this now. The interesting thing is, most of the time, you probably don't want to directly manipulated in this 30 space because it's not actually using the position that were used. Teoh. So the transform for glee tax as as follows ex zero as the left side of the screen. One. I'm gonna do their point knives. We can see it. So as you go close to one at the right side of the screen and why zero is the bottom screen , one is tougher screen, so that's very different from the sort of three space we use here. So just to remember that I'm going to say Position tax in the middle of the screen anchor, it's just do middle center to make sure that it's centered and that intense of why I wanted to be close to the top. Maybe doing 0.95 no time. So that's that's good. Let's keep it that way for now. And what we want to do is every time we had a point, we simply add one to this tax. So we just keep adding that number. Actually, I think will be more fun if we have another object that the player have Tea Player has to collect your to get coins. So So I'm just gonna use this severe here again. Position. Keep doing that just because I want to make sure that the Z position is zero um, and corn and I wanted to be a trigger. So this is our a little gold gold coin. Here is Just imagine. Pretend that it's a coin, Actually, that's used. It's used cylinder. I think I would look better. Okay on. I'm gonna make it really short. Something like that, then. Amenable. Tate it. Right? So that looks more like coin. I might just make it a little bit biggest, so we can actually collect it. Right. Okay, so that's that's not a little fat coin. There sure is a trigger. And we haven't been adding any color colors to the game. So I'm just gonna create corn, a material for the coin, and, uh, just gonna pick a color. Okay, That sounds a little bit more fun. Change the name safe, so I'm going t o save the score. Data on the player object. You don't have to do with this, right? But, um, that's just how I like to do it. And I think I want a separate state machine first. So again, point made for a state machine. You don't necessarily have to do with this, right? But just for now, I'm gonna keep things separate. Four. Okay, now we have I don't, Which is Nothing is happening. And I want to check for Trayvon's when the player triggers the coin or when the corn tributes. Where? So again, we need a tag. So go back to coin at tag a coin. Remember? We always have to go back here. Coin, Right. Well, we have just been a rotated a little bit more. Something like doesn't really matter. I just wanted Teoh have some sort of consistency. Um, okay, that that's fine. Um, what was I? Okay, So now when go back to the score control state machine and coli tag wanted to go Teoh stir coin. I wanted to make sure we're triggering the coin. I think I'm putting this into state copy paste. That should be in Idaho State removed that one, and we're just gonna have a finished state which renews when coin is courting. Also, I'm gonna use gonna create a variable that host coin that's being collected, and I'm going to start here. Okay, now another very point. I want to keep Aziz a current score, right, and it's going to start from zero, So that's fine. And one, the coin is triggered When, when the player touches to coin. I want to do two things. First, I want to destroy the coin, right? So let's do that destroyed object and curious a coin. And then the second thing is, I want to add the value of the score. Right. So score was defined. Been Introgen, and I'm just kind of doing it. That and when that's done, let's go back too high. Don't state. So it's called that State Square. Okay, so let's see him. Let's see if it's working. Okay, so score as at zero. Good. And right. So we removed the coin successfully. Let's check the score scores now. One I just gave. That's what we want it. So that's good. And I'm just gonna place a few of these. Run to me. I'm just just wasn't testing. So what do you see? And it's here. I should have a score of three. Right? So that's good. So that's where it came. Now I want to just simply and the coin as part of the platform three fat. So how'd I do that? I'm just gonna track this in. Yeah, I could just me, Okay. I'm just gonna drop that into Oh, sure. which platform this is because that's that one. We're gonna drop this coin into that platform there, okay? And I'm gonna simply apply this when you click on apply. This is gonna changed all the prefab. So it's going to change the prefab to be exactly the same. It's this one that you're applying and all the other instances off the prefect will change . So let's do that. Okay? You can see that the prefect now has the coin child object. And then these ones host showed up, so that's a quick way to make that change. And as you can see, all the platforms now, we'll soon have that corn. Have those coins were there. Okay, so So that's the coin. Now I want Teoh. Make sure that this tax is showing the coin right. This gooey tax I'm going to change. The name is Wong score. And, uh, let's go back to that state state mission. Okay, So after added the Inter Chur after added that score, I want to Okay, so first of all, that's create Hey, String called, right? So remember strings or tax words, Anything that's not know anything. This alphabet alphabet ever medical. I don't know. That's correct. Saying anything. That's text. Basically. And, um, what we want to do here is we're gonna convert, honey. So we're gonna convert current scored to square, right? Okay, that's that's easy. And, um, we're gonna update going. Tax said group text. No, no, me. I want to make sure this happens last. So we convert into to a string. Why? Because on the Greek tax, this takes a text variable takes the string. So I need Teoh changed into variable to a string variable. And I'm just going to specify which I object to use gonna use the text subject that we're just looking at and what text we want to set it to said to score. Okay, so that should do it. Let's try that. Pay attention to this number here. Yes, we more more coins. Now the game is slightly buggy with the wall because you can actually position your player in between the edge of the screen on the wall and will be invisible and then began came over. So I mean, we can always go and fix that, but that's not what I'm worried about right now. Let's just get scoring. So you can see that you are collecting more coins and then it's reflected in attacks. That's pretty good. Okay, so that's that's how you can start to have some sort of a basic scoring system. 12. Wrap Up: So there you have it. We have a basic doodle jump style game set up here, and, um obviously we haven't at and if the effects and Santa facts and particle facts that we did for great Gap. But, uh, you can feel free to add those in, uh, if you want to. I think I would be pretty fun to do that. And there are a few other things I want to talk about, and I'm gonna do those videos separately from after this. But I think this is basically what we wanted to create a sort of jumping style game. So have fun with it, and I will let you know one. Some of these extra other topics I want to talk about are available to send you an email post in the Forum or a post on the course syllabus. So have fun 13. Extra – HighScore and PlayerPrefs (Save Player Data): I was going to talk about player data and say files, uh, directly in the scene in the ST and I actually recorded a video for that. But I realized I want to do it in a new scene just so that you get to understand the concept of it more before applying it here. Because right now, after I recorded the video realizes it gets a bit messy and sort of hard to explain. So let's do that. It's crediting. You see, Emma put lighting in it, and then I'm just gonna add a cube, right? I'm going to create something really simple. So the idea is the game would be just if you click on the Q and you get a point and, uh and that's it, that's that's that's the whole game. And, uh, the reason why is because I just wanted to talk about keeping high scores in the system, right? So that's set up quickly. Que could play maker and just dio we did in, I believe, in Week two. We talked about, uh, how creative so initially in Idaho State and then at Sports State on the supposition, be a mouse down event could add squirt, and I want to define a variable. So this just just call this scorer. And I wanted to be on into dress. So here, for we need to do is just gonna do need I had We're gonna add score at one to this score variable. And after that, going to hey, finish event, right? So let's just take a quick look. Right, So that clicking on this a few times you can see that it's going back and forth between the two states and now the score bearable is nigh so I click on it times 10 tires 15 times now . Okay, that's good. And second thing I want to do is I want to create a Greek text, and I'm just kind of position this up here and all sent. This ain't variable too to the coup de text object update. There's tax here, and what I need is a score thing. Variable because a pretext takes a text variable. The text. This is a text field so weak we need a string bearable to pass it on to that object. So this is very similar to what we did earlier with jumping game on. I'm gonna convert that's true shrink and convert the score to the score string. And I'm just gonna end this little bit here so that it will have the score tax and then the number. If you don't have to do this, I just wanted to look a little bit better. And then finally, through an outdated tax CIT group tax and, uh, just gonna drag this guy here and we'll send it this tax there. Okay, Now let's play this. So as we start playing, see that it's on changes the square. So that's good. And also, I'm going to just change the default text to, So when we start, the game could be a that zero, and I'm just gonna say this scene now quote high school. Okay, so we have this score, so this is nothing new. Now I want to create another object here and the glory tax object. I'm gonna call this one store and I'm going Teoh also directly. What physical change. This high score. All right, and, uh, position a town just all right. So I'm many ability in this one, too, and I am going to directly add a playmaker state machine on this tags and I want to do is simply go to player press now. Plenty preps is where you will store all your user data. So think of it as well that the name player price stands for player preferences. And what that does is it allows you to store information on the device that the game is running on. Right? So it's very similar to the way we've been using Maribel's. I was have variables here that holds value to the game. A player pref. You see if I can find that window. Uh, player Price basically does the same thing. It holds values in these containers where you can access after you stopped again. Basically, the developed think of it as about variables that stays on the machine on that doesn't get refreshed until you explicitly change the value through player press. Right? So if we come back to this, the variables with defined every time we restored the game, they will reset. But any player price variable that's just called in variables for now, they are not gonna be refreshed. They're just going to stay in the system. It doesn't matter if the game is running or not. It's It's written to a file on your device. Let's just see. See how this works? And I think once we start using it, you'll have a better idea. So the first thing I want to do is I want Teoh define a local for a variable that's use in the game. Right? So I'm gonna call this high score. Actually, I'm gonna cause some high school. And it's an industry. And here I want to play her price, get into drink, right, And you can have multiple of thes. But for now, I just want to deal with one in future, and I'm gonna call this key. Now. The key is like the name off the variable, But this is the name of the key, which is saved on a fire on the device. Right, So it's and it's not a variable. It's the name to key off the key. And this is case sensitive. So we want to make sure we used to write name for and I'm gonna call this high school. I'm going to store that in this system. High score variable. Now again, the key goes into a file on your computer and grabs a value that's assigned to high score and here would get that value. And then we assign it to system high score variable. Right. Okay. And also, I'm going to dio something like this where we're going to say, I'm going to set. Actually, that's not do that. So we get the high score. So think of this as as a system data point, and I'm gonna send us to my going next. And since this object has a Greek text component, so I control issues owner and then I'm just gonna hopes lefty this convert into to string remember, we have to have to have a string for string variable for for the good text. So I'm gonna just do that now. All right, Reporter. So I convert these two format high score. I don't think you need quotation marks, right? I would like to have that. Okay, so let's see what that does. Play grabs valley. Whatever is inside high score and then pass it on to your system high school. But because there is no value in high score, just know there's nothing is displayed here because we haven't set value to high SKorea. We're just getting it now. I wanted to do this because I want to be able to see the changes were making as we came. Let me just enough these states. Okay, let's come back to this. So I'm just gonna call this display, okay? I don't actually need. Now let's come back to the Cube where we're adding score. So the next thing I want to do is while we're adding scored to this local variable local score, I wanna compare to the high score. Now, there's nothing in the high score, so we are not gonna worry about laughing out, but I want that logic to be there. All right? So once we added a score, I'm gonna add a new state. Think, call this set system. So once the score is added to the game, I want to compare to what the high scores in the system. Now I need to first define a variable. According now, this is on a different object. So we have the same name. That's fine. And I am going to grab it, grabbing that score again, grabbing the key. So make sure that this is the same thing as whenever you want to get that score. It's the same name. Otherwise you're gonna get different results. But I'm getting that scorer, and then I'm gonna compare, Okay? The two actually on and going to simply grab whatever is bigger off the to. So I'm gonna dio square on and assistant high score. So the score is the local score here. System high score as now, the value of high score in the sort of the on the device is that this is saved data, right? And I'm gonna pick the Mexican one, the bigger one. And I'm gonna story as I'm gonna define the new variables for new system score. So I'm gonna store this bigger off the two in the assistant high score and finally, I want to write Does I want input? I want to enter this new Valley back to the player press key. Right. So I'm gonna go play press settlement, high score, and the value is going to be the new high score. Right? So here we're setting the end. We're setting the interview that's defined in the player press high score with That's the key. High scores to keep the name of the value. That data there was storing, so let's see what that does. So when I click, this thing goes to that goes through this state, which asked one score here, and it comes down to set system high score. And because the new score is bigger than the previous high score that's in this key. And there was nothing to find service zero court. There was no there was nothing that. So we pick the bigger number, which is one, and then restore that number into the high school again. Now, if I run this again your seat, the difference, I run it again. I think now you can see that the first action will get end from the high school key. It's no longer a zero. It's now variable off. The variable is not one because that was the last no key that we entered the last time we rented here, right? So you can see that that score has been kept inside the system even when the game is stopped. Now I want this to go back to the Edo State so we can keep and score. But this basic set up is done. Now let's go back to the high score and here. I want to make sure we're grabbing this every frame, so it doesn't just do it once. So update. As we continue to answer, Of course. Okay, that's that's run this right now. You can see that the high score is one. That's the because we in the previous play session, well defined the new high score for the system. If I start scoring, let's start and play again. I can see that now. The high scores. Seven. Right? So if this time eyes scored 15 points for 16 points, stopped the game and you started again. You see that the high score is now 16 right? So that's good. That's that's fairly handing for storing data that that's consistent throughout different places. So that's how you do. How does how you create high scores and you can use player press for provocative variety of different things? It doesn't just have to be meant. It could be a string that could be a float but even see that. That's because this data is written in the system on device. It's consistent throughout. Now there does just take a look at some of the other ones here. You, the player price action plug craftily all basically just removes all keys and the values those keys. So let's say if you want to remove all user data, you just use this action her prostitute key, that you can delete a key. So, for example, if you want to leave the high score key unjust and high score here that you delete that key from the system and then Esperance even said and get slow into and string so you can use that to start building a player data system. And again, you can have that say, if you want to try high score and um, time, that's time, then you can simply define. Okay, I'm gonna define two keys and then you can do it to you where I'm gonna get to kids. So So that's how you use it. And it's a little bit confusing at first, But just remember, all you need to do is set the player perhaps key to a value, and then you can get that value if you want to display in the game. So that's that's basically how you do it 14. Extra – HighScore – Add HighScore to Game: Now that we know how Teoh, you play a prep for user data, that's quickly apply it to this game here. So I'm looking at the score State machine. I'm just going to say I'm gonna start from fresh, and, uh, we know that this is when we want to get to sit high score. I use the same named key and we know that before we do that, we want to two pair the two. So I'm just recreating what we already done. Guess for you. And let's see, So we got current scores. We want to compare current score with the system. High score, Yes. Make it a little bit more descriptive. Previous, high score on and do this quickly because we've gone over this previously. But if you have any questions, go back that video and review review, it should be able to follow and follow it. We're gonna pick the bigger of the two and then set it as the nation's in high score. And we're going to use that here. A true sign it okay. And finally a Greek touch assistant Highs hissing high score. I am going to add sure here at a state machine and again get it, I think. And I'm just gonna get and again convert to train Have to Ritz and I need another variable need a string variable here. Convergence is a high score justice in my script string format guys for and then said, Use that. And I wonder just frame. Although I don't think it updates until I quit the game. Let's do that and I'm gonna move this up. It we did her there canal play. There's how they just pause it for a second disabled. That and also you noticed the high score is at 22. Why is that? Well, it's because when we were recording the previous video in a different scene, we were already making changes to the high score to the same key. And it retains that key so you can access the same key, very different seas. And it's all gonna be the same value. So So that's always good. Okay, now I'm gonna start collecting coins. Now I have to get to actually, instead of doing that, that's just, um, just run something once. So I'm just gonna create a new action here. I'm gonna go on only going to use it once we're gonna delete all But so this would remove all the player price data. I run the game and it's gone through that action. You can see that that's deleted, that there is no longer there. All right, stop the game. And make sure you removes this because otherwise, everything is raised every time you play. Okay. Now, that's Ah, this test again. Okay, so to now, I can see that high score is not too. If I get more than two points when I restart, it's going to show better squirt. I'm it for See that high school is not for you gonna find, stop the game and then start again. It's gonna have that number. So that's how you add a high score to your game. 15. Extra – PlayMaker Template: I want to quickly talk about templates in Playmaker. This is a new feature that's been updated. Teoh play make a 1.5, and it's a really powerful feature, and I want to talk to you about it. So basically a template as something that let's say you create a state machine can save it as a template. And then you can use the same template in different objects or different pre fabs. And when you want make changes, Teoh the template, you can do so updated and all the objects and pre fabs that are using this template will automatically be updated as well. Let's just let me demonstrate that for you. We have a cube here, and what I want to do is I want to just click on it to change, to color, so half the sure that's Teoh and right. So when it's in a green State set material color to be three and when it's in a red state, do read. Okay, so we're gonna simply dio mows down Event to switch between the two. Okay, Just give it a quick test. Cain Red green. Right. Okay, so that works. Okay, now I'm going to save this state machine has template, so I can use the same mechanism in other objects. So right, click in the editor here and click on Save Template. And I'm gonna call this colors and it's going to save in your template photo. I'm sorry, playmaker. So it's gonna be assets playmaker, so I don't think I'm safety. Okay, Now I'm going to create a new object. Let's dio it's here, here, and I am simply gonna add a playmaker component on it. And instead of going into the state machine to change it, I'm just gonna use template. There's field here, use templates, and then click on this button to find the template you want to use or you can drag it. Here is where we can find it here as well. And I'm just going to select it from this button colors which Okay, now you can see that this is click to edit template, so you can't directly added this ste mission anymore because it's linked to this template. We're using this template and the same thing. If you look good, they tear out. Actually, the cube is not using attempting yet. We've saved the template using was designed here. But I am going to say, OK, keep where's we're gonna use too close which template you could play. You can see that Berries growth object. Scott That mechanism working. So what's cool about this is I can't say Okay, I'm gonna add to the template, and I'll make changes to it. Chances to to get darker, read and would play. You can see that the changes being applied two Berries Tom checks. So this is a good way to create templates and to make changes to different types of objects , so you can pretty much do those if you're using prefect. But the problem with prefab is it's not. You're not just creating a prefect on the component. You're creating a prefab on everything else so you can't have different shapes different that say you want us to be hey, an enemy character in this to be a player character. In that case, you wouldn't want to use the same prefab for Berries, but you can still use the same template for your playmaker composed. Let's say if you have a playmaker state machine that controls the walking animation, and it's most likely same for different types of characters that you can use the template for that. So that's a quick overview of how you can use template again. As soon as you link the same mission to a template, you are not gonna be able to directly change said on the particular item. But you can add it the entire template, which will then apply to every object with this template on it. 16. Extra – GUI Layout Button (Unity 4.x): you have asked about creating user interface, a graphical user interface had we can spend it an entire course on you. I gooey. But I'm just gonna quickly tell you what you can do right away. It's fairly simple to set up with Playmaker as well. So here I have a just very basic scene with my camera and a light. Okay, so well, I'm going to do is just gonna I'm just gonna create an empty game object, And then I'm gonna had they play, make a component to it. And then over here, accidents that had a change. Just one over here we have are planning a steak. So what I'm gonna do is I'm gonna create a button here that we can click on, and then it's DD. It doesn't actually do anything yet, but that's just create the button first. So I want to have to states, and when you click the button, it goes to the other state. That's what Enjoy your what you want to do. So what you want to use is misused, Greeley out. But now there are a lot of different actions related to gooey, but you probably want to start with greed layout because it sort of comes with the default layout for for unity. And you don't have to worry too much about creating images just yet. All right. And I'm just gonna add finished events when people click on this button. Then as soon as I add as soon as I added this action here, you can see that there is a button that's has appeared. And you can just I had a text trip, okay? And also, you can have some options. Okay? I want to change height or with off this button. But it's not about that and then connected to when you press this booking that goes to finish, uh, the other state. Let's play that Christian as you click on it goes to the other state and notice that the other button finished. I mean, the button just disappeared. It's because we don't have that action here in this state s so every time you want to draw that problem, you need to have this really out. But I'm gonna just copy that. Then it's finished. Go back there and I'm just gonna have some sort of changes. So we know in a different state so that I have been changed attached, just to see, to say press So here, you can see that have created this button was in default styling on it. 17. Extra – UI Camera: Now, instead of going any deeper into I agree layout or the D for unity could be function. I want to tell you how I like to do gooey and, uh, it makes a little bit. It's a little bit easier for me to do it this way instead of figuring out how to reposition these buttons. And it's not as intuitive as as I would like it to be. So I'm just going to say about this subject. Actually, I'm I have to, uh, just delete it. That started a project. Actually, you seem so I'm just gonna quickly recreate quickly, create scene so we have something todo look at. So we have basic seen here, and I am going to create a You are using this technique by basically adding another camera and can use that to to sort of create You are on top of this view that's gonna create camera name this you are. You can see that this is already overriding the view bit. That's because, Well, we have two cameras that sort of competing with creating a view for for the game. I wanted you our camera to face the other way. That's the first thing I want to do. So it doesn't look at whatever is on the screen. Whatever I want to show in the scene. And then I have to change, uh, see where it is now. Death. Right. So basically decides. Have think of it as second layer to decide which camera is gonna draw on top of the other. Right? So you can see here a camera with the larger death. Baylor is drawn on top of along with a smaller, smaller value. So I'm gonna set this as one and other one as one, right? So, actually, I want to do it the other way around. We're gonna set that. No cameras, negative one. And the you can this one. And then I want to make sure that I don't clear flag. See, if I clear, then it means whatever and looking at if there's nothing in front of it, it's just gonna it's just gonna show a skybox. But if I use is a solid color, then it's going to show you sell it caller before I just don't clear. Then it's not going to show it. Can you say if there's nothing in front of it? it's just gonna be transparent. But so I got you. I terror set up. And also I wanted to be photographic. That's usually for you ized if you wanted to be. I don't necessarily want that three d effect. I just wanted to be. And you just wanted to to look like to the elements. And then I'm just I don't really need it to be for it. Doesn't need to look for him because I have the your camera and that's start creating some sort. If you are so so you can see what? Where I'm going with this, You create a queue, you call this? I'm just gonna re position it so that we can see it properly. And you can already see it there, right? And if I turn off the your camera, we won't see that two because the man camera is looking this way. It's looking at these two things. Do you like camera just going that way? And that's that's where we're gonna set up all these. You are elements, so something just scale this up measures. Make sure that it's properly inside of you with the camera. Because this author graphic it doesn't really matter how far away it is as long as it's inside. It's cute here. This own box here. Okay. Okay, so we've got that putting here. So what you can do is simply add reposition it to wherever you want Britain to be on the screen and can just start using it as a normal game object. And I'm gonna say Ardell and you start So let's say if I'm creating every start button, then I can just most down event go to restart now to start the game here to make sure that we can see that. In fact, I'm just gonna add a Richard body. Que was physics with gravity. So when you start the game, we just fall down, okay? And then on the booking, you have to restart action. So okay, when you press play, the game is running and I can press on this. Consider gave his reloaded. So that's how you can start creating your own. You. I system using playmaker, and it's the thing I like about. This is you can you can visually make changes. You can have the button do crazy things like can shake the putting whenever is clicked on. You can play sound effects basically, or you need to do is just treated us in normal object. And then you can do all these things that you do to to any of these objects that we've been doing very connect. All sorts of effect can change the way this looks. It gives you a lot more flexibility. So that's how I like to set up you. I, with flavor good sometimes. 18. Debug – Freeze X on Player Rigidbody: Now there's a problem when we play the game that if you were a player as close to the edge off the platform, the default physics engine pushes it away from the platform, which is not exactly how we wanted to move. I mean, restrike that again so you can see it. Okay, it's going up in down. But if I go clothes to the catch off, platform your story, it's moving towards the right. We found her name Pit. So that's not exactly how we wanted to work, even though that's how sort of the default physics works and to fix. That's very, very simple. Um, posted it. Sorry that I'm playing and click on player and we're just gonna freeze the X position. Now, this doesn't actually freezes three acts. Movement simply freezes the physics on the wine, the physics on the X axis because this justice from the reach of body. So if we just fix that quick play now that the, um the physics is not gonna it's not going to affect the object on the axe access, so you can see them towards it. The edge. And it's not affecting the movement on the X axis to escape 19. Debug – Stuck on the Wall: now, the book that you might have noticed is in certain sedatives. Come, you might have a situation where the player would get stuck between the walls. Well, it's more like the player object would get stuck in the wall. So basically, it is possible when we remember when we move the When we tell a poor the player as soon as a player has this wall where we tell put it over here, there is a possibility that my collide or it might trigger the other wall again. And they would try to go back to this side. And we just keep going back and forth. Now, this, um, this the likelihood of this happening really depends on how you were you positioned. You're too loss on better me. Any trade. Okay? The problem. So you can kind of see what I mean if you catch it. If you caught that. But you can see a little bit When when the When the clip player character was going back home for like that, right? So how do we fix that? So we've basically realized that the problem is when we teleport the player, we are teleporting the player Exactly where it was at this point, where it enters air, interacted with the wall, right? So basically, when the player goes somewhere here, it triggers the wall. It goes to the exact opposite sign and which, by their finish in it probably will be clipping into it will be triggering the war as well , because that's does the way it's currently set up. The reason why you don't see this all this harm is because when you there sort of velocity when you're moving so naturally their movement continues. So years leaving that wall. But that doesn't mean that the problem won't happen. So to fix that, we can just go back two player, state machine with the wall triggers. And instead of multiplying Planet if one we're just gonna dio negative guy could just treat this number so that it's less likely to to have that problem. Let's get that try. So, yeah, so it is. It's not that is to create that problem. And if you look at the seen, I try to do this first. Okay, so let's just go friend by frame. See if wand I don't think he's going to touch it. Trading Okay, so you can see that the object is about to hit the wall, Sinise. It hits it. It gets teleported over here instead of previously were tele boarding you over here. Now with gifts, we give the object a little bit of buffer before right in front of you are so so it's not gonna go into the walk, so this will help us solve that problem. 20. Extra – Multiple Scenes (Load Level): Now, how do you set up multiple scenes? Let me try to do that too quick them out by setting up a main menu scene. So most games when you start the game, you have a brand new scene. Doesn't have anything in it where it doesn't have any off the main game playing it. But as soon as you click a button instructed game, so it's just set that up quickly, and then I'll show you how to create the main menu. So I'm gonna just make this real simple. Okay? Okay. So I'm gonna say this is the start booking, and when the player click on it, player clicks on it, We're gonna go to our actual game, and that's gonna be in another scene. So I'm gonna save this scene court main menu, and it's good to play. Make right. Just quickly. Add new state called load. I mean, and we're gonna add a tradition moons down, and then here we're gonna go the action browser. Andi, find level category. Right now. I'm just gonna do low level, give it a name. Gonna find name, and we're gonna try to load this the main scene. Right? So just put that in there, Okay? Now, if you try to player, click on it, you can see that the state has changed, but we're stealing this same scene. But why is that? That's because we have to go to built settings and basically put all the scenes we want to include in the game here. And this is a special important for loading scenes. Because if the scene is not being the build that it will not load, so you need to do is just placing them here. Just drag and drop your seeing into this place. Hey, play when you click on this, those the next scene. So this is how you create multiple scenes. You can load them using the name. Just make sure that they are listed in the build sittings here. 21. Extra – Send Events: Another powerful feature of playmaker is the ability to send events from one object to the other. So what you can do as you can have objects, reacts to other objects conditions. So let me just demonstrate that quickly. Here we have a cube and a fear on a basically just hey, floor a plane, rename them trait. I'm just going todo and, uh, let's try doing something different. So I want to do is I want the the ball to change color one. The cube hits the floor. Right. Okay, so So that's see how we can set that up. So let's go to the key. Finished? I just want to add a rigid body on it so he reacts to gravity, See if that works. Quick play. Yeah, goes down and then it touches the floor and stops right now. Let's go, Teoh Playmaker, Keep playmaker. Just Avenue State. Okay, so that's added new state. So that state one will be initial state instead to be cold. Oh, and then here we're gonna say, OK, I'm gonna go to state machine a whole bunch of actions here and we're gonna dio send event if I can find it you right here. You can say, Well, we're gonna send event object, various different ones. But let's just keep it there for now. Let's go to this one first, because now we just need to add a collision event. Collision Enter Goes down to the next state. It's disabled this for now. Just check and see if that's working. So it goes to the core event on Sphere State when it touches the floor. That's good. Now let's go to this fear and set up a few things here. So we have the initial state. I just say this is the area of state and I'm gonna add another state. This is when it changes color, and I'm just gonna do a simple set with color. Use this before and, uh, just read doesn't have to be afraid. And let's go to your guns at an event called change color. Now you want to make sure that this box is checked right when you hover over, says Global, which means this event can be called by other objects. Where is that local? It's not an event that can only be used by there's practical statement saying it could be the eventually called from other methods are the events or other state machines kinds of We have that checked now, right? Click on it again. Let's go to Global transition Trench event. So he changed color. All right, so this basically means it doesn't matter what you stayed. This object is in. As soon as the change color event happens, we're gonna go to this state and then change their color to red, and we might as well do. You are finished state and go back to idle. Okay, Now go back to the Q and that's enabled it sent you. Then again. And we wanted dio. Well, what? What? What? What? What do Where do you want the event to be sent to write So we can are the specify game object. I just drank it here. Actually, I think what we need a skim object state mission were specified. State machine, and then the event. So what we want to do is we're sending a an event to state machine, right? So we drag the object down here when we find the state machine name, which is defined here, and I haven't changed it so still profess him and then we select event that we want to call . Now, This will only show up if you have checked this as a global event. Okay, so that should be hooked out and no delight. Okay, so that's see what happens. See there. Since this goes to the state since event for track atmosphere Oh, it's come back to item. Let me just remove that. It's actually not necessary. And just look at this thing here. So we're gonna go friend by frame. As soon as that state changed, It's color is being updated. You can see that be around, Pause it. This object is actually in the code eight state. So that's how you can send events, too. Objects to different objects. And if you I spent some time looking at the statements in category, there are a lot of different things you can do here to communicate between different state missions to its very handy, very, very useful 22. Debug – Going through Platforms: So some of you are having some problem with the player object going through the platform when is moving downwards, right? And it doesn't seem to be happening very consistently, so it's a little bit puzzling why that's happening. So let me just quickly explain why that's happening, and then we can talk about how we can fix it. Just turn off playmaker Christmas care. So essentially we're comparing the current system is that we're comparing this point with this point right? And when the object is moving downwards, theoretically issued here and detects a collision right and at which point this is still above this point, right at the foot point is still above the top point here. But what's actually happening in the system is whatever an object is moving. It's not moving sort of smoothly like that. It's moving at a purse frame, so every friend is moving at a distance, right? So this is what frame the next frame you might be moving here and then next friend, you might be here. Things for him is here, so it's It's very small jumps. Basically, that's how it on object moves right? So when and objects moving really fast and that jump is bigger, right? So you might be here that the first frame and then you might be here the next frame when an object movie really, really fast. And then the next frame here, next from here. And what if what happens if you in the previous from your here and the block is solid, It's The collider is turned on, playing the next frame. You're here, and the block is no longer. That collider is no longer neighborhood. Um, and in this frame, because the object hasn't touched the platform, the collision didn't trigger didn't happen. And in this frame, because we've turned the collider off that the collision again, does that happen? So the object the plate object was simply go through the platform. So that's that's the problem we're facing here. And this will happen if your object is moving really fast or if this point that we're using is too high, right? So it doesn't give a lot of buffer to this problem, right? So imagine if this point is a little bit lower than we have a bit more room to to give a bit more rented. Tiu have that ever. So let's that that's the first thing you can try to do. If you're If you're seeing this problem now, not all of you're going to see this problem depends on your set up. Depends on how fast you're moving is an object and where these two points are. So I'm not actually seen this problem in my version of the game, but you might very likely see it, right. So ah, quick way to fix that. The first thing he contrives go to the prefab and just move the top point down, remove it down a little bit, moving down to zero. And this will help prevent some of the problems. Because now we're giving a bit more room here. So it's a if you found this frame is here. Next from is even here a little bit. It's still okay. Could still you know you can Still, the collider is still turned on. We'll still have that collision. So that's the first thing you can try is just by moving this point about that change, Okay, Now, the second thing we can do is, instead of using these two points, we're just gonna detect if the players moving upwards or downwards was This is kind of similar to how we fix the super jump problem, and we're gonna do exactly the same thing. And and I think some of you have mentioned have offered help in the form using this method as well. But let me just create quickly, create a new mechanism for the collider for the collider, and then you can see it's actually really quick to do. Okay, So make sure we're selecting the Prefect. And what I want to do is I want to temporarily just turn off the coal lighter control playmaker, um, state machine, cause we're not going to use that. This is the one is controlling the on and off off the collider. Right? Okay. So make sure we were selecting the prefab, and I want to add in the year first them and I'm gonna call this whole idea for name, okay? And, uh, we need to get the initial state because we need to find the player object so can compare so we can find out if the plane up drug, it's moving upwards downwards. Right? So first, define that player object, and that's a game object and in the initial state. I'm going to find it. This is fairly straightforward. We've done this a few times now. Okay, Now we've got that player, but find a player, object with the player tank, and then put in the plate. Object variable. Okay. Finished kind. When the game stores, uh, the player object would be falling, I would be going downwards. And then that's when everything should have the collider neighborhood. So I think the first state should be. And then next day this, of course, Coligny. Great, then. But we want to do is first we want to set the collider. Right? So it was a quick, quick way, Tiu, do the set property action, which is you can just drag the component into playmaker and then select set property. And they were Just grab that compound and put it in here so you can quickly manipulated. So I'm gonna enable this property and in the collider disabled state do the same thing. But this time I'm gonna disable it so we'll leave that unchecked. Okay? Next as I rolling to check if the players moving upwards with that words, and then we'll decide what to do Based on that. So the first thing I need is a float. Favorable. Cold, Clear. Okay. And I'm gonna just get lost in here again. This is exactly the same. That's what we did on fixing the super jump. And I'm going, Teoh, get the velocity of the player of junk story stored in the last day on. Why? To play? Why? I've lost t variable and I want to check every frame. Right. I'm gonna copy us over here as well. Something just getting the velocity and checking which way the player is scaring. Okay? And then finally would your foot there and couldn't pay the player. Why have lost tea with zero? We just want to know if it's bigger than zero or not going to do a sign and want to do this every frame. Stop protecting. This is every frame world disparities. Good, Good. And if it's greater, then we're gonna disable to collider, right? If it's greater than zero, that means the object is moving upwards on the y axis. Then we wonder to say about all of the colliders. So when the object is moving up, we're gonna turn off or the colliders. So the player object can go through them. Okay, then copy Theirs paces over. And here we want the opposite. Eso won. The player is moving downwards. Then we want to go to finished and in Neighborhood Collider and just four safety. I'm gonna just in case if the player of lost his zero, then I wanted to be I want to collide. It is to be enabling us. Well, okay, so let's see if that works. Now, remember, I've disabled the collider control. Now all the collider changes are going to be through this new statement. Ship collided control too. Hit play. Jason seems to be working. That's just, uh, video is a little bit chubby, but it seems to be working. Right. So this is another way to managed platforms to collided on the platforms. Okay, so that's how you set it up. Instead of using two points now, I can actually remove them, and I was still work, but I'm not gonna do that. You can experiment with them if you want. Just sort of disabled. Then if I just disable them the night scene anymore, right? She's still work. Still working. So that's how you can fix that problem If you're seeing that