2d Game Dev Unity Tutorial - Hyper Casual Game
Skills:
CV Basics50%
Key Takeaways
Creates a simple 2d Hyper Casual game using Unity and C#
Full Transcript
what is up guys fah here here with another cool tutorial this time is a small hyper casual game and as always before we start coding and creating and doing all the magic we're going to take a look at what game we're going to create but before we do that hit that subscribe button hit that notification button and smash that like button i feel like those like those vloggers you know smash a like anyways but seriously subscribe hit that notification button and smash the like button so now let's take a look at what game we are going to create so when i hit the play button you will see that we have these platformers they are going up our our background is going down we hear the background music and we have different platforms here you see you hear the sound effects now we are dead and the game will restart so again let's try to beat the game and here we will also land on one of the breakable platforms which eventually will break and bam you see it broke and we fell down and notice how our cube our game player is like rotating and stuff so yeah that is also a cool effect you will also have you see these moving platforms that are moving us to the side we will see how we can create that and we will see how we can randomize all of this and bam we are dead and the game will restart pretty simple game i mean it looks pretty simple but it is not very easy to create we will see that we will add some smart code to randomize these platforms so on and so forth we will learn a lot so uh yeah stick with me and you will have a lot of assignments in this video so if you truly want to learn i'm giving you assignments to complete and i'm giving you hints how to complete that and everything that you finish you'll show me that in the facebook group and then i will grade it like you know in school you have a plus but probably will get a minus anyways well let's start and dive into the tutorial and before we do that you can download the asset and the complete project from www.austrians.com or link is in the description below so uh yeah have fun and enjoy the tutorial i am in a new project and this is a 2d project and as always we are going to start by importing the assets so we have the sounds and we have the sprite simply drag and drop them right here and voila unity will import and by the way the assets and this complete project you can download it link will be in the description below so now the first thing that we're going to do is create our background and this is going to be a portrait game so we're gonna go here and change our view now this is really important so bookmark it write it down on your notepad on your i don't know piece of paper where you write down your notes because a lot of people have issues with this and that is because they don't pay attention how can you change this screen size well it's really really simple for that let me take my highlight tool here it is so you see here i'm in the game tab and right here where the game tab is you have this where it says full hd now for you maybe it will not say full hd well not maybe but surely because i created this you can click on this and voila you see here you can have some already predefined resolution such as 5.4 or 4.3 or 32 or 1610 169 so and so forth you get my point but here at the bottom you have this plus circle so you see this well i cannot use my highlight tool when i'm clicking on this anyways you see this plus circle here you can click on it it will open this pop-up when the label here is the name of that resolution so name of your resolution for example full hd hd so on and so forth and here you can set the width and the height so for this example or for this tutorial i chose 480 by 800 so you're gonna type width 480 height 800 and you're gonna press okay when you do that you will see that resolution right here here it is and i can click on it now and bam so i have changed the view so now my camera is also changed you see here how the camera is now like a rectangle or actually it's not a rectangle i think it is yeah rectangle and if i go here and if i change it to full hd you see it is in landscape bone when i go back here and change it to 4800 it is in portrait mode so this is how you change the screen in unity and this is how would you create a game for a portrait resolution or for a portrait mode okay so moving forward we are going to create a quad so i'm going to right click here and go under 3d object and create a quad now if you followed my tutorial about the space shooter and hopefully i've published that before this one because i already have them created anyways and if you watched also my parallax scrolling tutorial you will know what i'm gonna do so i would encourage you to try this on your own try creating that parallax effect on the y-axis so that well you can practice and then you can come back to the video and see if you did it correctly so i'm gonna change the quad name to bg and i'm gonna go and right click here in the project and create a folder i'm going to call it material and i am going to go here and create a new material i almost created a script and this one is going to be our bg material and attach it right here on the bg game object so it is attached did i attach it actually no so now it's attached okay the next thing that we are going to do is change the shader from standard here to unlit texture so voila simple like that so now i can click on the drop down list we can attach a texture here which is our sprite so we can go here in our sprites and i can select the background here it is so select the bg and now drag and drop this background right here and the bam here is our background of course we are going to resize this bg so we need to set the scale for the x at six and add the y at ten and voila this is our background so we are in the game view and this is what we see and if we transfer this game on our phone this would be what we would see i'm also going to set the z at 10 because this is a quad and because of this it will be rendered behind all other game objects so set the z at 10 and of course we can change this later on if the background is obscuring some of the game objects so we can easily fix that anyways go here in the assets and right click and create a new folder for scripts and inside of that one i'm gonna right click and create a new folder for rbg script and inside right click and create a c sharp one this is going to be bg scroll and we're going to attach it on the bg game object so i'm gonna go here and attach it so simply drag it and drop it and double click here open it in visual studio now if you watch a couple of my previous tutorials you will probably notice that i'm testing you along the way and it's not going to be different in this one so prepare for a test pretty soon anyways we are going to have here a public float for our scroll underscore speed which by default i'm going to say 0.3 now of course you can change this you see i set it to be public so if the speed is not what we want we can change it easily we are also going to get a reference to the private mesh render that i'm going to call mesh renderer and i would encourage you to try to do this on your own as i already said try to scroll it on your own and if you watch my space shooter tutorial you will see one problem that you're gonna get same as what we did in our space shooter tutorial so here we're going to say mesh render is equal to get component and that's going to be our mesh renderer component so simply now here below the update we are going to create void scroll and inside of this function first of all we're going to call it in the update so we're going to say here scroll not scroll speed but scroll this one right here so scroll and we are going to inside of this function we're going to program our functionality for scrolling and what we're simply going to do is we're going to say here vector 2 offset we're going to get the offset of the texture which is going to be equal to mesh renderer dot get texture or actually shared material excuse me dot get texture offset and we need to pass the name of the texture and the texture name in quotes is underscore main text this is the name of the texture so underscore main text with capital m capital t now you know that i don't like this hard coding so your first assignment for this video is to create a common script or a shared script that has all the names tags and so on and so forth that we are going to use that we write as strings so i want you to do that because i'm not going to do it here that's your job i'm testing you out anyways here we're going to say offset dot y so the y axis we're going to say plus equals time dot delta time multiplied with the scroll speed and voila after that we simply need to call our mesh render dot share material dot set texture offset so set texture offset and again we need to pass the name which is the same right here and this is why i don't like hard coding and here we are going to set the offset now this is one reason why i don't like hard coding you see here we're using this and here we are using this it is better to declare that variable first in a common script if you're going to use it on multiple places in case of this script you can declare it right here so you can simply declare it here as a private string but i'm not going to do that that's your job so you need to fix that anyways if i go inside of unity and if i clear first the console for some reason i like clearing the console i don't know why don't judge me and if i hit the play button the script is attached and we should see that our background will start to scroll and voila in indeed our background started to scroll but where is our background we don't see it anymore well let me go here and set the offset y back to one so what is wrong here what did we do and let me set the offset here actually offset here zero zero so yeah what did we do and why isn't it scrolling it is scrolling but it's not scrolling how we intended it to scroll and as i said this is the same issue we had in the space shooter tutorial in the 2d space shooter the same exact issue if you follow that you would know what we need to do is go back here inside of our sprites and select the background and i like this approach really because it is beneficial for you i first show you the problem that you will have and how you can fix it so you're going to select the background and here in the options you see here with the options that we have we have this advanced right here if it's folded you're going to unfold it so if it's folded like this actually it's below excuse me if we set the texture like this to default then it would be in the advanced but here is actually below where it says this wrap mode you see this let me just go here and clear it you see this wrap mode right here this is a drop down list currently it is set to clamp we need to click here and we need to set to repeat and then we need to hit apply at the bottom right corner here for this texture or for this sprite for this to take effect for this change to take effect so hit apply on repeat and now if i go here and hit the play button we will see that the bg will scroll and scroll and scroll and it will repeat so the texture will repeat itself and this is what we need to do so when these textures are not working they are not scrolling how they supposed to be in your code and you did this right here then the issue is simply going here selecting the background and setting the wrap mode to repeat and voila that will fix the issue moving forward the next thing that we are going to do is prepare our platforms because we're going to have different platforms so first of all i'm going to go into the sprites and platforms folder and then into the standard platform so this one standard platform you're going to put it here and voila this is our platform so what i'm going to do is simply name it platform and if you remember a few moments ago when i said that we're going to set the z-axis of our bg because it's a quad at 10. well pay attention what happens if i if i set it at for example negative 11 or if i set it a negative 7 you see it obscures our platform that's why i'm going to set it simply a 10 and voila here it is our platform is in front of it now the next thing that i'm going to do is set the order in layer for the platform at one so you see this right here well basically here where it's circled it says order in layer and i set it here to one that's the order that we're going to use to draw the platform so the game object or the element that has a sprite left render and it's on order in layer 0 it will be rendered behind if you don't know 100 what i'm talking about go and watch my video about orders or rendering layers and so on and so forth now of course this is too large for a platform for so what i'm gonna do is set 0.5.5 for x and y scale that is so scale x and scale y point 5.5 i'm also going to take here box collider 2d and attach that box collider to the on our platform i am also going to click here add component and add a rigid body component and this is going to be a rigid body 2d so please pay attention i say always i say this all the time it's a rigid body 2d when we cover a 2d game so you have here two choices a rigid body and rigid body 2d i think unity should put here rigid body 3d so that we know well i know and you know now but somebody can get confused about using the rigid body what i'm also going to do is because if we run the game now if i press the play button pay attention you see the platform simply fell down we don't want that what we need to do is set the body type from dynamic to kinematics so let me go here clear the pencil you see here the body type for the rigid body this one right here we are going to set that so click on the drop down list to kinematic what is kinematic kinematic is not affected by gravity we can affect it by velocity or add force and so on and so forth but gravity will not affect this rigid body whereas dynamic is affected by gravity so this is for our platform now we also have a breakable platform so i'm going to take another standard platform or actually i'm just going to duplicate this one and i'm going to rename this one to breakable platform so platform like this and let me just lower it below a little bit so here it is we are going to have everything here so same components box collider so on and so forth but i'm also going to click here on add component and add an animator so animator and hit enter and i'm going to put this animator here no particular reason why i'm reordering the component so it's not like your game is going to run better or you're going to be a better game developer if you do this my personal preference so now that we have this animator what i'm going to do is go here and right click and create a folder for animations and this is in the assets folder so create the animations folder and inside i'm going to create another one so this one is going to be breakable breakable plaid form animations animations like this inside i'm simply going to right click and create an animator controller and this one's going to be breakable controller and select the breakable platform and attach the controller so simply drag and drop it right here i'm also going to set the animation tab here and selecting the breakable platform click here create and it's going to prompt us to create an animation the first one is going to be the idle animation so simply name it idle and then well simply name it like that name it idle so what is the next thing to do the next thing is to click here where it says idle and if you don't see where that is that is here in the animation tab you see and here you will have the idle you see the animation now that we have created this is a clickable button so you can click on that and it will open this drop down list showing all the animations that we have and currently we only have idle so i'm going to click here create a new clip and this one is going to be break animations i'm simply going to name it break and hit enter to save now in the break animation i'm going to go quickly in sprites platforms and standard platform in the break animation select these crack zero one two and three and if i preview it you see what happens you see simply if i pay attention in the bottom right corner by the way so you will see it has its simulating cracks it's not crack like the way you think it is it's crack when somebody when something cracks okay not the way naughty naughty boys with their naughty whatever anyways so you see here platform crack zero one two and three simply drag and drop it here and this is for the breakable but for the idle we are simply going to put the standard platform and voila we're good to go now before we proceed and do anything we can preview this so i can go here and select the break and i can zoom in here and pay attention see it is breaking you see this is the animation you see it's fast when i simply hit the play button we will change the speed of this animation inside so if i go now so let me go here actually no we cannot do that because let me select the breakable platform yeah the idle one is the default one so let's set the default one the break one and if i go here we'll see you see how it is breaking so what i'm gonna do is let's set the speed of the break to 0.2 maybe point one yeah point one can do even point zero five yeah point zero five or point i don't know zero eight that's enough i think what we also need to do is double click on the break animation here the orange one now so double click on it uncheck the loop time so click here and uncheck the loop time now let me click on this again so the play button and yeah this is totally fine this is totally fine what i'm gonna do is i'm going to right click on the idle and set it back as a layer default stand which means the idle will be the animation the default one that's going to be played now this is for our platforms the breakable and the platform regular now we also have a spike platform so i'm going to simply drag and drop it here here it is and by the way let me just lower it here and i'm going to set the order in layer to one and this is what i was talking about did you see if i set the order in layer 0 pay attention how the spike platform will be rendered behind you see it's rendered behind this one if i set the order in layer to one now they are on the same order layer which means sometimes one element can be rendered first and sometimes another element can be rendered first but if i set it at two you see now the blue platform is behind the spike platform so this is that order and i have a separate tutorial for that anyways moving forward our spike platform set the scale 0.5.5 for x and y attach a box collider and this box collider is going to be a trigger and actually excuse me here it's a box collider 2d and let me check here if i attach a box collider 2d on these boat too yeah so it's a box collider 2d and check it to be a trigger and let me just go here in the game to see well we can resize it a little bit we don't want it to be like this you see because now this is circling or actually i don't know how you can say that this is a rectangle so it's rectangling this spike platform anyways we want to resize a little bit so on the x simply resize a little bit like this on the y just a little bit maybe like this yeah we are good to go now pay attention here we have the size x 2.4 and size y 0.61 this is for the size of the box collider again we are going to attach a component which is going to be a rigid body 2d and we are going to change the body type to kinematic from dynamic so voila we are good to go now this is for these platforms we also have the speed platform so simply what we are going to do is first of all go into animations and right click here folder and this is going to be our moving platform and what we're simply going to do is go here inside so sprites and platforms and speed platform this is the folder so go here and we have eight of these so select eight so select all of them select all of these eight and drag and drop them right here in the scene when you do that it will prompt this window for us to create an animation what i'm going to do is go in the animations folder moving platforms and simply here i'm going to say move and this is going to be that animation and voila and i'm going to name this one how am i going to name it speed platform or moving platform yeah speed platform and it's going to be speed platform left because we're also going to have a right one we will see in a moment how we're going to create that set the order in layer to one and if i run the game now we will see the animation so pay attention you see now voila this is the animation of the speed platform which will move our player to the left side now again we are going to also have a platform that's going to move him to the right side but first of all let me set the scale to 0.5.5 because we want it to be smaller let me attach a box collider 2d and make it a trigger actually no excuse me this one will not be a trigger only the spike platform others are not triggers they're going to be solid game objects so here add component a rigid body 2d make it kinematic and we are good to go so yeah this is for the platform now this is for the left one what i'm gonna do is duplicate it command d or shift or actually ctrl d on windows and you can also go here under edit and duplicate that also works so what i'm going to do is take the speed platform and change this from left to right and i'm going to move it up a little bit so here and simply here in the sprite component we have this flip you see we have the flip and what we can do is simply check the x for the flip and pay attention what's gonna happen to this one when i check the x bam you see now it is pointing to the right side and if i run the game we will see that one is playing the animation left you see and another one is playing the animation to the right side voila now that we have prepared all of our platforms i can go here in assets and right click and create in a folder and prefabs well name the folder prefabs and go here right click and create another folder this is going to be our platform prefabs and before we proceed to do anything i'm going to create a platform script so that we can attach it so we can attach the platform script and then we can save them as prefab so let's go here in the scripts and right click and folder and plot form scripts like this and right click here and see sharp script and this one's going to be the plot form script select all of them so all of them platform breakable platform so on and so forth and go at the bottom on add component and click there and search for platform script this way you will attach the script on every single one of these game objects so you see every single one of them has now a platform script and if you scroll you will see that all have a platform script so now let me just open the platform script here and add some variables that we will need for every platform so that we can check them and then we will be able to well continue with our game so what do we need well first of all we need a public float move underscore speed by default let's say it's equal to two we are also going to see here public float bound y which is going to be equal to six now what is this well because our platforms are going to move from down to bottom eventually they will get out of screen so if you see here if i take any platform if i take this one and i start moving it you see it's gonna move and eventually it's gonna go out of screen well when it gets to the point of six you see here so this is the six and i've measured this in the game while i was preparing it so i simply moved the platform and i said okay here the platform is out of screen it will not be visible visible it will not be visible when i deactivate it because what do i mean by this well i don't want the platform to get up to here it's still in our game and then i simply turn it off like this bam no we want the platform to let me go here we want the platform to move above here so it's out of sight and then we are going to deactivate it but for that we need to know where that bound is going to be and that bound is number six as you just saw me demonstrate that now here we are also going to have a public bull moving platform underscore left and you can assume that we are also going to have a moving platform right right and we're also going to have is breakable and we're also going to have is spike and we're also going to have is platform this is how we are going to determine which platform is using this script and now we're going to check these check boxes but before that let me simply also add here a private animator adam and then we can continue with everything so now before we save them as prefabs select every platform and denote which platform it is so if i go here this platform is a regular platform so we're going to check the checkbox is platform breakable platform is a breakable one so we're going to check is breakable for the checkbox the spike platform selected and we're going to check is spike for the speed platform left we're going to check moving platform left and actually we can rename that to speed but that's up to you anyways you get my point this is the left one and speed platform right check the checkbox for that one as well and voila now we have prepared our platforms and we can safely go now into the prefabs folder and drag and drop them one by one so this one and all of them make sure that you don't delete one of these that you didn't save as a prefab prior to this because if you do you will lose it then we will need to go again and add a component a box collider a rigid body a script an animator depending on which platform you deleted and now i can delete them because i have them as prefabs and we're only left with our regular platform and we can continue with the script so let's get back here in visual studio the first thing that we're going to do here in awake function so create awake function i'm going to test if is breakable which means if the platform holding this script is the breakable platform we are going to say anime is equal to get component animator we will deal with this later but i'm just going to put it here so that we don't forget it so what is the next thing to do well i can simply remove the start function we can leave only the update and we can create below uh function so void move not on animation move only move and in the update here i'm going to say move and what we're going to do here simply is we're going to move the platform we're going to say vector 2 is temp or well the name of that variable is equal to transform that position which is the current position of the platform then we're simply going to say temp dot y plus equals to the move speed multiply that with time dot delta time voila and below we are simply going to say transform position is equal to temporary position and since this is moving inside of the update we can go here and we can test it out and i'm going to show you what that bound means for us because if i go here in the in the scene you see now the platform is out of the view but it's still there and here we don't see it in the game but you see it's there it's up it's going so we need to add an extra line of code here we need to test if our temp so if our temp dot y is greater than or equal to the bound y so bound y like this then we're simply going to say game object set active is equal to false voila and we are good to go so now it will deactivate itself and we can test that out now so i can go here in unity and let me just take a look at the scene view so you will see now when it gets somewhere around here pay attention let me just switch to the scene view right away pay attention now bam it is deactivated so this is what we need so far this is what we need for our platform to make them move now later on when we add our player we will detect what we're gonna do with him but for now i'm gonna right click here in the hierarchy and i'm going to go and create an empty game object and i'm going to set x y and z to zero zero zero and this one is going to be our platform spawner i'm also going to go back in the scripts folder in platform scripts and right click here and create a c sharp script and this one's going to be platform script now actually excuse me no it's platform sponsor so i deleted this one right click again and go here and this one's going to be platform spawner so platform spawner now what are we going to do with this platform spawner well he is going to be responsible for spawning our platforms and we are simply going to reposition him somewhere around here let me just tag him so this is our platform spawner let's say at negative eight this is where his initial position is going to be and from within there we are going to spawn the platforms so let's attach this platform spawner script on him and of course we need variables to make this happen so let me just do my thing here and class give a little bit of space you know the drill don't even judge me don't even think about judging me so what we need well first of all here we're going to say public game object is going to be our plat form prefab this is the regular platform we are also going to have a public spike platform prefab we are also going to have a public game object array and this is going to be moving platforms like this in public game object breakable platform so breakable plat form now i can also omit here the underscore we have the platform spike moving platforms and breakable platform as you can assume what we're going to do with these is that we are going to spawn them now for that we need to to have a spawn timer so we're going to see here public float platform spawn timer so spawn timer is going to be equal to two apps every two seconds and we're also going to have here a private float so float current so current flat form spawn timer this one we are now going to declare and we are also going to have a private int plat form spawn count count and we also need to have a public float minimum underscore x which is going to be equal to and maximum underscore x which is gonna be equal to now what are they what are they going to be equal to well if i take now the platform this one right here and if i move it till to the bounds where it's well near the end but it's not outside so it's something like this here i think two so this is negative two this is where the minimum is going to be so negative two and maximum is going to be positive voila simple like that so if i go back here the minimum is going to be negative 2f and the maximum is going to be 2. so we are going to spawn them between these two bounds now inside of the start the first thing that we are going to do is we are going to set the current platform spawner timer or current platform spawn timer to be equal to platform so platform spawn timer why are we going to do it like this we will see in a second for that we need to create here a function so void spawn platform splat forms like this and in the update we are going to call this function so spawn platforms which is going to start spawning all the platforms now what we are going to do is the following we are going to see current platform spawn timer plus equals time dot delta time we did this in the various of my previous tutorials we did this in the first person shooter we did this in the beat em up game we did this in the 2d space shooter we are simply going to use this variable to denote when the value is larger so here we're going to test if our current so current platform spawn timer is greater or equal to the platform spawn timer so the current time if it's greater than this time and this time here we set it a two but it's a public variable we can also change it so if we think that we need to put a lower value i don't know something like let's say 1.8 for example so i can copy this and i can go here and select the platform spawner and you can put here 1.8 so that works as well and while we are here let me quickly go here in the prefabs and attach the prefabs so here platform prefab is the platform one the regular one spike here it is spike one this is for the moving so the size is going to be two we have the left here it is left we have the right here it is right and the breakable platform so here it is breakable platform make sure that you add all of these or it will not work if you don't do that now going back here we set the timer to 1.8 now and here we're setting the current platform spawn timer to be equal to that value which means as soon as we hit this in the update we are adding to this value time dot delta 10 which is a very small number but over time because it's called in the update which is called every frame which means 60 times in a second we are going to add this value and it will over time get to the point where it will have a greater value than this one when that happens we're going to spawn a platform so here spawn platform okay so what's gonna happen here first of all we are going to say our platform count or spawn count plus plus so we are going to increase it and we are going to do the following we are going to see here vector 3 temporary position is equal to transform that position and we are going to say temp dot x is going to be equal to a random arrange between minimum x and the maximum x voila so that is going to be the temporary or actually excuse me this is the x not the y so x will be between minimum x and the maximum x okay now below we are going to see game object and we're going to say new platform which by default is equal to null but now remove this animator what am i doing here but now we are going to test here so we are going to type here if our platform spawn count this one right here that we are incrementing if that value and let me just do it again platform spawn count if the value is lower than two we are going to do what we are going to say new platform so new platform is equal to instantiate and we're going to instantiate the platform prefab and we're going to use the temp as the position and we're going to use quaternion.identity for the rotation this is if the value is less or actually if it's less than two so that will be when the value is one and two because two is not less than two else if our platform so else if platform spawn count is equal to two so if it's equal to two we're going to randomize we're going to either spawn a spike or actually a moving platform so let me do do my thing here we're going to say if random dot y run if random.range between zero and two if it's greater than zero so if it is greater than zero we're again going to do this right here so we're simply going to spawn a new platform which is the regular platform else if that is not the case if random range here between zero and two is not greater than zero we're going to say new platform is equal to instantiate and here i'm going to use the moving platform so moving platforms and the element that's at the random range between zero and moving platforms dot length like this and we need to say comma and we need to say temp and we need to say quaternion identity so you see here what we're doing we are randomizing things based on the platform spawn count so we are incrementing it so we're incrementing its value and when that value is less than two we're going to spawn a regular platform so platform prefab when that value is equal to two we are going to randomize either we will spawn the regular platform or we will spawn a new platform which action new platform we will spawn a moving platform and we're using here random range between zero and moving platforms length to randomize that and again random range between zero and two will return zero and one it will not return two because if i hover over you will see that it will return an integer and when we use integers with a random range it will not include the last number so the last number is exclusive which means it can either return zero or one but if we use f so if we add here f and f that means it will either return zero one or two or any number in between so moving forward here we are going to test else if our current platform or platform spawn count is equal to number three now if it's equal to number three again we are going to randomize things so we're going to do exactly the same thing here but instead of spawning the moving platform so if the random range is greater than zero we will spawn the platform prefab the length the regular platform prefab if it is not then we are going to instantiate here and what i'm going to do is simply remove this we're going to instantiate the spike so if it's not then instantiate the spike platform prefab again this is randomized and again i'm going to copy these lines of code here so copy and simply paste them here again else if platform spawn count is equal to number four and here instead of spawning the spike we're going to spawn the breakable platform voila and at the end here for our platform spawn count number four this is really really really important to do we need to call this platform spawn count is equal to zero to reset it so that we can again go back through all this iteration if we don't do this right here if we don't reset it then we will have issues we will never go again through this iteration and probably will not i did not test it out but i believe that we will not spawn platforms anymore and at the end outside of all of these if else statements at the bottom we need to say new platform that transform that parent is equal to transform now i will demonstrate in a moment why we are going to do this but for now i'm going to comment this out and at the bottom as well we are going to say current platform spawn timer is equal to zero reset the timer you see here reset this timer because we are only going to allow it to spawn once then go again from zero and spawn again and go again from zero sun and so forth so let's go and take a look at what we have here so if i close the clear the console that is if i hit the play button we will see now that the platform spawner will start spawning so you see we have the platform now we have the speed platform you see now we have the platform breakable platform platform again so again platform clone we will have a spike eventually breakable so on and so forth now also you see that all of these are simply being spawned in the hierarchy and you see how the hierarchy can get messed up well for that we can do this we can simply go here and we can set the parent of the new platform transform parent is equal to the transform which is the transform of the platform spawner so pay attention now every new platform that's going to be spawned will be a child of the platform spawner so now our hierarchy will not get clustered it will not get you see now they are all under the platform spawner they're being spawned and you see now we have the spike we have a regular platform we have again a regular one now we have the moving one we have again the regular actually probably some of these are breakable i don't see so this one is the speed right so on and so forth so you see how we are randomizing and all these platforms are getting a chance to be spawned so we have the moving platforms we have the spike ones we have the breakable ones we have the regular ones of course the regular ones are being spawned the most because if we spawn all others then the player will have no chance if we go back here again and analyze the code what we're simply doing we're using this to control the spawning this right here is clear if not put a comment below this video and i will answer simple as that anyways anyways i'm using the platform spawn count to control the spawning you see plus plus which means incrementing it when that value for as long as that value is less than two we are going to spawn a regular platform when that value gets to be equal to two we are going to either spawn a regular platform or a moving platform when that value gets to three we will either spawn a regular platform or a spike platform you get the point so based on this increment and at the last increment here we need to set it equal to zero if we don't do that let's check it out i did not test it out but i believe it will stop spawning the platforms so let's see if that is the case so yeah we have one platform we have another platform three four platforms and let's see if we're going to yeah no you see here bam bam bam bam zero you see actually we get a null reference exception so yeah we get a null reference exception right here because we are using new platform parent and as you can see here we set it to be equal to null and we're not spawning any more platforms one way to fix this of course is to well uncomment this but when you have a null you see here when you have a null game object what you can do is you can do this you can say if new platform is not equal to null or simply if new platform and simply paste this here so if new platform meaning if it's not equal to null if we have a reference and if you don't know what a reference is if you don't know classes and objects you don't understand that concept i have a video for that i will put it in the link put it in the link put the link in the description below if you don't find the link please remind me it can happen that i forget to put it anyways you see when we don't reset the platform spawn count we did not get a chance to spawn new platforms and we got a no reference exception here because of that so we need to reset it back here to zero for this iteration again to work and go through all of these platforms now we tested it out so i'm not gonna test it out again you can do that on your own test it and if you have any issues post a comment below or better yet post a comment on my facebook group and i or somebody else there will respond okay now we can add the player in our game so for that i'm going gonna go into the project and sprites and voila here is our player here is the crazy dude here is the crazy cube here is the crazy well here is the player anyway it is i'm going to say 0.5.5 for x actually i think we need to resize the player a little bit more so let's go here at point three point three yeah point three will do now for the initial platform so the first one that is here i'm going to set that a negative four so let's take it here negative four negative four not four and here is going to be the initial platform now let me take the player he is at the middle we are going to attach a box collider 2d so not make it a trigger do not make the player a trigger we are also going to attach a rigid body 2d now we are going to leave a dynamic for the player now for the mass i'm going to set here zero but it cannot be zero it will be zero zero point zero point blah blah blah one for the gravity scale i'm going to set that at 3 and voila i'm not going to set the constraints because that is going to allow us to roll the player as you saw in the preview vdo and now we can first create the player movement so we can go in the assets and scripts and right click here go under folder and the player script and inside of this one i'm going to right click and create a new c sharp script and this one's going to be player movement okay so the player movement and attach it on the player so let's go here attach it on the player can add script now don't worry about this this is i don't know why because it probably did not get a chance to create i was so quick to attach the script that unity did not manage to create it before i tried to attach it anyways let me go here into the prefabs and quickly drag and drop the player in the prefabs and i'm going to open the script in visual studio and let's go here so what is the next thing to do so here i'm going to say class and hold enter to give a little bit of space so what do we need to move the player well simply we need private rigid body so private rigid body 2d which i'm going to call my body we are going to use the rigid body to move the player opposed to the platforms which we are using their transform to move them so this is another way to do it and we need a public float move speed which by default i'm going to say it's equal to one of course we set it to be public which means that we can change it i don't know if you want to change it to two you can change it in the inspector so don't worry about that so in the awake first of all change start to awake and inside of this one we are going to say my body is equal to get component rigid body 2d now when you have components like these rigid body or i don't know audio source or whatever make sure that every single time you use get component so don't forget to do that because you will get an old reference exception and if you have components in your script and you get an all reference exception if the error is pointing to some of the components so for example if i try to use rigid body like this so if i see here void move not on animation move or on animator move simply move and if i try to do something like my body dot velocity that blah blah blah and the air points here to this line that means you did not use get component to get a reference to the component okay what we're going to do in our move and by the way we're going to call the move in the fixed update not update but fixed update so change the update into fixed update and i know i said fixed update four times already anyways fixed update is used to move game objects with the rigid body if we were to use the transform like we're using here for our platforms then we would use the update which is a better or more suitable for that purpose but using the rigid body use the fixed update so what we're going to do here we're going to test if our input get axis raw so get axis raw and here we're going to say horizontal and if that value is greater than zero we are going to do what we are going to say my body velocity is equal to a new vector too and here we're going to say move speed for the x and my body velocity dot y for the y velocity and below i'm simply going to copy this line and here i'm going to test if it's lower than zero and here i'm going to say negative move speed again your assignment is to have a separate script which holds these variables like this horizontal you can call it from that i already did this in couple of my tutorials so now it's up to you to test your knowledge and see if you actually learn something even if you're paying attention to your teacher here okay pay attention okay anyways moving forward you're not being me enough being me enough about me being silly so the horizontal get axe is raw if we press the right arrow key or the d key this value will be greater than zero which means it will be equal to one if we press the left arrow key and we press the a key this value will be negative one which means lower than zero now i did this in numerous examples what you're going to do is use the print statement like this and you're going to print input get axis and horizontal and then start pressing these keys that i already said and then you will you will see the difference so here i'm going to say move before we proceed to test this out i'm also going to create here a public void platform move with the float x and here what i'm going to simply do is take all of this and i'm going to say my body velocity is equal to and here i'm going to pass x because we are going to use this one in our moving platforms so in our moving platforms we are going to use this one in order to in order to move the player so let's test it out to see if this actually works so let's go here and first of all clear the console i'm going to hit the play button so now the player will fall on the platform as you can see and yeah we can also go like this you see now when we fall on these so when we fall on that one it will supposed to be if it would move us and bam we died anyways this works now one thing that it does not work if i go here the bounds don't work so if i go outside of the bounce up it does not work so i'm up and i can go like this down and below well we need to detect that but also the bounds on the left and the right side don't work so let me try to do that let's hopefully one of these platforms will be closer to the left or right side so pay attention now i can go outside you see bam i went outside of the left side so for that we're gonna go here and in the scripts player scripts that is right click and create a new c sharp script and this one is going to be player bounds and we are going to attach it on the player so select the player game object drag and drop the player bounce and go here overrides and apply all let me double click this and open it in visual studio and let's go here quickly voila and below here let me just tag the class and give a little bit of space so what do we need for our bounds we need the bounds on the x and the y are actually on the x left and right so we're going to say public float minimum underscore x is going to be equal to negative 2.6 f don't ask me how i got this you already saw i just measured it's same as what i did with our platform so i took the player moved it to the left side saw the bounds and i simply took that value and voila for the maximum x it's going to be equal to 2.6 f and for the minimum y is going to be equal to negative 5.6 f what is the minimum y well the minimum y will determine how far can the player fall down here you see here below our camera below the platforms and when that value is hit then the player will simply die and we're going to remove this because we don't need it i am going to remove this comment as well and in the update we are going to call check bounce function that we still did not create so below we are going to say void check bounds and inside of this one we are simply going to say vector 2 temporary position is equal to transform that position and here we're going to test if our temp dot x is greater than the maximum x value then our temp x is going to be equal to the maximum value we're not going to allow it to go above you see what i'm doing here it means if our current value of the transform position x is greater than the maximum value then we are not going to allow it to go above that value so we are going to set it to be equal to that value so it will not allow it basically it is something like this let's see this is the maximum axle max x is this point right here if we try to go outside and we are here where i'm pointing with the x we will detect that by using this which means we will reset to here where this point is we will reset to this point not going outside of these bounds this is what i'm doing here and simply here i'm going to test if so if our temp x is lower than the minimum x then our temp x is equal to minimum x same principle is except for the minimum value same principle if we try to go below that value we will not allow it we will reset it back and here we're going to say if our temp dot y is less than or equal to the minimum y that means we fell down so we fell down and we are going to do what we are simply going to test if we are out of bounds and for that here above we are going to create a private bull which is going to be out of out of underscore downs so for that we need to test it so here i'm going to say if with an exclamation mark if we are not outside of bounds what is an exclamation mark doing here an exclamation mark used with a boolean will make the boolean the opposite which means if this out of bounds has a value of false this will make it true if it has a value of true this will make it false so it will make it the opposite so essentially here we are asking if we are not out of bounds when we reach this point then we are going to go out of bounds so we are going to say out of bounds is now true we are out of bounds and we are going to call our sound manager so soundmanager.instance.that sound we will create this later and also here we're going to call our game manager dot instance dot restart game and voila we are good to go basically this is for our players moving so we can go back here and let me hit the play button and now if i try to go out of bounds for example if i try to go here it well i we could not see that because the movement was slow and i could not get till the end or to the right side so let's try to do it here okay on the left side you see now i cannot go and actually what did we do let me go here where's my player where did the player go did we attach the script on the player so minimum x maximum x let me go here oh yeah yeah of course of course why why shouldn't i be stupid like that one thing that i did forget to do here is that we need to do this we need to say transform that position is equal to temp to reset these values back to our current position that's why our player went out of bounds anyways so let's test it out right now so let's go here and hit the play button so let's hopefully wait for one of these platforms to be closer to one of the edges okay let's try to go out of bounds you see now i cannot go out of bounds you saw well you saw i don't need to repeat that okay the next thing to do is finally detect what will happen when we start landing on the platform so we need to do that now we are going to do that for the player and we are going to do that as well for our well platforms so in order to do that first of all i'm going to create the top spikes let me just select the bg here it is and i'm going to do something like this i'm going to go and create an empty game object it's going to be our top spikes and here here here zero zero zero i'm also going to go under tags and add a tag so one is going to be a top spike tag so i believe this is the only one that we need we will see in a moment so simply add the top spike and select the top spikes and tag them with the top spike tag so now let's go here in our sprites and here is our spike here it is i'm going to put it here in our scene voila this is our spike let me set the order in layer 2 and set the spike as a child of the top spike and we need to move it here up so this is where we want to put it right here now i'm also going to duplicate it and move this one so let me move it like this and this one's going to be here why don't i see the arrows correctly apparently i zoomed in that let me just reset the layout so that i can actually see this and go back here so now i believe i can zoom however how much i want to zoom in i can see yeah that was unity lagging don't worry about that so let's duplicate it again and move it here hold the v key not the wb key and hold it you see now how this moves with the mouse and this i mean you see the arrows and the rectangles so selected hold the b key come on what am i doing here so it's spike two not important why is this not working okay okay now it's working so v key and you see how the arrows are moving depending on where my mouse is so i'm going to go here and snap it you see holding the v key will snap it right next to each other so again i'm going to duplicate it and the v key and snap it so come on why are you playing with me so wiki snap it duplicate it move it over here v key snap it and you get the drill this is what we need to do so simply move it and snap it so again let me select it correctly move it here and snap it again move it and snap it and one more move it and snap it now duplicate the duplicates so don't duplicate the original one only the duplicates and move them here and holding the v key i'm going to snap them and voila you see voila here are our top spikes of course it would not be smart or va or wise or however you want to call it to put a collider on every single one of these spikes instead what i'm going to do is take those top spikes game object and go here and add the box collider 2d this one is going to be a trigger and i'm going to resize it first of all on the y-axis something like this and on the x-axis something like this and voila so now when we collide with the player the player will be killed and let's let's let's program that so let's go here first of all in the platform script so for the platforms what do we need right here below our move we need a couple of more variables actually a couple of more functions the first one is going to be void breakable the deactivate so deactivate the breakable game object and simply here we're going to say invoke and we're going to invoke a function and that function's name is going to be void breakable or deactivate game object like this this is the name of the function and here we're simply going to say game object set active false and here we're going to call our sound manager dot instance dot ice break sound we will do this later don't worry but simply take the name of this function and put it here and we are going to invoke this after 0.3 seconds after 0.3 seconds we are going to invoke this okay this is for the breakable we will see we will add this by the way since we are already here let's quickly go in our breakable so go into the project and let me go into the prefabs and platform prefabs take the breakable open it and go in the animation and select the break animation and then go on the last frame add an animation event and go here and select breakable deactivate this is the one that we need to call and voila it will then deactivate the breakable after 0.3 of a second so simply go here click this button to add an animation and we did this numerators of time so i expect you to know this so what is the next thing to do the next thing is to create void on trigger enter 2d so in the on trigger enter 2d and i'm going to change the collision name to target we are going to test if our target.tag is equal to player so if we have collided with the player and immediately when you do something like this go here and make sure that the player is tagged with the player tag so select the player here it is player go here under tags and tag him with the player tag just so that we make sure and go here and override and apply all we need to make sure that this is the case or otherwise we will have problems so in our ontrigger enter what we're gonna do if we are colliding with the player and if is spike so if the game object that is holding the script is the spike game object we are simply going to do what we are going to say target dot game object or actually target transform position is equal to new vector 2 and i'm going to reset the player's position at 1 000 1000 so that i can remove it from the view then we are going to call our sound manager so sound manager instance dot game over sound and we are going to call our game manager dot instance dot restart game of course we still did not create this but this is what we are going to do what is the next thing that's going to happen right below we are also going to have on collision enter so on collision enter 2d what is the what is the reason what is the difference between on trigger enter 2d and on collision enter 2d when we go here for example for the top spikes we set the box collider to be a trigger if you pay attention here you see the is trigger checkbox is checked as you can see now when we check that checkbox for the trigger if we want to detect collision between two game objects we need to use on trigger enter on trigger enter this is what we need to use if we checked the checkbox for is trigger if we didn't check that check box so it's not checked and we want to check for collisions we will use on collision enter so here i'm also going to name collision to target and what i'm going to test here is if our target.gameobject tag is equal to player of course your assignment here is to put the player in a single script and then call it from that script and also use another way to compare game objects if you don't know you're not sure search online but this also works by the way so here if target game object tag is the player and if is breakable so that means we landed on the breakable game object or the breakable platform and the player is the one who landed we are simply going to call here our sound manager so sound manager instance dot land sound and below we are going to call our anim dot play to play the animation and the animation is break we will be able to see to hear this and i'm just going to copy this and below if is platform which means we only landed on the platform we are going to call this sound manager instance to play the land music voila this is what we need to do the before lasting so we will also have in our player bounce to the tech collision but here this is on collision enter and this one is on trigger enter so on trigger enter okay this is when we enter what we are going to do for the moving platforms because ontrigger enter and uncollision enter will not work there well for them we need to use on collision state and here we're going to see void on collision stay 2d you see here called once per frame for every collider rigid body 2d that is touching the rigid body 2d collider so it will call and here i'm also going to change to target so this is and here i'm going to say not class on collision state this is going to be called every single frame as long as the player is standing on the moving platforms and simply here i'm going to test if target game object tag is equal to the player which means the player landed on the moving the player landed on the moving platforms i'm going to test if the moving platform left then we're going to move the player to the left and we're simply going to say target game object get component and we're going to get the player movement and if you remember our platform platform move and here i'm going to say negative 1 f if you remember in our player movement i created this platform move i said we're going to use it for the moving platforms the reason for that is this one because now we're simply going to call here platform move passing the negative one and if we if we need to move to the right side so all right moving platform right we're going to call plus one of course you can create a separate variable holding this movement variable for the platform so that is up to your action that is your assignment not up to you that is your assignment you're not even asked here you need to do that or otherwise i i will i i don't know what i will do i cannot do anything okay i have so much fun creating these tutorials we can test this out but before we do that i'm gonna go here in our player bounce and below and this one is for the check about so check bounce instead of me creating a separate script detects to test collision with the top spikes i'm simply going to create here on trigger enter 2d and this one is going to be target and if so if target tag is equal to top spike did i did i tag it with the top spike or top spikes we need to test that out too we need to go back here and see select the top spike yeah top spike that is the name make sure that the names match or otherwise it will not work so if the target tag is equal to the top spike what we're going to do first of all we're going to say transform position is equal to new vector 2 for our player and we're going to set the player at 1000 1000 to move him away from the screen then we are going to call our sound manager instance dot death so death sound and our game manager instance dot a re start game voila this is all we need to do and uh basically we are done with this and we can test this out so i can go back here in unity and wait for unity to take mercy upon me and for unity to well compile all the scripts i can go here in console and clear everything i'm going to try first to land on the moving platform so that we can see what's going to happen so this is a regular platform i'm hoping this one is a regular one yeah a regular one and this one is alright and yeah we are gone we are dead and by the way let me go quickly here in our visual studio what did we do for our player bounds yes he here we are out of bounds it's true and we need to call this to restart the game so that's why nothing happened so let's go here again and uh let's try it out now so let's try to land okay here is the moving platform pay attention i'm not doing anything and it's moving me slowly to the right side you saw that you saw that i mean you're not blind you saw that let's try to land on a breakable platform so let's hope that somewhere here we have a breakable platform regular platform regular one come on do we have a breakable and this is a breakable you see bam and it break it broke you see and let's go here again what happened for the breakable platform well it happened that the animation was playing and when the animation hit the last frame so if i go here select the breakable and open it here we were playing the animation so in the break we played animation bam bam bam and when it reached here it simply called the animation event which called this breakable the activate function which is here here is breakable deactivate which invoked this one and it broke maybe we can set it at 0.5 so it does not break right away we can wait a moment or two now before we continue or actually well we're going to finish our game in two scripts so let's go here and we see that everything is working but we cannot test things like when we touch our top spikes i mean we can i can select the player and you will see that he will be positioned and one thousand one thousand for the position you see bam he's gone his position is one thousand one thousand but uh yeah that is that what we need to do is and the player will fall down soon you see and he fell down because well because anyways we need to restart the game when that happens first of all let me go here in the scenes and change this sample scene to gameplay scene and go here in files and build settings and we need to click this add open scenes which will add the current scene to the build you see now we have the scenes gameplay inside now we can use now we can deact or actually load that scene so let's go here in the scripts and i'm going to right click here and a folder and this is going to be helper scripts and we're going to have two helpers so first one is going to be game manager and another one is going to be sound manager and what i'm going to do is reset their positions to zero zero starting with the game manager so create a c-sharp script game manager this one is going to be very simple we're not going to complicate things we're simply going to restart the game so go here attach it and right click here and see sharp script sound manager and attach the sound manager on the sound manager game object so like this first of all open the game manager and as i said we're not going to complicate anything i'm going to say here class and why why i need to restart my visual studio i hate it when this happens man i really do i really do and uh this happens i'm assuming because i have probably in my google chrome 30 tabs opened i did not turn off my computer for i don't know how long and my unity has been running for some time as well so i'm assuming that is the case or unity has a bug hey i'm not perfect so yeah so what are we going to do in the game manager first of all we're going to say public game manager so public game manager instance like this in the awake function we are going to say if our instance is equal to null we're going to say here instance is equal to this and basically that is that we only need two more functions one is going to be public void restart game which is going to invoke a function and the function is going to be invoked is void restart after time and simply here we are going to say unity engine dot scene management dot scene manager dot load scene and we are going to load the game play scene simple as that so let's go here i'm going to simply call it actually no no we need to do this we need to say here invoke and passing the name which is the restart time and we can say two seconds now this will happen after we call our game manager and we are going to call our game manager after our player dies that is the only reason when our game manager is going to be called and when we are going to restart our game we can test it out right now but i would prefer that first we finish our sound manager script which is this one right here and with it we will be done so let's go here and let me just go and hit the class or tag the class and the principle is going to be the same we are first going to create a public static sound manager instance if you're not familiar what an instance is i did not set that here explain it i have a video 30 minute video explaining what is an instance what are singletons i will put the link in the description below if i don't please remind me it can happen that i will forget so here i'm going to say awake and the reason why i will forget is because i'm not going to publish this tutorial today i will publish this tutorial probably 10 or 15 days after the recording that's why so we're going to see here if instance is equal to null meaning it does not have a reference we're going to say instance is equal to this pointing to this class or this is the reference now below we are going to have a private or actually above excuse me we are going to have a private audio source which is going to be our sound fx and for the sound fx we are going to have here serialize fields private audio clips and also our sound effects is also going to be a serialized field so these clips are going to be the land clip we are also going to have the depth clip like this we're also going to have the ice break clip and the game over clip voila simple as that now in order to play all of these we need to create public functions so here we're going to say public void the first one is going to be land sound and simply what we're going to do is we're going to call soundfx.clip is going to be equal to land clip and sound fx dot play simple as that nothing else now i can copy these lines and we're going to create a public public void and this one is going to be ice break sound for the ice break sound we're simply going to say here ice break clip and voila call then play and we're good to go then we're going to have a public void death sound and you can assume where this is going we're going to see here that clip and voila and the last thing is our public void game over sound so game over sound like this paste this here and here i'm going to say game over clip in the play and voila we are good to go before we test this out we do need to go here in unity select the sound manager and we are going to have an audio source component this one is going to be for the background music so we are going to make sure display on awake is turned on and loop is turned on and for the clip i'm going to click here so let's go here you see where we need to add an audio clip i'm going to click on this little circle and filter for the clips so i'm going to click on the circle and we're going to filter for the bg music here it is and i'm also going to set the volume for the bg music to 0.2 because i want these other sound effects such as landing and game over and that sound i want that to be heard so that's why i'm putting the background music to 0.2 this is for the bg music now here i'm going to have another audio source and we're going to turn off this play on awake and we're going to drag and drop that audio source here in the sound effects so drag and drop the second not the first one not this one holding the bg music not the folded one this one that's not folded drag and drop it here and yes we can drag and drop components in scripts that can work as well because we have two audio sources attached on this game object if we use get component here we don't know which one will be returned so we can return the bg sound and then we will stop playing the bg music and here let's filter for these land that ice breaking game over clip so here i'm going to filter for the land here it is this one is the dead clip so let's find it here that this one is the ice break here it is and the last one is the game over so click on this one game over here it is game over so make sure that you attach all of these to the appropriate slots again you see here sounds you also have a readme file make sure that you read it for the sounds so here you see bg music we have the death over son so we have the star as well but i'm not going to do that that's your assignment and with this we are done programming everything what we need to do is simply go here player bounce we need to turn this off you see or actually uncomment this so instance what did i game manager instance public static game manager instance this is what we need to do so public static game manager instance so now i can call it here see simply uncomment everywhere where we comment these lines of code uncomment them also here for our platformer scripts uncommented here and here i don't think we don't have anywhere else and here and here and voila and also i think for the player bounce yeah we did that yeah everything is okay literally we are done this is our game so let's try it out so if i go here we will now hear the player sounds every time we hit a spike or fall out of bounds we will restart the game so let's hit that play button and see that in action you hear the sound and do you hear when we fall on a platform yes you do for the spike or actually for the moving platform i remove the fall down sound so let's go again and game over and now we're going to restart you see and by the way i think this is too much for the breakable platform where it is where is it platform script where is the breakable i think this is too much maybe 35 or i don't know 0.35 this is okay this is okay so let's go back and again i'm going to turn off turn off run the the game so make sure that we listen to these sound effects when we fall on a platform when the platform breaks and uh also when we go out of bounds and when we restart the game maybe i should go in the sound manager and for the audio source for the bg music set it at 0.1 so that we can hear it even louder or actually don't hear the bg music louder but hear the effects louder this is what i meant so let's go here and hit the play button so you heard that so pay attention you hear that and let's try to die and bam we did we did we did okay so let's go here again and on the moving platforms i did not put that and you see it's moving us and bam we died and the game is restarting again over and over again until we quit playing it so let's go here and let's try to land here and bam we fell down you see and bam you see again we are restarting the game so it's an endless game let's try to go here and we cannot so uh congratulations to getting till the end i still have a star if we go here in the sprites you will see and assets and sprites you see that we have a star and what you can do is and this is your assignment you can add the star make it a collectible item and pick it up in the game and you can also make a score out of the stars so this is your assignment for the game so that you can practice i have plenty tutorials showing you how to add collectable items on and so forth so this one is up to you congratulations to again until the end this is a small hyper casual games games it's a plural nah it's actually a singular not a plural it's a small hyper-casual game congratulations to finishing this game even though it looks small we had a lot of things to think about how can we spawn these platforms how can we code this so on and so forth anyways download this tutorial link is in the description below the project the complete project and finished project and the tutorial assets link is in the description below and uh here here again thank you for watching i will see you guys in another video
Original Description
In this full Unity tutorial, you will learn to create a simple 2d Hyper Casual game using Unity and C#. You will learn tips and tricks on how to work with Unity to achieve the best results in the simplest way possible.
🔗Game Assets: https://github.com/AwesomeTuts/cube-fall-hyper-casual-game
Tutorial created by Awesome Tuts. Check out Awesome Tuts Youtube channel: https://www.youtube.com/channel/UC5c-DuzPdH9iaWYdI0v0uzw
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://medium.freecodecamp.org
❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
Dates - Beau teaches JavaScript
freeCodeCamp.org
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
The Definition of Ready - Agile Software Development
freeCodeCamp.org
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
Working Agreement - Agile Software Development
freeCodeCamp.org
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
Definition of Done - Agile Software Development
freeCodeCamp.org
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
The INVEST approach to product backlog items
freeCodeCamp.org
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org
More on: CV Basics
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
How to prepare TIC teacher exams in Spain with AI (oposiciones 2026)
Dev.to AI
Why I built a simple AI provider wrapper (and you might too)
Dev.to · zhongqiyue
This ChatGPT Prompt Replaced 3 Hours of PowerPoint Work
Medium · AI
This ChatGPT Prompt Replaced 3 Hours of PowerPoint Work
Medium · ChatGPT
🎓
Tutor Explanation
DeepCamp AI