Made a Mario Party / Pummel Party game in Unity3D

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right hello out there everybody just ready to get started um i think everything is working good and sounding good so it should be a fun stream today uh the plan is to build out sort of a mario party clone or at least one of the mini games from that i wanted to use the mouse that you probably saw in the thumbnail and make them do some drop kicks and maybe make like a four player version where the people can run around and just knock each other off of platforms seems like a good starting point and kind of the the place that i would maybe begin making a little party platformer type game so this is one of the simple mechanics or one of the mini games that you would see in those so we'll go through the process um from scratch just you know create a new project i've got actually a completely empty project here in the latest unity version um we'll bring in some art or maybe make a little bit of placeholder art and bring in some real art set up all the systems and then we'll go through with chat and stuff and see if anybody's got other suggestions things that we can add to it and at the end what i'd like to do is get it running on the arcade cabinet that you probably saw in the thumbnail that i can go up there and battle the wife and kids and whoever else and then share this thing so other people can do that as well all right i'm gonna hit mute on my setup so i don't hear any random windows beeps and then we'll get going with um building out this project but i just wanted to say thanks everybody for coming in and joining and uh watching live everybody that's here and um don't forget to hit the like subscribe and share and all that stuff before we get going and as we go along if you find that you like it you know when we're building stuff just hit the buttons all right so let's get going with um well switching over to desktop mode first and um i think one of the things i wanted to do today was actually show a little bit of project planning and management of a project so that we're not just coding with no idea of what we're gonna do but set up something that's easy to use and kind of build out a little plan and then track our progress along the way as we do it so we're going to start with packing plan i'm going to open it up and then i'll drag it over here i've already created an empty project on here and really not put anything into it if you haven't used hack and plan it's just a free trello board style app it's built for game development and has some cool game devi stuff in it but i've been playing with it recently and seemed to really like it so i figured i would use it in the stream all right so there we go here's the hack and plan thing um i've got my sprint right here i've got my dashboard set up with there's really nothing on it's just a basic dashboard that keeps track of all of the things that we want to do today there's nothing on it yet so we're going to go through the process of adding some things and then knocking out those let's go to boards go to the sprint here and um well i've already created the stream and i promoted the stream so i'll move that over to complete this by the way is one of the things i like about the hack and plan thing is i can just put in the amount of time that it took and it automatically converts it into minutes so i have it set as hours so i put 0.5 and bam i got 30 minutes all right sorry to take a breath there let me take a drink and then let's come up with a couple of things that we need to do for our first steps to build out the game we'll go through knocking out those steps and then we'll come back and keep updating this as we go all oh right can't see the um oh there we go there's a chat lots lots of questions here so i'll go over questions and stuff in a little bit too by the way if anybody's got stuff that they want to ask all right let's start with our first uh first planned thing so the first thing that i want to do is probably just create a simple little environment with a character that moved so i'll create an environment and it's going to be really simple so that'll be a quick one the category for that is art which i'm great at just kidding it'll be some terrible code or art but that's fine um the other thing i want to do is get a character in there so i want to add in like um a working mouse character so get a um animated mouse character create a create animated mouse character i'll just create the first one and that's also kind of art yeah well it's a little bit of rdn programming and then um i want to make the player move so add player movement and that will definitely be code i'll put that in the programming section and hit create the first thing i wanted to hit was creating an environment so i'll just drag it over to in progress i'll move this out of the way jump over to unity and let's create an environment right now i'm in 2d mode so i'll switch over to 3d in the scene view uh this is just the completely empty project i'm in what is it 2020.2 0.0 so it's probably going to be a little bit weird and buggy if it runs into too many problems we can always switch back to 2020.1 this is the first version of 2020.2 so who knows how stable it'll be all right let's go in and create an environment i think i want to do that with um well at first i was thinking maybe just like a little cylinder actually yeah let's just do that before i was thinking maybe i'd use pro builder and build out like a um a world around there or something but i want to keep it simple to start and then we can expand on it so we'll just go to game object go to 3d object and make a cylinder uh make sure the position is all set to zero and then set the scale like point one on the x and point oh no sorry not point one i wanna go to like a five on the x and a five on the z like a point one on the y actually maybe i'll leave the y at about one and then crank this up even more let's go to like 15 by 15. so it's a nice big kind of circle or circle-ish type object if i was in pro builder i'd be able to make this a little bit cooler but um i think this will work as a shape now i can't really see it because it's a lit and there was no texture on it so just turn off lighting and now i can at least see my object here all right so this will be my simple very ugly basic world and i think that's good to start though and then like i said we'll just build on top of it i don't want a capsule collider though i want to add a mesh glider instead because i want the collider to actually match up with the object and i got to check convex otherwise it was going to be this big collider and my character would just roll off of it but really i just want this little cylinder that's like a platform that i can knock players off of to begin with all right and i'll just call this uh platform save off my scene and then let's go over to our planning and bam our environment's done and that took us like whatever a couple minutes six minutes there point one now i'm gonna move on to creating the animated mouse character this is gonna take a little bit longer this isn't a six minute little task or whatever it is for that what i want to do is jump over to mixamo so if you haven't used this site before i highly recommend you check it out they've got a bunch of free characters um and a ton of free animations you can just upload your characters there and grab animations and start targeting your animations at it when i was looking through earlier though i saw some of the characters here there's um you can pick these peasants or random people that are more modern or there's like ninjas for different types of games whatever kind of game you want to build there's something that at least will probably work as a placeholder i wanted to build this weird goofy thing with a mice kicking each other off and maybe big headed characters so they've got this one mouse here mousey and then they've got this doozy one down here so i figured i would just use both of those and then um but see what we can build so i'm going to use this mousy dude and what i want to do first is add some animations to them so once you've picked the character here you just click on them and you hit use character that's what i did when i selected this guy go over to the animations tab and start searching for animations now you can click right here and just kind of filter down but i already kind of know the ones that i wanted i really liked the drop kick if i just search for drop oh i think space search for drop and kick this one just kind of made me laugh because it was a mouse i figured this would be like his spin attack but i want to overdrive it so that it goes really fast the overdrive just kind of speeds him up you can also adjust the arm space here like how how much they move their arms in and out and stuff or how far away they are you have play with it and see how it looks on the different characters and animations but something like this where he just does like a quick little jump spin kick seems good i'm going to download that and i'll download it as an fbx for unity this menu keeps changing by the way fbx for unity seems like the right option though so i'll hit download and i should just get a new file that's got my character and the kick in it um i'm gonna save this off into a folder let me find the right folder let's find our project folder here i'll right click in here hit show in folder or show an explorer and i'm gonna go into the assets folder here and there hopefully you can see that and make sure that that's on screen all right cool we've got our assets folder here and what i want to do is go into here and just create an art folder i guess let me make an art folder and then i'll make a character subfolder or let's just make this mousy folder and then i'll put the files into here so i'm going to copy this folder location go back over to the save as dialog paste it right up there and then hit save and then i'll get the file just drop right into the folder the folders created and i've got the little character here and i could just drop him right out in here and i assume if i hit play he's probably just going to play the animation maybe just once let's see oh no so my unity editor is acting weird that's because it's um it's playing over here interesting i'm gonna switch this project to unity 20 20.1 so i'm going to hit save scene we'll close out unity and we'll just switch unity versions real quick let's just do that i'm going to open up the hub let me switch over here and just talk about this for a second so one of the things that i was a little bit worried about when i started was that i was kicking off with a really really new version of unity and it was going to act weird and ever since i switched to this really widescreen monitor i've noticed that with new unity versions sometimes i get like two unity windows that pop up and the game view will render in one and the scene view and everything else will render in the other and that seems to be what happened here now i'm just re-importing it um i just reopened it in 2020.1.16 i think it was so slightly not the newest 2020.1 but a newer one and i'm just going to let the project reopen and re-import in there and then we'll uh just just get right back into it and start adding in the um the rest of the character stuff in fact you know what let's go back over to mixamo real quick and start setting up the other character animation stuff because there's no reason to need unity for that i can let it import while that happens so the other thing i wanted other than just a drop kick is some basic locomotion i would be able to run around i got like started on the thumbnail the little joysticks got eight directions so i want to be able to move in all eight directions on the screen so if i search for a locomotion i mean you can like you could scroll through these there are how many are there i don't know 52 pages of things i think there are like a couple thousand animations but if i search for locomotion then i should be able to find some locomotion packs and i can just click on one of these like this basic locomotion pack will probably work let's see and then there's a button where is it the one that follows the character i think this one right here toggle follow camera so just follow him around and i can just kind of watch him well that's not a great idol there let's see what else he's got okay so the run's okay yeah okay this all feel a little bit too tight there so i'm i think i'm going to grab the locomotion pack and then i'm going to grab a separate item actually let's try this male locomotion pack real quick maybe this one will fit a little bit better and just kind of stretch out his arms the concern is just that his arms are a little bit into his body and clippy very very in the body let's see is there anything else where it's like a more of a monster locomotion i'm not seeing it oh here let's just give him i'm gonna find a walk instead because i i want him to look decent so i want him to walk forward um or maybe like a run forward actually find a good running forward animation um that looks very strange let's put his arms out um i think that looks weird so i'm gonna use that this would be his running animation just make him run with his hands out and then make him jump kick whenever he gets around people i think that'll work that would be fun oh hey there's a super chat thank you sorry they're kind of off the screen so i didn't hopefully i didn't miss anything else um anyway let's grab this uh this guy running i'll use this and then the drop kick and then maybe work on some more animations later i think that's a good setup so here we go we'll download him again with the skin and then i also just want to go download the character after that so i'm going to download save it into that same folder just like i did before it'll go into characters i'm going to clear out that filter and let's go find that mousy dude click on them again and hit use character and i believe there's not an option to just grab them without an animation oh you know what i'll just search for a t-pose here there we go click on t-pose and then download him in a t-pose so there we go fbx for unity still and grab them with the skin all right let's save that off and i've got the t-pose version the drop kick and the running so i've got the character there as the base one that'll be the t-pose got the run for when he's moving and then the drop kick for when we wanted to attack and knock the other players off all right let's jump back over to unity it should be done importing it looks like it is if there was an error there i assume that's probably just going to go away hopefully if not then um here's what i'll do i'm going to just recreate the project and grab these files and i think it might have been the downgrading of the project that caused the issue let's see a downgrading from 2020.2 to 2020.1 does not seem to have worked right let's just make a new project so just go over here we'll hit new make it in 2020.1 and we'll call it arcade2 and we'll just grab the files over here all i've done so far is make a cylinder and pull in some art of this mouse so pretty easy to just recreate a new project and not deal with the headache of trying to fix the uh downgrading like i said probably shouldn't have tried a newer version of unity or the newest latest version i think that's an important lesson by the way for anybody watching um if you are starting a new project and it's something that you actually plan on working on for more than a day or two and you want to keep around unless you really need a feature of the latest version i'd always kind of stay with something that's a little bit stable i mean i wouldn't say like don't use new versions i use new stuff all the time but maybe don't use the one that's only a week or two weeks old make sure that it's got a little bit of stability before you decide to just dive in and dedicate yourself to it that's what i should have done here but hey i wanted to try out the new one because it does have some neat new ux stuff in there that i thought would be fun to show off but not if it's going to cause problems all right so let's go back into unity and get my files actually you know what i've got the folder right here in my mousey folder i'm just going to copy that folder right into my new project so i've got my new project i'll right click create an art folder and i'll take the mousy one right out of my other art folder and just drop it right on top of there and that's just gonna make a copy of it it won't actually move it out of that project it'll just copy them into here and now i've got these files or this folder here it messes up the folder name and i don't know why it always puts an underscore not always a lot of time puts an underscore when i do that i just fix it and now it says mousey all right now i've got my models here and i need to recreate our environment all right let's go through that hard process of recreating the environment we'll go to game object free the object and make a cylinder and then we'll set the height down or then we'll leave the height and that's right crank up the scale on x and y to 15. remove the capsule collider and add a mesh collider check the convex box and now we've got a nice little platform that our guys can knock each other off of i can uncheck the mesh renderer and see my little collider there all right so let's set up a character now let's find our mouse and we've got our three different files here the t-pose one is the one that i wanted why don't i have the um materials guy that's interesting um let's go back over to here real quick and see if we can grab it interesting i haven't tried that out um how do i just download character with skin should have the files in it let me see maybe i need to download um one of the other files maybe the fbx doesn't have materials in it let's just take a quick check or it doesn't have the textures in it interesting it doesn't seem to have them all right i'm gonna watch chat by the way in case anybody's got any um suggestions or ideas or see something that i missed in there um let's see where's my project and where's my download oh there it is okay so this is gonna be my mouse fbx i want to see if this one comes with the textures if not then hey we may just be using a textureless mouse for a minute i don't know and unless anybody happens to know what what the issue is there by the way um let's see what's going on in chat um still working on pantheon i'm not lately no i've been busy with other stuff so i haven't seen oh that's right i have to extract materials thank you that's right so go to materials and hit extract materials totally forgot spacing out with all this just talking and extract textures and there we go thank you thank you thank you i say easy to forget this stuff um no matter how long you've been doing it all right so i got my material here well set the material up right there and then we're gonna expand it out by the way for anybody that didn't see that let me go back there because i i said it and i kind of went really quickly through it just select the the object or the um the mesh here and then you go to the materials tab and hit the extract materials button here and then the extract textures will also pop out that the textures there so we can get the textures and the materials there it's been so long since i worked with the file where they were baked in that totally spaced and forgot about it so let's see we've got our mouse set up here he now has the material on them i'm going to go select them and you can see the materials on them right there and it's the one that we've extracted and it doesn't have any textures assigned but i've extracted the texture so we'll go drop those on it the first one here let's switch to a list view so you can see the names the diffused one just goes right here into the albedo and then the normal is going to go to the normal and it's always going to give me this little box where i gotta hit fix now to fix the normal map and then let's see specular and glossiness i don't think i'm gonna set these up yet i'm just gonna leave them alone and we're just gonna make this character run around like this i because i think i might just make him unlit or may even switch to urp i'm not completely sure i'm gonna get him in here and running so we've got him in here and he doesn't have any animations on him yet right so look at him if i hit play actually let's go find our camera find the camera you can see the camera's got a really weird view i'm going to set it up so our camera has a view of the field real quick and then we'll hit play and watch what happens come back out here maybe right about this position so by the way hold down the right mouse and wasd to move you can use the if you're holding right mouse button you can look around with the mouse and then wasd to move like an fps and shift the sprint to get into position and with the camera selected hit ctrl shift f over the scene view and you see that it moves the camera just exactly where i was in my rotation save it off hit play i expected i just see my mouse sitting there not doing anything all right let's make this little dude animate so to make him animate we gotta go add an animator to him and set that animator up um one thing we could do though is just take his running one and drop it out there and see that he's gonna i think just have this automatically added i didn't interesting i would have expected he was gonna have that on there okay that's fine let's go add an animator so add an animator and then we need to oh set up an avatar for him too so let's go set up the mouse's avatar so go select the t-po actually i'm gonna select the the running dude i'm going to make this my base one and i'm going to use this as like my my starting point instead of this t-pose one i'll take the running dude drop them out here let's go just assign the material to them so expand them out select there hit the search box or not not on the mesh on the materials that is on screen right yep search there and then we'll go over here and select the one that has the materials on it now i've got the i don't know why i wanted to pick that one i just figured i'll probably end up getting rid of that t-pose one all right now i'm going to go over to the rig and we'll set him over to be a humanoid and hit apply go to the animation window and drag this up a bit so we can see more and hit play and just preview the animation yeah that's right i forgot i picked that weird creepy him walking forward with his hands out animation so the first thing i want to do is fix the offset because he's kind of walking off to the side see when he's when he walks what i want him to do is kind of walk straight along that white line or one of those white lines on the grid that he's not filthy he's just like a little bit off to the side so i can do that just by going into the where is it root transform rotation right here the offset and just tilting this a little bit until he's going straight and not curving oh that's the wrong way i got to go negative it looks like and it doesn't look like it's very much i mean it's so small that maybe it's not even worth doing oh i gotta hit bake you know actually i'm going to leave it alone because i after looking at like the curve there i don't think we're going to notice it running around i do however want to make sure that we're looping so that the animation just loops when we play it we constantly see our character running so let's go over to our character now and add the animation to his animator so he does have an animator but he doesn't have an animator controller we need to create one we'll go right click create and add an animator controller we'll call it mouse and then we'll select the mouse again assign the animator controller to his controller field and then double click on it i can also just double click down here by the way and it brings up the little field or the area or what i forget with the name of the it's the spot where we set up our animations for characters so what we need to do is just drag in our first animation which will be the running one expand it out here i'll take the running animation drop it out there it'll become the default that's why it's orange and zoom in with the mouse wheel by the way so become orange and have that line right there that it enters goes right into running and starts running immediately that's the only animation so it'll just keep playing that forever play and make sure that it works yep there we go so now our character is running andy is moving forward by the way he's using root motion to move himself forward the way that that works is right here on the character there's an apply root motion option and because that that's checked and the animation is set up to know how to move a character you know how much the character has moved when the character's actually doing the animation uh it'll work and just move him let's here let's watch it again we'll hit play go to the scene view real quick and take a quick peek you can see that it just kind of moves and it lines up his feet and everything kind of moves the character nice and smoothly which is pretty cool if you want to move at the animation speed so one of our options i guess would be to just like keep it moving at the speed of the animation um and use the root motion stuff for controlling um at least for for forward movement that might be fun um i don't know think about it for a second um yeah maybe i'll do that i don't know so anyway we've got the character set up and ready to move at least so if we wanted to make him move with root motion all we really need to do is well i guess we'll need to grab an idle first and then make it so that he can stand still and then that he moves forward by aiming towards the direction and just triggering the walk so yeah why not let's do it let's do some root motion animation let's get an idol for this guy first of all we're back on mixamo this is just that free mouse mousey and we'll just grab an idle animation for him um something that fits with his hands ah that looks good he looks angry and ready to battle download that fbx4 unity is the right option with skin is fine and download again save that into that art folder and let's get going all right saved and oh it's mousey mousey art folder that should appear here i saved it into the wrong one i want to save it into this one i saved it into my first version of the project where um i just recreated it because it was in two new of the unity version so i'm gonna copy this path go back here i'm gonna hit download again i could just copy it over there but that's me dragging a bunch of windows around and that's less exciting for everybody than me just downloading the file one more time and pasting in the path i think i don't know probably about as exciting right so paste in that path and save it in it'll also save me next time when i when i download the file all right so we've got our idle in here and i want to set this thing up to work on my character so i got to do two things first i need to go to the rig and i need to switch this over to humanoid and change this to copy from other avatar then i'll hit the search box and i should have this one avatar this is the humanoid avatar that i created from that running model so just double click on it and hit apply now i can map this animation right to that character nice and easy in fact if i hit play you'll see it let's see does it play there what is he doing okay let's hit apply and play oh my what i i don't know what this guy's doing let's try switching this back to generic and see if he plays interesting that animation was playing right here what did i mess up here let's see let's go check it out um let's say create from this model maybe the oh yeah that's my fault okay i i i it's because i the side effect of me downloading mixamo models and not thinking about normally what i do is i'll upload a single character that'll be my source let me go to a miximo and show so normally what i do is i'll drag a character upload it and that will be my main character the one that i'm using here um in this case that's not really the way that it's gonna work because um i'm downloading all these different ones off of this character now why it doesn't map to this exact same character i'm not completely sure but um i think that my workflow change here has caused the issue so let's just um leave this on humanoid and let it create its own real quick and then we'll um that's gonna be an issue i think what i need to do is maybe take my t-pose version of him upload it and then target the two animations on let's let's try that and see if that fixes it so i'll go into mixamo i'll take my t-pose one i'm just gonna see if this kind of solves the problem here i don't want to spend too much time debugging this guy um i really want to get on to writing some code and making making the gameplay stuff work but i got to get this guy actually animating and looking right first because having characters that look weird and crappy it's no fun all right should be done any second come on process that character follow process if it'll process i guess we'll see if it can process its own character i don't know let that keep going so let me double check that i didn't miss something to you while i was in here is it it's very possible that everything is fine and i'm just spacing out and missing something too so go back to animations what what the heck happened to my what did i do okay rig idle humanoid copy i just want to double check that it doesn't work here i'm not crazy and why don't i see my animations now oh import animation was off i don't know how i unchecked that all right let's let's hit play let's see all right now it's working see yeah i must have missed something so i copied it from the other avatar and somebody said it in in chat too i think i must have just messed up and i hit the wrong button or something more i spaced out so here's the idle one this is the way that it's supposed to work and what i was expecting to work so we copied from other avatar and i copied from my running avatar from that one that i had set up and then go to the animation and then i see my animation here looping and idling perfect all right let's get back back into things because stuff started magically working again all right so what i want to do now is add my idle animation to the animator remember on this character we have the animator and the animator's got a controller on him let's go find that character right here we're gonna add the idle animation to his controller so double click on the controller find the idle here and just expand it out when you expand it out you can see the animation and i'll drag it on here and now it's one of my possible animation states right click on it and i will make it the new default and then what i want to do is make an animation transition between idle and running if i'm in run mode or if i'm in walk or whatever the mode is or if i have a speed greater than some value i'm just going to stick with a simple run for now so we'll add a new parameter go to parameters field add a bool and name it run and we'll make a transition from idle to running and then a transition from running back to idle click on the transition into running right there that's blue and highlighted because i've selected it it'll add a condition or run equals true so whenever run is true we'll go from idle into running and we will not use has exit time so that just does a quick transition instead of playing through the entire idol if you leave that checked what will happen is the entire idle animation will play then it will start running sometimes you want that but if your character is like hitting to the right and then trying to stop and run then hey it sucks oh hey thanks for the super task guys that's awesome thank you very much everybody really appreciate it all right um let's let's do the transition back from running to idle so check on the transition here from running to idle we hit plus and we'll change the condition here from run equals true to run equals false now just go back and forth between those two let's move the animator down here to the project view and we'll hit play and let's see what happens good play and he's just sitting there idle but i've got the parameter right here and if i check it oh wait can you see that or is it yeah it's not under me it's okay i'll hit hit run and it'll do the transition into running mode and i hit uncheck run and it'll switch back notice how it finished a run though right after i unchecked it that's because has exit time is checked here if i uncheck that one now hit run and stop it'll stop instantly cool so now i can run and kind of go off the edge of the map looking good so far i just need to make it so that it's now controlled by the player instead of by well any animation just pushing us off the edge so let's write some code who's ready to write code if you're ready to write code hit the like button thumbs up and all that and subscribe and we'll uh start writing some code all right we'll create a scripts folder we're going to right click create and folder and call this scripts and then we're going to go in there and just create a player script create a c-sharp script and name it player with capital p i'm going to assign it to my player before i actually open it up and start editing it first though i'm going to rename this from ch14 non-pbr at running to mousey because that was the character's name and i think that it's a little bit easier to manage and then i'll take the player script and attach it to him save that off ctrl s and double click on the player script open that sucker up all right there we go so we've got visual studio open here and i've got my player script which is a mono behavior and all of the default stuff that you get with a player script or with any script that you create in unity zoom this in a bit make sure that everybody can still see everything and then get to writing some code first i'm going to get rid of these two unused using statements with shift delete chip delete clear those out i don't need them yet so no need to have them in there cluttering up the screen space and then let's start writing some code i don't have anything i want to do in start so i'm just going to delete that right now and i know that update's called once per frame so i'm just going to keep hitting shift delete and clearing things up until i'm down to just an update now in the update i just want to start by aiming my character in the direction that i'm pressing i've got um trust the old playstation controller and keyboard here ready to go so i figured i'll just make character aim in the direction that i'm pressing and then we'll make him walk next and then we'll get to punching each other and knocking each other off the edges so let's start with um just aiming in the direction that we're pressing so we need to read the input here so we need to read horizontal and vertical we'll start with just the default horizontal vertical and then kind of expand out to multiple players for it and then turn our character in that direction so say um bar horizontal equals input dot get axis horizontal and copy that line and do the same for vertical copy that and paste there and there we've got our horizontal and vertical inputs just coming in from the input system by the way a lot of people always ask like do you are using the new input system are you going to do the new empty system not for this video and probably not for most videos just because there's still too much setup involved right now and getting it working getting it right and too much explanation that i have to do to really cover it it's not really worth it and the benefits there just don't make sense for something like this building something's cross-platform has a lot of input and customization and stuff lots of options out there and that's a good one but for this it doesn't make sense just overkill and it would be a big distraction away from what we wanted to do now we want to um well i guess just aim in that direction so we need to come up with a vector that's on the x and z axis um for our direction it's not going up but it's going left right back and forward so say vector 3 direction equals up new vector 3 and we use horizontal here and then we use zero for our y and then vertical here for our z i think that makes sense and we'll want to normalize it so just say direction dot normalize and that just turns it um well it makes it so that it's always the same distance it's always just a direction and not a direction plus distance um it removes the magnitude and makes the magnitude of a vector always equal to 1. it's a little bit complex to dive into i don't want to get into the specifics but it basically turns it into a direction that uh doesn't have extra movement on the horizontal so what for us what it's going to do is make it so that if you're going in this direction if you're pushing these two buttons you don't get a speed boost because you're going diagonal it just it's going to slow that down essentially all right then we need to um move in that direction well maybe not moving that direction we just really want to aim in that direction so just say like transform dot forward equals direction i don't i don't think that's right doesn't sound right but let's go in and try it real quick yeah we're going to need to set the um oh yeah actually that's right this is oh damn now i can turn and look in different directions pretty simple pretty cool like i mean it's nothing super amazing but i can i can aim in different directions now let's make it so i can move so to make it move let's go into our player code again and let's get access to the animator so we'll add in a way here cache the animator say underscore animator equals git component animator there we go and then we'll add the field for it so go home alt enter to generate a field for it get rid of the private keywords here just because i don't need them and we'll turn this into an expression body method so if i just click here and hit alt enter and enter it'll turn that into just a shortened version of it this essentially just gets rid of those braces so that we don't have to have as much code cache our animator so copy that animator here and then in our update we'll just set run to true if our input is greater than zero and false if our input is not greater than zero that would say animator dot set bool run and we'll set it to direction dot magnitude greater than zero that's it so that'll set it to either true or false every frame depending on whether or not our direction magnitude is greater than zero hit play let's see is this thing on we'll hit play get the controller on so you can actually see my my amazing thumb doing all the fun action there we go and look at that i can run around oh i can run in a couple directions so here i'm able to run left and right but you notice that i can't go up and down with this if i switch to the keyboard up and down works fine and i can run all around i've got movement in my different directions but the controller's a little bit messed up the reason for that is just that it's a playstation controller and the axis is wrong so if i go to edit and go to where's the project settings and then input or input manager expand out the axis and then find the it's going to be a vertical we're going up and down the second vertical option the first one right here is for keyboard it reads your up down left right or up down and sw keys um for like your keyboard arrows and and those the other one is for the controller the second vertical down here it's reading from a joystick axis it reads from the y-axis but i forget which one's the y-axis on this it's not up and down on this left thumb stick though that is axis three and i only know that because i've been working with these things a lot and i've got that one memorized and like these ones memorized i've used them too many times but it's going to vary from controller to controller so changing that to that value and hitting play should allow me to just run around and there we go got my mouse running around with some root motion animation all right i think um the next step will be what making him swing and do an attack real quick and then uh actually you know what the next step is let's go back into our planning board and add to our plan what am i thinking i set up a project planning board so we could plan stuff out let's do that we added got to move that over so how long did it take to fair character mouse probably about half hour and then player movement was about a quarter of an hour that was about 15 minutes at most maybe not even no i haven't even been live for 15 minutes so whatever i've overestimated my time so i don't think it matters all right let's set up our next steps so i want an attack animation um i want multiple players multiple player input let's say multiple players added and then i want um multiple player characters so alternative mouse that's going to be an art thing so we're going to set up another mouse character so i have two that we can battle between set up a second player with some input so this will include things like let's go in here and just add some stuff description actually you know what let's just uh i'm not gonna add in descriptions on these just thinking i might just make them into smaller tasks instead so we'll add in multiple players um attack animation so we can bump things around um we need to add in player player death oh that's not an art thing let's change that i switched that i made that art and that is definitely not art that should be programming and then we'll add in let's see what other things do we need we need um respawning oh that's kind of part of player death i might not make that its own thing uh we need bots definitely need some bots to bought ai so they can battle me and i don't have to just battle myself constantly um what else do we want maybe we'll add some sound effects and stuff too well let's we'll add that in there as a thing to do and then um oh some sort of a knock back effect right that's gonna be part of the attack animation and the attack plank all right i think that's good um let's start going over to unity and implementing one of these things i think let's see which one should we do i don't let everybody in chat really quickly just vote if you got a preference on one of these things i'm looking between like uh adding another mouse adding multiple players or adding an attack animation i think the alternative mouse is kind of needed before the multiple players or otherwise we're doing a bunch of rework attacking animation i'm good with though or um yeah i guess got to be one of those right the second mouse or the attack animation let everybody in chat really quickly come up with their their preferences or recommendations i am going to start looking at the mouse over here and just see what everybody in chat says and also say hi to everybody in chat real quick while i'm coding or while i'm looking through these mice switch to him i'm just gonna download this dude um download him um fbx for unity get in the file ready okay so you guys want to see the attack animation attack animation attacking mesh let's switch to attack animation that'll be the first thing that we'll do and then we'll work on the character next i'm going to pull in this guy this is that doozy dude i'm going to switch back over to mousey and we'll use an attack animation set up on him so search for attack and oh i gotta switch over to animations again let's find a attack that makes sense for him something where he's attacking somewhat fast ah that's way too way too slow of an attack i need something that's somewhat quick oh that's right i wanted to do the drop kick what am i talking about i already added an attack animation sorry i'm acting crazy let's go set this thing up i don't need to find one let's go select the rig switch this over to humanoid hit copy from other model and go select my running avatar hit apply go to the animation field and check out our animation look at that it's not working again this is the same exact thing that happened to me last time isn't it what is going on here what did i do wrong go back oh i'm in play mode maybe that was the problem yeah that's the problem problem before i think was just that i was in play mode when i was trying to set this thing up so here we go i've got the rig it's set up it's copied from other i'm in the in the animation and you can see that it does this nice beautiful dropkick sorry are they this the downside to live right sometimes it's space out and totally forget what you're thinking all right so i've got my mouse here i'm gonna go into the animator controller and we're gonna set up the attack animation so let's drag the animator up here and then let's go down to our kick and take the drop kick and drag it out onto the animator controller now i've got three different animator states and i need to make a way to get into dropkick from anywhere so i'll drag it up here i have a nice clean shot from any state and we'll make a transition from any state into dropkick and then what we'll do is just add in a attack boolean here or an attack trigger so whenever we fire off the attack trigger we'll play the attack animation and then we'll go back into idle let's add a trigger parameter we'll hit plus and hit trigger and type in attack there and then we'll add in a condition on this transition right here hit plus and make it be the attack trigger as the condition that will take us right into the drop kick whenever we fire off attack from there we'll just go from make a transition into idle and we'll just go right into idle after we've finished our attack so check the transition and we don't want to uncheck has exit time because we want it to actually play out that entire kick so you hit the kick and see what it's going to do it'll basically look like that he'll do the kick and then he'll do that idle switch and jump into the idle and then if you're running he'll switch to running right away too so you won't really see that switch into idlers go kind of really quickly into running all right so let's save let's go back into our code and make it so our character can attack and then we'll make our multiplayer setup work so go into player mode it's like player script let me talk about mode go into the player script here and we'll add in an input check to see if we've pressed um fire1 i'll just make that our attack button so i'll say uh how do i do this actually let's add a line of code right here we'll say if input.getbuttondown one and fire one by the way is like just the default it's left click or left control or i think it's it's either circle or x on this this controller here um it's like the x button on a place on an xbox controller it's like the default button on most devices so if we press that button and actually i wanted to get button down because get button down will fire only the one frame that we've pressed that get button will fire be true like every frame and i only want it to be true with the one frame so if we press attack or every time we push it we want to play the attack so say animator set boo or set trigger attack and that will force an attack now we can technically just spam it right now but we have no refresh on it and our attack animation will keep playing over and over that's fine though we need to set up limits and code for how fast we can actually attack once we've gotten to that point let's go into unity hit play and see if it works i'll take the animator i'm going to drag it down here like mousey so we can actually watch him what that will do is allow us to inspect the animator as i'm running around so oh i clicked and he actually saw it i run around you can see it working and then i hit the attack button oh it's square here they hit attack and he does a drop kick now on his dropkick he is dropping down into the ground so i need to go to it let's go select that dropkick animation i'm gonna stop playing real quick just select that dropkick animation the rig is set up right okay hit play real quick and just watch so he's dropping falling into the ground so we want to bake in the root transform position we'll just hit apply and that'll stop him from oh you know dorner all three i think i might no i'm just gonna bacon the y for now this should stop him from going up and down into the ground let's hit play and try again there we go so it looks like he's no longer falling into the ground he does by the way move forward a little bit when he does the dropkick dropkick looks terrible looked much cooler in the animator window than it does here here it just looks like he's falling over i'm going to find a new animation for him because his dropkick is terrible so let's find something where he's actually doing like a swing some kind of like swinging attack that looks better let's go for that and let's just overdrive it a bit so it's nice and quick all right i'm going to use this so this will be my character attack for him instead standing melee attack horizontal on mousey is that drop kick like i said it looked cool in a screenshot it looks terrible um in here let's go in we'll save that off go back into unity i should see my new animation here and i'll show you how to swap that animation out real quick let's see where did my file go did i not save it in the right folder okay let's just take it i'm going to grab it from chrome and just drag it into the window here i'll just take it here and i'm going to shrink this down file went right here i'm just going to drag it in and drop it over here i saved it into the wrong folder oh no it just didn't refresh that was my fault all right so delete the duplicate we'll go select the original we'll go to the rig we'll select humanoid and hit copy from other model this time i won't be in play mode so things will work and i won't get myself confused i'll select that avatar hit apply go to the animation window hit play i should see him animating okay i don't know what's going on here maybe this is just a bug in unity maybe i need to hit play and force it to compile or something to get it to start animating yep maybe that's the problem it's not me it's just this unity version all right good to know so now he's gonna play this attack animation instead of that silly drop kick that didn't work so go select the animator double click on it and bring it up just select the drop kick and right here you can see the motion that's selected if i hit the search box you can actually pick any of the other motions and i'm just going to pick the standing melee attack horizontal i can also drag them onto this field but i already well there's only a couple there so i already found it and searched for it easily there we go we've got that set up and now he's got an attack animation this seems a little silly let's run him down this way oh yeah that's okay it's it's not the certainly not the best attack but it's an attack i'm gonna trim it down just a little bit too so let's go select that attack i'm gonna go find the animation here and what we can do is kind of trim down like maybe these frames here and just cut it down a little bit i want to get rid of some of that wind up here what we do to do this by the way is just select the animation you can grab the beginning part here and just drag it yeah i think i want to go like here so that he just kind of like instantly snaps into the back part and just starts swinging i think that'll look a little bit better let's hit apply and try it running around yeah it's a little bit better and it's not amazing but it's a little bit better i do want to bake in the position though too so i'm gonna bake in that y position all right looking good okay so now i've got a character that can run around and hopefully just knock out um knock out the other dudes but i need to first fix a little issue though because i don't know if you guys noticed every time that i stopped playing let me show you real quick so every time i stop moving i'm walking down and he's looking good i stop and he snaps back up the reason for that is that in our player script let's go find it setting the direction um no matter what even if the input is zero so what i want to do is make sure that the magnitude is greater than zero before we set the forward direction so just copy this little check right here say if paste that in and add in a tab so that way we only set our forward if we're actually pushing in a direction let me go try that out real quick now i should be able to run around just stop playing and start again i expect i can run down here and stop and now i can kind of stop in different directions it's not always locked in whatever direction that i was pressing last alright so now i can run around i can do an attack um and i think it's time to set up another player we'll make it so we can attack somebody else and start knocking them off the edge killing them and then adding in all the other fun stuff that we want to do all right so let's get going with um a jelly bean and then our second character file so that's this guy right here what's his name let me go back in here and take a look so go to characters show that filter and we'll go down to oh his name is doozy all right so we're going to make a doozy folder we'll select him let's go into art right click create folder doozy take that file from our mousey folder drag it over and then i'm just going to drag him out into the scene and set his character up so i've got the character out there i need to extract his materials again one thing i forgot about earlier so hit extract materials hit enter to just keep it in that folder material right now doesn't have the textures on it it doesn't really have anything on it it's kind of a default one so i need to hit extract textures too i probably should have done that first in fact i bet if i did that first let's see if that'll just set up the material for me with the textures on it let's try that delete the material extract material with the textures on it there we go that fixed it much better much better way to do it and i get the little pop-up right here like i said most of the time i get the characters already set up i rarely remember to go through the steps so here we go we've got the character material set up now that gave us a material with the texture here and the normal map set up i did have to hit that fix button and it assigned it to the character which is nice now i've got my character ready to go um i need to make him have an animator though so i'm going to copy my animator from mouse here right click hit copy component and i'm going to right click here and or i'm not going to write right click right click there there we go right click and hit paste component and hit the little drop down here but it kind of drops pops things up off screen so kind of sucks there and now if i hit play let's see what happens nope you can see my little dude's there he's animating in his idol let's see if i add a player script to him what happens now i run around and well kind of idle so he kind of works right he looks like he's doing something but he's definitely not working correctly so let's go check him out let's go see what the differences are and what we need to do to make him work let me see what do we got here go select this character here and i'm going to go into my mouse and um let me throw how i want to go through this process let's hit play real quick let's just show what it looks like in the scene view with this this guy selected so here he is um attempting to animate interesting he's attempting to play this idol animation i'm going to grab his own idol animation he's attempting to play it but it's not actually working right so oh did i i know what i missed the step here so let's go go through the step that i missed if we go select our character and we go to our rig right now our new character our doozy dude is set up using the generic animation type he needs to be set up to copy our mouse if you set up copy our mouse it'll start animating using the mouse's animations to do that we need to change from animation type generic to humanoid and change this to copy from avatar search box and find the other avatar hit apply now i hit play and we'll go into our animator let's go to the scene view again and oh he should be starting to animate better let's hit his attack he is not animating like i expected let's see let's go select him again he does have oh he has the controller set up he's got his avatar i'm just got the avatar set up yeah he's not playing that animation i'm not sure what's going on with this guy and then the retargeting so what we're going to do is the part that i was going to get to anyway in just another second which is setting up animations with an override controller on this dude i wanted to do different animations on different characters so instead of trying to fix the retargeting there let's just go through that process so here you see i've got that doozy dude selected i just literally had it left up from before let's just download him oh he actually has the attack animation already that's the one that i've downloaded let's grab the idle version so let's go find an idol go to animations go search for idol and what's a good idol for this dude i think that one looks good so grab this as doozy's idol download with the fbx for unity download it with skin and we'll make sure that goes into the right folder as soon as it pops up all right so that's going to go into the doozy folder and then let's see we've got i already have an idle one but okay let me see what else we need here okay so we've got idle oh we need the attack sorry i just went right past the attack thinking i had it and i didn't have that let's go find that attack again i've got the attack um that was which one was it that i was looking at here that looked cool this one nope not that one that one's actually okay dual weapon combo but it's like a a special attack you know i'm going to download that too and make that like a special attack for him they could do like a triple combo attack this is one of the reasons i wanted to have different characters so we could have these these weird mixes of combos and stuff and they don't all play the same i think i hate it is like games where every character plays exactly the same i mean i don't hate him but just irritates me after a while i get bored of it all right now let's use this for his other attack so this would be like his fast attack a zombie punch all right so now we've got an idol two attacks and i need a walk or a run real quick let's grab a run animation too and the run animation since we're using root motion is going to control how fast he goes if we give this guy a faster run animation unless we start playing with things they'll just run faster than the other dude if we give him a slow one he'll run slower so let's try um let's try this one that seems good download that save it into our project and then get to setting it all up and coding by the way if you're still watching you don't mind hitting the subscribe share and like and all that stuff i appreciate it does help a lot and just get stuff out there so just hit those buttons and share it out there and get all your friends in teach them how to make games then start your own game studio that's what i would do i recommend all right so let's set up our animator override controller now so let's go take a look at the mouse the mouse animator has a kick well it's no longer really a kick it's actually an attack let's rename this to attack it's got an idle and it's got a running state so i want to just be able to use the same controller and the same boolean parameters on this dude but have it played different animations i can do that by going into my doozy folder right clicking creating and choosing animator override controller i'll name it doozy and then we'll assign the default controller the base controller to be my mouse one or mousey and then we have the three fields for those three states that we had just like if we go over here it's actually for the three default animations but i know the names are at least but i have the animations or the fields for them right here to override so i need to override the idle here and i'll override it with the correct i don't know i don't know which idol it is because the names here are a little bit odd but if i click on them and click on these miximo ones you can see that this one is doozy zombie punching and i think this one is dual weapon combo let's see is there one that's a doozy idle or is the doozy idle one let's go find it so let's go into the project folder go to the doozy folder let's go find the idle dude and what i need to do here is make sure that well actually first i need to set up my avatar so i'm going to make the idle one my default we'll set this to create its own avatar create from this model i'm going to hit apply and then we're going to go to the animation oh there's an import the error with importing the rig strange interesting the problem with that character let's let's see another one humanoid or this is not a valid humanoid okay it is the punching one was fine i bet i just need to let's try re-importing this change it to generic and then change it back to humanoid okay and then create from this model so it's acting weird again again latest version of unity stuff weird some weird stuff will happen sometimes and you just deal with it try again if it doesn't work then maybe look into it but try stuff for the second time first all right so now i've got my character set up he should be set up with his aunt or his uh my idol character set up he's creating his own rig and he should have an animation here i don't know why he doesn't show an animation here and then let's go find the other ones let's see so this guy shows an animation this guy's good interesting so that's strange all right let's fix these up so this is the zombie punching one i don't know why the animation's messed up but this is what happens when you download free stuff sometimes the files aren't perfect in fact this is what happens when you download purchase stuff most of the time the files aren't perfect and you got to go in there and just find the problems and fix it all up so that's what we're going to do now let's name this uh punch that'll be my punch attack um let's go up here oh i hit apply apply that change let's go check this one out again so this is the idle that's definitely not a valid idle so i'll go delete that one and then the second one here is going to be my idol so i'll name it idle and let's hit play on it and there we go now it's looking right we'll hit apply now i've got my idle set up i've got the punch set up and then where's the run nice they have a runoff in here this is a dual weapon combo that's not the one i'm looking for i'm gonna name this one combo and then delete the other one and then we'll go grab that run again i don't know what happened to my running animation got punching idle combo or maybe i put it in this other folder let's check is there a doozy one in here nope all right so let's go back into miximo one more time and just download this file i literally don't know where i saved this file at it's it's right there what am i doing let's go into unity let's go click here grab it and drag it right into that doozy folder or i guess we're oh it's in there running it's literally in there okay we i see what's happening it hadn't refreshed now it appears beautiful i said i've got my run animation let's go play that not looking right try that one the mixamo version looks good all right so here i need to actually set up all of these to use my idle rig or the rig for this character so i made the doozy one set up a rig or the i sorry the idle one on doozy is creating the rig i'm gonna use that as the base i'm going to select all three of these and i'm going to go to rig choose humanoid and i'm going to hit copy and then i'll hit search and then this time we're going to use the doozy one which is number 19. and we're using that idle one i'll hit apply and now there's going to be two avatars i've got one for the idol here and one for i think i used the idol there hopefully i use the idol there maybe not on the on the mouse you do so i've got all of these set up now using that avatar go through them and you see it except for the one that's creating the avatar now i should be able to go select them and click their animations hit play punch works running probably has two files so i'm going to need to delete that first bad one or two animations rename the valid one the miximo one to run and hit apply there we go that looks good oh let's make this one loop too because running should be a looping animation all right there we go we've got all my animations set up let's go actually set up the override controller so the override controller is referencing our mouse animator and it's got the idle the run and the attack i can hit the search here and go find the ones that i want i want to find the idol for doozy there we go idle and that's the doozy one do the same for the run go find the running one i named it run instead of running on doozy okay select that and then for the attack we'll go find an attack which one was i think punch was my attack there we go that's in that doozy folder too yep looks good save that off i'm gonna hit play and hope that the magic works we'll run around and um i didn't work okay so we'll run and we'll see what's going on why is he not animating let's um go select suzy oh he doesn't have the right animator controller selected or set up let's name him doozy first and this goes choose the correct controller it needs to be on the doozy controller he was on the mouse so select that one save again play and see if it works okay well things are still not any better so let's go take another look and see what's going on i've got um that's an animator removed okay we got an animator got this thing targeting his wait oh whoops okay i see the problem hopefully you guys all saw that i bet somebody in chat probably noticed it before i did so if we look here select doozy my avatar is referencing the wrong avatar i'm referencing the mouse avatar i made that whole new avatar on this doozy guy and i forgot to reference it so there we go select it reference it and run around there we go look at that now he runs the other mouse runs the speed is based on the character or the animation speed so the doozy dude is faster which i think makes sense because he's got longer legs right thinking like that dude will be faster and you know maybe a little less powerful and then the mouse do to be slower and more powerful so there we go i can run around both the dudes i can hit each other um controller works obviously and i think it's time to add in some actual combat right so let's uh save and we'll figure out the next step actually we'll go into our project planning tool real quick and see what we can do by the way for anybody who's asking you you will be able to watch this later um just follow along though while it's live and then we'll be able to go back through and i'll post it all up later cleaned up and stuff so you can re-watch it later and and miss catch up in anything that you missed all right so we got the attack animation it was in progress and it's already done that was probably about i don't know i i didn't pay attention this is the problem with these things as uh sometimes you set up the things and you forget to actually uh keep track of them or keep moving things especially when you're blabbing and talking and stuff while trying to debug stuff easy to forget to keep track of our a list of tasks to do it's also easy to fall off track to start going down the wrong path so all right now we've got i think two players that run around and i want to make it so our players can actually attack each other so let's add in um a way to deal with attacking like i think what i'm thinking is the player will play their attack animation at some point maybe we'll just use like an animation event to trigger them doing an attack check so i can then see if they're close enough to hit something and if they are close enough to hit another player then they hit them if they aren't or maybe would do like a little um a little sphere cast right in front of the player right when they finish their attacking or like an overlap sphere or something so hmm let's think that's true so yeah we're thinking as eating beans while we echoed but i will play the attack the mouse or whatever will swing out and when this thing gets to here we'll put an animation event there that'll fire off and code code will then just do a quick little sphere check right in front of you to see if there's any overlapping spheres any enemies right in front of you and or it could just be like a raycast i think a spear check would be a little bit wider a little bit more arcadey um and then yeah we'll just that's it we'll just check to see if we overlap anything and if we do we'll hit that thing we'll make that player like going to like a knocked back state or something so they're like flying back and they can't control themselves actually maybe we'll just trigger an animation this knockback animation since we're playing with root motion why not so let's give that a go so let's see what do we want to do well i guess it's the the first step will be setting up our animation so let's go to mousey and let's find his attack animation which is this one here and let's hit play on it so he does this swing and what i'm thinking is pause that let's go around to the front so right mouse right here we'll just let you drag around drag around and i'm thinking right about here so when he gets to this point right here we'll do a check to see um if he's hit anybody so right at point you know whatever this is frame 15. so to set it up with an animation event what we do is expand out the events section hit plus here and give this a name like um let's call it attack landed now copy that just double click on it go down here and hit apply and we'll go into the player script now the important thing for this by the way is that for the code to work with these animation events it needs to be on a script that's at the same level as this animator otherwise it's not going to fire that off so let's go into our player and we'll add in a method here we'll say void paste attack landed so that's the method is going to fire off whenever our animation plays and gets to that point if we start our animation over and over and we never get to that point we'll never um actually play it we'll never do that firing part so we have to let our animation play to the point where it says attack landed and then we'll do that sphere cast in front so do a sphere cast in front of our player we'll do physics p h y s i c s let's see oh hey jason oh hey what's up guys lots lots of people here so okay i'm gonna shut up and stop looking at chat and actually code so physics dot sphere cast and what we want to do is um oh no not a sphere house we're gonna do an overlap here so we'll do overlap sphere we'll give it a position which will be our transform position plus we want to do one meter in front of us so let's say our transform dot forward this will give us a position that's out in front of us by one meter and then we want to do it in a radius of i'm gonna go with one meter and then for a layer mask well let's make a player layer mask i'll say player underscore mask actually i'm gonna make this underscore player mask and make it a serialized field now let's um let's let's generate a field for it first so we'll generate a variable hit alt enter generate field and then f12 to go to it i'll get rid of the private and i'm going to add serialize field layer mask and i'm going to move this line up so just move it right up there so it's the top line this would be a field where i can set up the layer mask for players and then i'll just assign it on the players well no you know what i want to do i want to do a um a layer mask uh whatever i'll do it in there and then i'll i'll write the code for later so this will give us an overlapping sphere that will check to see if we've got any players in range and it's going to return back um say bar result equals overlaps here let's let's just take a look at what the result type is it's an array of colliders so we'll get back all of the colliders that overlap in that area so we just want to loop over them so say for each are let's say player and result in fact let's rename this to players that's actually going to be a list of players because we're using that player mask we'll say if player is or player.game object is equal to this game object then continue we don't want to include ourself um and then but we do want to be on the same layer as all of the other players and then if uh it's not then we'll just say player dot take it and or actually let's say um hit player and we'll pass in the player instead we'll hit alt enter and generate a method because we're already on the player i feel like we may as well just leave it inside this method or otherwise we're going to be adding a public method to it that we might not necessarily need or we might not necessarily add a public method but we we might start to think too so what do i want to do when we hit this player from another player i want to um get its animator and tell it to play its hit animation for now so let's say player player dot get component actually you know let's change this we're going to say player dot take it i was wrong and then we're going to make this say take it and then here we'll be working on the players we'll make this public and we're just going to work on the player that um got hit oh wait no sorry i know why i didn't do that because we don't have a player component so let's get the player component r player equals or let's let's call this collider and we'll rename this to colliders and then we'll say player equals collider. say we actually need the player component here so may as well get a reference to it so get the player and then if the player is known we'll continue ue and then also if it's the player is us then we'll continue as well now these could obviously be on the same line so i probably just cut this and say or and then add some space and just clean it up a little bit so if we don't have a player or the player is the player that's attacking because like maybe our raycast hit us because our collider is too big or something then we should also not take the hit we'll just continue on otherwise any other player that's in range should take the hit but what should that do well it's got a reference to its animator it just say animator dot set trigger take it and i think that's it so our take hit and just play an animation that does some root motion and does like a knock back or a stumble back and if that's enough to um push them off the edge then cool they push off the edge then we can always add like a physics knockback that makes them go flying in the air or something too but first let's get them playing an animation to knock back so uh we're gonna need an animation let's uh go into here and oh wait what have we done here knockback effect on impact that's what we're gonna do so that's gonna be our prog or our in progress test so jump over to mixamo and let's grab a hit or an impact let's search for impact sword and shield impact falling impact getting uh many a search for hit trying to go to hit animation like somebody get they're taking a hit and stumbling backwards is what i want anything that's like a stumble back anyway how's everybody doing in chat by the way i may as well chat with everybody and say hello while uh while digging through for animations and i can actually keep an eye on on what's going on there and no this is definitely not rehearsed that's why stumbling through all kinds of stuff but it's uh more fun that way i think sometimes it's more fun that way if you have some uh a very loose idea of what i wanted to do basically came up with the idea this morning in the shower and was like oh that seems like it would be fine okay yeah let's go with this so we'll go with this like stumble back and get knocked back and then um well maybe not let's download this one and maybe a couple more because i'm thinking i might want to do just like an impact like a hit do and just push the player back too so we can do fast attacks and slow attacks we don't always have to have all slow attacks let's find a simple hit i'll just kind of mix them up that one looks good all right cool oh geez stuck on the couch that's sad they're watching chat that does not sound fun at all it sounds painful hopefully everybody else is having fun uh having fun and not in too much pain um wish you the best man all right so let's go in here and start setting up some hit animation so our oh i didn't add download any for the mousey so let's go grab some for mousey as well i'm going to select mousey and i'm going to grab a couple different animations for him too i mean i'll just take that same hit for him and then i want to find a different like stumble backwards if i can he goes into the mousy folder and then we'll see it is our stumble s-t-u-m-b-l-e uh no that's number wrong let's search for hit oh i'm on characters and now let's search for stumble i see you m-b-l-e there we go we got a hit reaction like in fact maybe this dude since he moved so slow he should not get knocked back as much maybe it'd be like that he'll just take that little hit download and download and we'll set this thing up so we're gonna take like a small hit and then and a big hit i think we'll start with just the big hit it'll take like that big hit play the big hit animation and then we can make it like an alternative hit so we can have like a quick attack a slow attack and then maybe some other i have three buttons on the arcade system so come up with a third thing that he can do after that let's go into our mousey and set up these other animations so we'll go grab our let's see what do we got head hit and what was the other one i grabbed reaction hit then we'll take the rig select humanoid which you just copy from other avatar we'll select mouse dude right here which was 14 character 14. um got him selected and set up the animations are there we'll go to the animation tab and set those up so the reaction hit oh let's see it actually look right oh beautiful look at that i didn't have to do anything and then let's go check out the other one the head hit make sure that looks good hit play okay looking all right i mean the the arms are a little bit weird but i'm good with it now let's go over to doozy and do the same for his two hits we had that head hit and the stumble backwards for this guy for the rig humanoid copy from other we'll choose that 19 guy which was doozy the avatar that i made from his idol hit apply go to the animation tab and we'll go check these two out make sure they look right so this one does not look right it's got the wrong animation selected so i'm going to copy the name here minus and delete that one and then go select the second one paste it in hit play i'm sure that's the right one happens a lot with those got the wrong one in there oh and i want to bake the position the y position too i don't want these things going up and down and i'll hit apply do the same on the head hit here i'm going to guess that i need to bake that position hit apply i probably need to go yep copy this animation name hit minus paste it in here and hit apply now i'm going to have an animation that's a head hit and i want oh i want to bake in that position i'll make that in as well i want to make sure that i bake that in on the mousey dude too so let's go select mousey's we'll hit fake on the y position there on the head hit and on the zombie reaction hit two i don't i just don't want them going up and down all right so we'll save this off and then let's go into um let's see what we got we got the animator or the animation set up oh we need to set up the animator so when we get hit we'll go from any state into a hit state we'll just add in a new state we'll take the animator let's just drag it up here let's go to mousey and take our reaction assemble backwards and we'll take this and drag it out and in fact i want to rename this i'm going to select it i'm going to name this stumble back and then hit apply that's the name i want for this animation then i'll name it here stumble back to zombie reaction hit is too confusing it's not descriptive enough for what i'm actually using it for now we'll make a transition but first actually let's make a trigger called it i think i named it take it in the code so call it take it make a transition from any state into that one and set up the condition to be that the trigger take it was called now once we're done with take it we should go into idle so i'll just drag and make a transition down there and you can see i've got the animations so here let's actually go like that you can see we go in from any state into attacks or stumble backs but when you think about this like we probably shouldn't go from any state into attack if we're stumbling right shouldn't be able to stop an attack from a stumble so we're going to need to fix that but first let's play and see if it works actually let's go double check the code so mousey is set up mouse oh maxi doesn't have a player mask that's okay right now we're gonna look on all the actually no i need to set everything i alive not okay if i set it to everything though then we'll check every object and see if they have players on them i can filter that down later player mask was probably an early optimization that it didn't really need all right let's go look at the player script so it sets the take hit trigger when we get to the take hit part i think we're good let's go save and hit play and see if it just works i always say i think we're good but then i'm wrong so all right so let's see if i can aim at that guy okay actually here let's um i'm gonna do this because what i need to do is hit a player but i need to not be controlling both players at once because running around and controlling them both at once is impossible um and i can't really figure out if i'm getting into the right spot so let's stop let's go set it up so that the players are controlled independently so what we'll do is this is still kind of in progress i'm going to add multiple players to in progress and we're going to kind of switch over to that and put this one on hold for just a minute so we'll go to set this up really what we need to do is change our input so that we can just read from a player number right now we've got horizontal and vertical and fire one and attack we can just make these something like p1 horizontal p2 horizontal and so on just prefix them and then set them up to read from different devices that's the easiest way to do it so um let's in fact let's do it the simplest way let's add a serialized field add a string and call this controller prefix um i'll copy it and then we'll just paste it right here and hit plus let's zoom in or scroll up a bit let's see oh my that bouncing all around so what we're going to do is wherever we're reading something from it we're reading a horizontal or a fire button or whatever else i'll just paste in the word controller prefix plus right at the beginning now we'll read controller prefix plus that plus vertical and plus horizontal um we'll do the same for our fire button controller prefix fire one and um that's it those are all of our inputs now i can go over to unity go select my player and i'm just going to assign them to p1 and then um i'm gonna leave doozy alone so i'm gonna name this p1 for mousey and then we'll set up some some input for mousey real quick let's go into edit and we'll go to project settings and we'll go to oh i'm already on input manager if you're not on there just go ahead and select it so what i'm going to do now is change my joystick ones instead of having horizontal and vertical down here this is not my first ones i have the horizontal and vertical up above and the fires and all those all of the top ones are keyboard ones down here the second set of horizontal and vertical these are the ones that are set for joysticks i'm going to rename this i'm going to say this is horizontal no longer horizontal it's p1 horizontal and it'll read from the joystick axis um right now it's going to read from all joysticks let's change this to reach from just joystick one and we'll change this vertical three p1 vertical and make that also only read from joystick one instead of all joysticks then we'll change this fire one here let's drag this up a little bit by the way i'm gonna make sure that this is all on screen and drag it up here and over to the right so fire one i'm gonna rename to p1 fire one and then we wanna get this from the correct joystick but since this is on key or mouse button if we change this to joystick one it doesn't do anything i'm gonna change this back to all just so i don't forget what i need to do instead is put the number here in between joystick and button the joystick blank button zero is button zero on any joystick joystick one button zero will be button zero on joystick one all right so that should work for my fire and my vertical and horizontal and what i can do is just duplicate this so duplicate the horizontal duplicate the vertical duplicate the fire expand them out make this p two fire pick that joystick button two and then we'll make the um p1 vertical the second one here be a two and then make this joystick two and then we'll expand out the horizontal one two make that a two and make that joystick two i've got two joystick inputs set up and i can set up my players to run on two different playstation controllers assuming that this one stays tanked and works otherwise i can also just use my keyboard by not putting in a player number prefix there so remember on this one he doesn't have that prefix he's just gonna read horizontal vertical on fire so essentially the keyboard one let's hit play and try it out so this now moves around mousy look at that beautiful and this moves around the keyboard here is moving around doozy i'll do some attacks real quick and then i wonder if this thing is actually working let's turn on this other playstation it was giving me some problems earlier so see if it actually shows up as a device here by the way if you're using windows you can just search for usb controllers yeah it doesn't seem to be showing up interesting so it's only showing me this one stuff something going on with this one i'm not sure what it is the bluetooth connection stuff that's all right i got keyboard though i can use the keyboard and mouse for that and then eventually the goal is switch over to the arcade system that you saw on the thumbnail that's all usb controllers and those are wired ones i also just wire that up and it would work too but i think keyboard and controller is good so let's move around this uh this guy and go do some attacking let's see if it works attack and i'm not seeing him take a hit he doesn't seem to be doing anything hit worthy right he's not not not taking any damage let's see if this guy can attack and do any damage doesn't look like it let's go try playing the animations so go to the animator drag that down and i've got doozy selected let's tell him to take a hit if he takes a hit he'll do that little stumble back so he should work he should at least be able to do it let's try this guy he'll should be able to do it too my guess is that the code isn't running on the animation so the attack is maybe not playing the animation let's go check out mousey let's go check out his attack and make sure that it has the animation event on it so go to the project view we'll go select that standing melee attack go select it here scroll down check out the animation events it does have the animation event attack landed we copy that and make sure that that matches the code and then we'll add in a breakpoint and just debug there we've got attack landed yeah that's there let's add in a breakpoint here so just click on to the left and hit f5 to start debugging i already enabled um debugging for all unity projects so it's not going to give me that little pop-up you might get a pop-up asking if you want to enable debugging um mine's not there just because that so left clicking fires doozy and then this color should make there we go now see attack and do a check oh i know what's missing so here we go we do an overlap sphere we look for colliders there's one collider i expand it out and it's the cylinder let's go take a peek at our at our game stop playing look at doozy so we're doing an overlap spear to look for colliders in front of us and our doozy and mousey characters don't have colliders so we just need to add colliders to them i'm going to go to the scene view hit f select both of them at a capsule collider and then i'll move the y position center up one meter and set the height to two meters oops i did not do that right i meant to click into the height and then set it to two a two is normally the right height for an npc or like a humanoid character these dudes are miniature though so i'm going to shrink this down in fact i'm thinking like 1.25 maybe let's go to 1.2 and then we'll go to 0.6 here that looks i think a little bit better that's a little bit better on mousey let's move doozies up a little bit so for doozy we'll make him 0.8 and 1.6 ah that's too big let's go to 0.7 and 1.4 so essentially what we're doing here is moving we're setting a height and then setting the center to be half of that height so that it's right in the middle of the character's height and that looks like a good collider for him that looks much better i think i want to move mousey's collider with in just a little bit though because he's a little bit wider than his body bring it in not too much maybe 0.35 it covers his head and it's a little bit bigger so he's not too hard to hit but that he's not huge and way bigger than his actual body all right now let's run over here hit doozy oh we hit a break point why everything froze but remove that rake point hit f5 go back into unity and see if it actually worked there we go so you can see it when we hit him it's actually making the dude play his animation let's see he plays his animation and steps back and it's uh well assuming that i let the the attack play all the way through then he plays it so i need to um let's see what do i want to do i need to either limit my attack speed or make this dude get knocked back or maybe set up a bot or maybe i'll fix up the cameras so i can get a better view because i i like seeing them but it's really really far away in fact let's fix up the cameras first and then we'll do some of the other stuff i want to make it a little bit more fun to watch so i can get a closer view of him so i'm going to go into my package manager and we'll grab the cinemachine package and you change that to unity registry and then just scroll down i should find cinemachine and hit install it could search too but i mean it's on the first page so not really any need you just gotta make sure that you check check that unity registry option all right so it is now in our cinema machine options are available we've got cinemachine right up here and what i want to do is just make a target group camera i want one that's going to focus on both of my characters or all four of my characters when i have four characters set up so to set it up i i'm gonna zoom out a little bit i have this target group object and this vcam that got created and on my main camera it got a cinema machine brain this all happened when i chose cinemachine and chose create target group camera the target group camera will just basically pick a group of targets and make them all visible and it does what the name says so we'll hit plus on it to add some target spots so add two spaces for targets so i can assign two targets and we'll take mousey into the first part doozy into the first one i guess and mousey into the second one go to the game view and well you can see there we go we've got both of the characters nicely covered right they're in there looking good but what we want to do is go to the vcam the cm vcam which is in a machine vertical camera one and we just need to change the offset here so if you look at the body option here it's set to follow at 10 meters behind at zero meters above and off to the side so it's basically following 10 meters away from the feed we can just drag this y value up and it'll start to kind of pull out and we drag this z value out oh what do we want we want to change the transposer let's see i want to change this to world space and drag why is it uh hold on a second what's going on here oh oh oh okay it's the radius here i forgot sorry i got mixed up on these things so when we're using the group composer option what we need to do is go to the target group and actually set a radius around those target group items for objects so if i set them around like i'm gonna go with like a one and a one it'll keep them really tightly on screen one and one all right let's go to one in let's go to two and two all right i got myself a little bit mixed up there happens all the time when i start playing with these things all right so we'll run around and now you see that it's actually going to follow my characters and keep them on screen and it'll zoom in as i get closer in fact maybe i should go to a um let's hit maximize on play pause and play again and get an idea of how big they're gonna be so if i got two guys on screen they're about this size and i want to make that dude now turn and knock back in the direction that i'm hitting him so let's um that's looking okay but i want to i want to add in a ground because to be honest this ground looks terrible and it's bothering me and then i want to make it so that we can knock them off the edges or so they fly off in the direction that we're pressing or maybe we'll do the attack speed delay first and then uh first let's put in a ground texture though because this is going to kill me in fact you know what i have a ground texture that my buddy frank sent me earlier and i am going to just grab that and drag it into here see if i can do that let's find this um this sand texture and just pull it right in i've got it in one of my folders here i just got to figure out which folder i grabbed it into where i saved this thing off into let's see projects and then this one okay we've got it almost ready here comes the material where's that ground terrain wall wall wall ground normal ground height ground diffuse perfect all right just take the ground diffuse i'm going to drag it right into my art folder bam now i've got some dirt i'm going to select this little terrain piece here or my cylinder assign the ground to fuse and see what happens yeah like it looks kind of weird because it's just sitting on a cylinder and it's not really mapped right but i could just adjust the tiling here let's see nope can't adjust styling and make it work look right so what we're gonna do and the fact that's because it's cylinder so it's gonna let's clean this up let's go in and add pro builder real quick and set up a simple little platform that we can fall off of or let's do something better let's find a let's find a little art asset and just import it because i don't want to use something that looks ugly so i'll go to the asset store and find a floating platform something that we can make our thing just float on top of i'll grab it and we'll pull it right into the project um loading grass platforms let's see that looks good we'll grab this one i'm going to grab it pull it into our project real quick and then we'll see it in action so we'll use this grass platform and then that'll be like the terrain i just like that i really hate having this really ugly background just sitting there that we're kind of running around on it it's no fun for me and i don't know hopefully this is more fun for everybody else too let me just make sure that i'm on the correct accounts for this um i'm not so i gotta make sure i get onto my correct asset store account and then we'll download that asset and pull it in so the other thing once i've got that asset in here um is going to be well i'm going to distract myself i tell you but i think what we'll do is [Music] get that in we'll get the animate of the attack delayed really quickly so that you can't do the attacks too fast and then we'll do the knocking off that's right so a floating platform i'm grabbing it right now and then we're going to pull it in through the package manager so grab that floating grass platform pack it's added to cart and checked out and then we go into our package manager that's going to pop up in just a second and we'll pull it right in so it's definitely um definitely a good option here by the way for anybody um who's kind of curious about the asset store if you haven't used it before i highly recommend it i don't recommend that you just go like grab a bunch of stuff randomly and then like maybe try to come up with a project for it that's something that i've done in the past and i mean it never really goes anywhere like you get all these ideas you get excited because you see something cool but like what i would recommend instead is use the asset store for projects where there's stuff that actually makes sense for your project like you've got a game idea in mind go look for things that match that game idea that will push your game forward don't expect it to be like the perfect thing that you're going to be able to use all throughout the game's life cycle like sometimes these will just be placeholder things or temporary things or you might need to add in extra stuff on top or have extra work done outside of it but definitely use the asset store as a starting point there's tons of really cheap and free stuff on there and we always achieve sometimes the things are a little bit pricey but relative to hiring an artist they are dirt cheap like it's not even not anywhere close it's a way way cheaper than getting an artist anywhere and you find all kinds of really cool stuff and really great things that good deals so let's find this platform pack i just bought it and have it set up i think it should show up when i search for platforms for floating oh man i you know maybe i bought it on the wrong account anyway somehow i still got it on the incorrect account i don't even know how let's fix it real quick sign out and sign back in sometimes this happens downside of having more than one account end up with packages and assets on on a bunch of different ones did you get in what happened all right we should be in and hopefully grabbing our floating platforms now come on floating platforms watching that show up floating grass come on what's going on here search that's from too many packages floating grass platforms perfect all right we'll download it and import it in all right and then let's see what's going on in chat real quick say hi to everybody the chat windows kind of get bugged out sometimes i don't see everything going on all right so we should be good we've got the art imported let's see did it come in oh no it didn't import i downloaded it but i didn't import it so let's import it and then we'll move it into a subfolder so i've got my imported full or floating grass coming in now i'm going to make an asset packs folder so we can just drop this in there and keep it clean and keep it separated from our other stuff just in case we pull in other packs asset packs folder move my floating grass into there double click on it double click let's go see what they got for scenes here they have one test scene i'm gonna save my sample scene control s and um actually i'm just gonna drag the test scene out here and take a look at it let's go find the platforms and hit f okay it's just a bunch of different platforms in the scene let's go look at this it looks like they're just prefabs go select them okay it looks good i'm gonna unload the test scene here just remove it and then let's just take one of these grass platforms and drag it out there let's start with something relatively simple but not square like i may go with this triangle take this triangle one and just drop it right out here i'll put it right in the middle of the scene so just drop it in the hierarchy it goes to zero zero zero look at that it actually matches the size of my cylinder i like they're thinking everything matches up perfect all right so select this one this object i deleted the other ground that we had and we've got a mesh collider on it already um i'm gonna run around real quick and see how it looks so much better oh yeah it's a thousand times a little bit of placeholder art will go a long long way let's uh fix up the background too let's make it so the background's not that blue let's go to just like a a black or you know maybe we add a sky box i'll go to black for now we'll start with black and then we'll add in a sky box later all right so save this off um let's see i've got my ground here i want to now make it so that the characters can oh we don't want to think i want to make it so we can knock them back in a direction now so that when we hit them and like actually use the rigid body add a rigid body and maybe like kind of push them back or make them go flying back and possibly fall over so i'm going to select both of the characters here and add a rigid body to them both i know i want one on both of them and then um that's it they should just kind of roll over right what's going on what's pushing them up here let me see what what was that we'll move our mousey over here let's hit play i'm going to pause real quick and see what is um pushing this dude up with the the rigid body so they got a capsule clutter they got a rigid body we got an animator let's try okay oh it's the uh i don't want to deal with this actually technically i guess i want the animators to be kinematic at first or another rigid bodies and then i want to turn them off and i want to make them not kinematic when i'm doing the knock back and up because my goal is like knock them back and upward in the air um well stop let's remove the rigid bodies for a second and um go take a look at the project planning stuff real quick first so got multiple players added i'll move that over here that was i don't know what 15 minutes and then knock back effect so they're doing i want to finish this up first before we do the flying part so the current problem that i want to address is the direction that the guys go flying so if i run over here and i hit this guy oh does it not even work on mousey okay let me try it on this dude right here i hit him he does the walk and knock back and that looks okay but my thought was like if i hit him this way he shouldn't he should walk and knock back the direction that i hit him so i want to turn him and kind of push pushing the face away from me or towards me when i punch him and when i knock him back so they'll stumble backwards behind um or maybe i'll just push the player back i don't know i'm kind of up in the air let's go into the code and um take a peek so when we hit the player when we when we tell him to take a hit we set that trigger um it's gonna make him do a stumble i'm gonna make him look at my other player i think that's what i'll do i'll make him look at the player and then take the hit so let's say um take a hit all right it's from i'm going to rename this and i'm going to pass in this so it'll be the player that's hitting him so player hitter now i'm going to say transform dot look at hitter dot transform so just force him to look at me real quick before knocking back oh i stopped debugging didn't realize i was in debug mode that whole time all right let's hit play another bean and see if that turns the dude so that he faces me before he kind of goes flying back nope um grab the attacker vector and apply it yeah um definitely okay sorry watching chat too and even beans while we go um how much time you spend coding and not carding um i don't know a lot back and forth like uh i'd say most of the time is not really writing code it's more thinking about what i want the code to do so this let's see i'm not sure why it's not looking at oh it was probably the animator change oh yeah it's um what do you want to do here is when i get hit what i want to do is make it so that they can't use their input at all so disable input completely force them to look away for just a second like not even a second like a tenth of a second and then play the animation let's do that so when they take a hit i'm gonna we can't move for some amount of time um let's say disabled or re-enable time equals time dot time plus 0.1 seconds so we'll add we'll we'll make them so that they can't move for a tenth of a second that's my thought i'm going to copy that value here and we'll just go up to update and we'll say hey if time dot time is less than re-enable time return i'm gonna add a field for that so just generate a field hit f12 delete that private so now this is just gonna be a really simple way to disable all input um until some time or for a tenth of a second after we take a hit in fact let's turn this up to one second real quick just so we can see it in action make sure that it doesn't work and then um yeah and then we'll go from there because it's always good to just test it and make sure that it's actually doing what we thought so if i run over here my thought is that this guy won't be able to move when i hit him once i hit him oh if i can aim at him right i hit him and yep no moving there we go and now he moves so if i hit him again no moving and now he moves but i am noticing that he does turn in the direction so he's he may not be moving but he definitely turns let's look i must have put that code inside of something else let's take a peek in my update if time.time is oh what is turning this is the part turning oh this is the part turning up no i don't know i'm not sure why it's uh debug.log taking hit from hitter i needed needed my dollar sign there didn't get auto added let's take a look real quick i'm curious what's going on here i'm not sure why it didn't work all right so run over here hit that and he shouldn't be able to turn why is he turning right here mousy you can hit my mouse okay so mousey's able to hit this other dude uh let's get out of maximize on play mode real quick i need to look at that log let's see if there's something going on here so mouse is out of play mode or out of uh actually able to hit i can take a hit and he shouldn't be able to turn but some what do i have that's turning him in the direction it's just this right i'm watching chat too just in case i i missed something um let's add a log here um let's do that plus direction i must have missed something here i i mean obviously i missed something here otherwise it would work that's always the case right well is that or there's an issue in the code all right so we'll run over here throw out that log punch i'll take a hit yeah it okay so i i think i know what's going on i'm just being stupid here so my time my timer must not be working right because the part that's stopping me from running a bit is the um the fact that i'm stuck in the idle animation so the the reason that it seemed like it was working to me i just i'm realizing it now the reason it seemed like it's working is i'm getting hit i go into this and i'm stuck in this until i get into the idle so i can still turn my code still running but um i haven't finished my stumble yet so i'm never getting to the point where um i'm blocked by this so why is it not blocking it let's see actually let's take a look at the private field on there so if i go look at doozy show debug mode here then i can see that re-enable time let's hit play and go check it out all right so run over here i'm gonna go smack him and there my my reenable time you can see it's going up um okay i see the problem now i know where i'm confused so here let's look at the stumble back let's go out of debug mode and let's explain this real quick the stumble back motion if i select it go over here and click on it and hit play you see that it plays for two seconds so if i drag it all the way to the end it is a two second animation so what's happening is i'm stuck in the stumble animation i'm not able to move out of it or into my root motion because i'm using root motion running or the running part of the room or the root motion part of the running to do the movement so i'm never able to switch out of it but i am able to move again so i have two options i can either um well change the code so that it matches to this animation i could add an animation event or some callback to know when this thing is done um or i'm just gonna i'm just gonna change the field trying to think through like which one i wanted to do i don't really want to go in and add an animation event to all of these for when they should be done so i'm just gonna crank up that time real quick let's go into our scripts go to the player let's make it a serialized field so we have this delay right here our impact delay let's name this underscore impact delay or hit delay hit disable delay disable time i think that that makes sense to me generate a field for it f12 to go to it make this serialize serial s-e-r-i-a-l-i-z-e field there we go and give it a default value of 2.1 it's a little bit longer than my animation we'll move it up here paste it and save now i expect things to actually work and uh work properly all right so run over here punch him can't do anything and now he can move again so he's able to move once his animation is all done bam okay now now he can move again so i've got like i said a bunch of options on the ways that i could do this but um i think that'll work for now now i do want to fix the direction thing so i'd mess that up and it wasn't working yet i want to make it so that he actually looks in the correct direction now let's see how do we do that so look at was not working and i'm not sure why the lookout wasn't working to look at let's just set the forward in that direction so set the forward equal to direction to hitter the direction to our hitter is going to be a vector three so say vector three direction to hitter i spelled it wrong on the bottom i'll fix that real quick equals a new vector all right it's not gonna be a vector three new vector it's gonna be our transform dot position minus our hitter.transform.position and then we want to normalize it and use it right here let's fix the naming real quick we could also just use the dot normalized on it or something but i think that hopefully this is somewhat easy to read this should give us the direction um either the correct one or backwards half the time i mix them up um if it's backwards we'll just switch switch the direction in there oh when do you know when to use kinematics question check um use kinematic when you want to control the object's movement and not the physics system controlling it that's pretty much it so let's see that should why is that not turning this dude oh oh i need to no i'm not sure why why it's not turning him now let's see let's take another peek and see if we can figure this out so he should be getting hit setting his forward through that direction let's just log some stuff out and see make sure that things are happening that i think are happening might be missing something again that happens all the time though so this was kind of the fun part about doing this stream is you see me mess up constantly um but hopefully not too much that we we still got plenty of things done all right so let's see we'll aim we'll clear this log out we'll punch him this is changing this forward something is overriding oh you know i bet it's the uh the animator huh very rarely end up using root motion stuff i bet yep animators doing it okay cool so the direction is opposite um interesting all right let's change this up so let's go to doozy all right let's go into the code sorry i'm thinking thinking in my head and not out loud sometimes i get that mixed up all right first i want to change the um and get rid of this extra log here i don't need any of this crap then i'm going to go down to the part where we take a hit and where we're changing the forward i'm gonna get rid of that log because i don't need it and we're just gonna change the direction here so i had it backwards just move this position the our source position or the thing that's getting hit position and make that the right-hand side of the subtraction that will fix the direction but the other thing i want to do is turn off the animator for a second when it changes direction um i wonder you know let me let me check something real quick i wonder if i just turn off apply root motion on it if that's gonna stop it from turning him real quick so i can just turn it off spin him and then turn it back on let's see yep that's what i'm thinking so let's go into our code again one more time and right here we'll just say animator i am i oh i spelled it wrong down here i called it animtor okay let's fix that ctrl r rename it to animator so i can type again and then we'll say um root motion equals false and then after we set the trigger we probably want to set the truth i'm guessing that we're going to need to wait a frame though um for that to actually work let's try it out but just to make sure my my guess though is that i'm going to need to flip it on a frame or flip it off for a frame turn them and then flip it back on let's see i'm sure there are plenty of other ways to do this but i'm being lazy and quick with it so let's add a co routine to um say start co routine um finish or play hidden generate a co routine for it change that to ienumerator add a using statement for it so hit alt enter and add the using statement that just adds this using system.collections back up there that i removed earlier uh we'll get rid of the private keyword and move these two lines of code to set the trigger and apply root motion true into there and then we'll wait for one frame so the yield return new weight or a studio just wait for one frame so let's really quickly recap with what's going on there so when we take a hit from a player we log that we took a hit so i can see it in the spam we disable our character so we pick a new character or a time that's two seconds in the future for when we can move again and animate and stuff or control our character really then we get the direction to the hitter and normalize it then we turn off root motion change or turn our character towards us and then we play our animation in fact let's change all this code select this whole little chunk hit alt enter and say turn toward hitter now we've got a method that turns towards the hitter and then we play an animation so i think that's nice and simple for what we what we're actually doing i'll get rid of that private keyword collapse that down collapse that down now i've got an easy to read take it that well if it works is nice and simple to manage right let's try it out and see if it works all right so you run around oh that guy can't move yet because his root motion is off let's go turn that on on him doozy i left your root motion off i apologize now you can run around and move looking good all right let's go hit him they punch doozy bam he turns to face me and then takes a step back bam punch doozy takes a step back keep knocking him back look at that all right so it works it's uh it's definitely not very action based and i'm noticing one thing when i pull up and i snap back so i'm gonna do this and i pull up like this and release it kind of snaps back down a little bit um part of that is what's happening there let's go take a quick look and fix it it's on the player when we're doing the update to turn the motion so the in our update here's update method right here we're doing the rotation we check to see if we've pushed anything greater than zero and then we face that direction i just want to turn this sensitivity up a little bit so we have to push a little bit more than zero so if it just goes a tiny little bit down it doesn't turn us in that direction so i'm gonna make this like 0.1 we could always make this modifiable or adjustable or something but i think that that's probably a good number now if you're on the keyboard you're never going to see this happen because you're not like releasing it and having things snap back up and down but here it's kind of annoying so i'm gonna fix it up okay let's see so even now at point one it's not quite enough i'm gonna change this up like maybe i'm gonna go to like 0.25 crank that up but it works well for me um obviously you have to push a little bit further but i want to make it work right on my controller all right so we run around there we go that's definitely looking quite a bit better and i can run over here and just punch this guy and knock it back all right i really want him to go flying back further though these hits are really lame so let's make him actually turn on a rigid body and go flying now let's do that maybe we'll even add in some ragdoll physics and make the ragdoll like get knocked back up in here so flying off the edge i think that that would be kind of fun so let's um let's go back to selecting these dies oh let's go into our project planning first knockback effect um kind of works let's do a knock up now i'm going to say that that was probably about what half an hour 0.5 so let's do a knock up oh should i do a knock back or should i push them off the edge let's do a knock back or knock up because it has a rigid body and it's gonna allow us to like make the player go flying and then we'll do player death once they fly off the edge let's do a knock up attack or really just a knock up on any attack we'll make it so that any attack counts as a knock up and we'll go flying up and backwards so we'll we'll make it maybe an option so we can go between the two different attacks oh drag this over to in progress it's in progress guys all right let's let's go set this guy up so we got doozy and mousey here select them both we'll add a rigid body to them i'll change collision detection to continuous um they're going to move a bit i probably don't need it but do it anyway and then i want to check his kinematic here because i don't want them actually moving oh actually yeah so i guess it's going to change my collision detection mode but i'm going to be changing them um into not kinematic eventually right so we'll we'll be turning kinematic off on them um actually you know what i probably uncheck that is anything about the animator is going to take over anyway so i could just turn the animator oh let's go hit play and punch one of these guys and see what happens before i talk too much and oh that's right this is what happens why is my character flying up in the air interesting okay actually let's check is kinematic that makes sense they're thinking about it more because we've got the animator on with the root motion on i don't want the um the physics system moving them at all right now so i want is kinematic on why is it what did i do here i have broken something okay this is a side effect of me using root motion with it but i think for a second how do i want to address this i i very rarely use root motion with physics stuff so it's a fun um fun one to think about for a second i want to deal with this how do i want to do this so let's see i'm gonna listen to uh let's check check freezing rotation work um no i don't think so i think what's happening is um the animators causing them to move and then oh wait yeah i am wrong is he moving fine now let me stop playing let's let's try again let's uncheck both of these wait is apply root motion on for him oh weird is it a gravity box oh weird okay so that's strange apparently the issue is the what's the gravity scale said maybe the gravity scale on my project is wrong let me set up a um a ball real quick and see if it just falls down i'm gonna do game object 3d object and let's just make a sphere i'm going to assign a rigid body to it and hit play i'm just curious now okay i don't know what the hell is going on there just wanted to make sure that my gravity wasn't backwards but yeah it seems to be falling in the wrong direction and uh it was a little bit confusing i'm not sure what's going on there but i'd also don't need to debug it enough or don't need to debug it and care i'm actually going to turn these into prefabs though because they got extra components on them and it's looking like a mess let's go make a prefab folder real quick and then let's go drag doozy in make him an original prefab and mousey and these were just copy they were prefabs off of the models and um it was a bit of a problem oh somebody's asking if my world was falling nope doesn't look like it i just wanna double check it was a good question though because it wouldn't wouldn't have surprised me if there was a rigid body on the uh on the collider they're making that thing fall um let's see just checking chat there all right so i got my two objects in here i want to make sure that they look good now so i've got the animator the rigid body um everything's unchecked the capsule collider the player looks good and then doozy's got the same stuff just with no controller prefix so i can control them with my keyboard too all right or with my keyboard instead of a controller so that is gonna allow me to let's just double check that i can move around and everything looks good and then what we're gonna do is flip the animator off oh i think root motion's off for that guy we'll flip the animator off and then we're gonna um make the the rigid body go flying so let's go select doozy turn his root motion back on i play one more time i'll run around with wasd step looks good i'll do the attack oh you know what i need to attack mousey and make sure that he plays his attacking i can bump him too and spin let's lock all of the uh rigid body constraints or the the rotation constraints i do want to be able to push them so watch this so now i can run up and i can push him around which i do want to be able to do i don't want to be able to spin him and make him twist around i do however want to make him animate this let's go to his controller and see does he play a takehead animation he does oh i know why he's not playing the animation because if we look at doozy and we look at his animator let's go double click on his animator controller and look at his punch animation we go select his punch this one doesn't have the animation event so the other one has an animation event the animation event is calling up some code right here so it's calling our attack landed in fact let's add a comment here animation event this is one of the reasons i don't like to use animation events often because what happens is you'll set up an animation event and you need to put it onto all of the animations you don't and then you forget and you're like oh why didn't this work and you got to go figure it out every time so i'm going to copy this though copy attack landed we're just going to add it to our animation for this doozy attack so to do that i've got the animation selected select our punch i can just drag out to the part where i think he's like at a hit bam right there right where his fist is extended it'll go down to events expand that out hit the little plus and paste in the name attack landed scroll down and hit apply and now i have an animation event it'll play whenever it gets to that point so when he gets here bam attack landed will fire and if we go look at our code one more time attack landed we'll look for colliders that are in our player mask which right now is anything make sure that they're players and then if it's not us it'll tell them to hit go back in hit play and doozy should be able to punch the little guy now there we go he punches it and kind of works and if i punch him oh that works too but this guy has a longer standing stumble backwards it's not set up if i go to doozy see his stumble back isn't assigned i'm going to expand this out and we're going to take in that stumble back that i've set up for him assign that and now let's try it let's go punch him again there we go that's closer to what i wanted but that bigger stumble kind of going backwards some of these animations are definitely not set up to lock my y position so i'm just gonna go select them all oh i guess they can't select them all at once and i'm just gonna go make sure that blocking in the y position is set for all of them because it seems like something is causing him to go up in the air it probably is this idle or something but we'll get them all checked out going in and checking that root transform y position on all of them and hitting apply clicking on another one by the way just kind of brings it up so i don't have to hit apply the lazy way out all right select select this one doesn't have it make it in and again normally i don't use the root motion stuff but this one seemed like an interesting project where it might make sense and some it just really depends on oh i don't want to check that box it depends on the game whether or not it's going to make sense for you all right so now we've got our animation set up i can knock them back um i think yeah oh that's right let's go into making the knock up artwork the physics part part that was actually next on my list so we'll go into the player and when we take a hit um from the player i'm just gonna assume it's a big hit at first so we'll turn toward the hitter and then we're going to launch up in the air we'll say launch backward alt enter generate a method for it and to launch backward what i want to do is turn my animator's root motion off so we'll say oh which is actually already off now right so actually let's take this line of code i'm going to cut it pull it right up here that is outside of turn toward hitter because both of these things really care about that i don't want to just limit it down into that one method so we'll set it to apply root motion to false before we launch backward and before we turn towards our hero return and then we'll go flying backwards by saying well let's get our rigid body we'll say rigid body dot let's actually get a reference to it so i'll copy that we'll go up to our awake which i think is an expression body method alt enter and convert it back to a block paste and say get component here's your body oh man alt enter to generate a field for it and we'll get rid of that private keyword i've got the clip the rigid body is still on my clipboard so down here we'll say rigid body that is kinematic equals false and then we'll say rigidbody.addforce and we want to go vector well let's make a variable called force we'll say force and we'll go up here and say vector3 force equals and we want to use up and our backwards so we'll say transform.back or transform.forward well let's let's do this let's say transform.no vector3.up i like deleting and deleting and deleting minus transform dot forward it's the least amount of code to write it so the direction that we want to go is upward and backwards so the opposite of our forward that's why we do the minus now that's going to give us just that the up vector and our forward vector it's really going to give us the direction so we want to multiply this by some launch force so say times underscore launch force now add that field so i'll hit alt enter generate a field f12 to go to it and change this to a serialized field that's a float serialize field float and we'll give it a value of like 300. i'll drag this up here or move it up there okay paste it and then um oh fix my spelling there there we go now i've got a launch force that'll allow us to launch this character up at some velocity um and make them not kinematic so they'll they'll actually use the physics system go flying up and then eventually they're gonna switch back into playing their animation um or they'll go into play animation what's gonna happen it's gonna almost instantly start going back to that so let's turn that off for now let's disable the co routine that kicks off our knock back or our falling backwards animation or that's not worth falling back it's our uh our stumble backwards let's hit play and try it out now i expect to see do not really animate it but just kind of go knock back and flying backwards see come on go flying backwards bad guy bam look at that looks great right except he is not falling because he's not using gravity so let's check use gravity and uh let's try that again so let's go back to the code and make it so that he actually uses gravity so go to our rigid body uh use gravity equals true and we'll go back into unity and try that again it was a good question by the way i saw it in chat too do you have to turn gravity back on bam so we launch him up and there he goes he goes flying off the edge and that's kind of the goal that i want now i think that that was probably too much of a launch but i've got a field here so i can adjust it let's go in here and just turn this down maybe make it 150 which is going to be quite a bit less of a launch but i think that's closer to where i want i want to be like hitting him really fast and a bunch to be able to knock him down right bam i knock him and he goes flying knock him let's see he goes flying again now my thought is like maybe once they land they could play the animation or maybe i'll make him play the animation um while he's in the air let's try that let's try making him play the animation but without turning on root motion until the end let's say yield return new weight for seconds i don't want to wait for seconds real time we'll just do wait for seconds and we'll wait for two so let's try that out i just want to see what this looks like i assume it's gonna look a little bit weird but um we'll try it out anyway run over here and smack this dude bam um yeah that was pretty terrible but you get the idea he's going up he's launching and falling so what i want to do now is grab like a falling in the air animation let's let's go to miximo again here's my miximo window it's over here somewhere close out that window and close out that one and we'll bring this over here don't want to use doozy i lost my window come back come back chrome there we go all right everything just minimized on me that was nice um i don't know what happened to that window okay we'll just go back to miximo and then we'll go two characters and we'll go to doozy again let's get this back in the screen in the right spot that's really strange all right so we'll go to doozy who is i believe on the bottom of the first page switch to that guy and now it's like i said i want to get like a falling back or like flying backwards so let's search for falling and go oh gotta go to animations if i'm like is there one where he's like kind of like flying backwards um like in the air but i want to find like a a flying back there gotta be something or i might want to search for knockback too let's see what we can find but important by the way like when you're working on these things and you're like looking for these animations and stuff um don't spend too much time trying to find the perfect one right it's very easy to spend like hours or days going through animations and getting things set up and like just really overthinking it and then you realize later that you're not actually going to use any of that stuff like you may change characters may change the design or something else when you you really want to like polish the stuff once you're kind of at the point where you definitely like the game and and it's working right um that'd be a good falling animation though and i don't need anything that's like great i just need something that's um something that'll work right like a knock back or like it um that looks pretty terrible i i want something like yeah we're like tipping back and flying backwards do we have anything like that is that an option anybody make a good animation for that jumping down in i don't know getting thrown oh that's an interesting there's so many interesting animations that makes it hard to like not just jump off and start doing something else too so let's see there's got to be something um you know what we're going to do a ragdoll screw it why do all this when i can just rag doll it up instead so who wants to see a ragdoll instead i think that'll be probably more fun and it'll look better so let's do it um we'll create a ragdoll for doozy so i'm going to save this off and uh what i want to do is create a ragdoll by going to game object and 3d object and choose ragdoll gives us the ragdoll editor and what i can do is just assign all of the parts of doozy so i'll hold alt expand him out and get all of his bones right here gotta hold out when i click to expand and just auto expand everything out and we'll just assign out his body parts so let's get this ragdoll editor over here and then hit f on the hips zoom in go find them and that looks about right so hips looks like his pelvis i think that's good let's find the left one that'd be the left upper leg right there it looks good we'll assign that to left hip and then we got left knee is going to be the next one down there and then left foot is going to be the next one there if i click on them i can double check that they're right and it's always a good idea to click on them and make sure that they actually are the one that you think they are sometimes things are named bad let's do the right side right leg right knee right foot and then we need to figure out where the arms are so we've got well actually here we've got spine right now so let's do the spine next so we've got middle spine and head are the two pieces that we need that looks like my middle spine so we'll sign it right there and then let's go find the head which oh actually i guess we've got left sides now so let's go find left shoulder which will probably be the left arm if i click on it uh that might be it maybe i need actually let's go with left arm left arm is looking like the right one there and then left forearm is that elbow and then we'll collapse these down i'll just a little minus there and there there we go we've got head we'll sign the head right there flaps down the neck and then we'll find the right arm and right elbow which was i believe the forearm we can click on these to find them now your characters are gonna be like buried a bit if you use a different character might not match up exactly but with this mixed mode character set up now i just hit create and a bunch of magic happens you see that i've got character joints now i've got a rigid body um and we've got just a bunch of stuff going on what's actually happening is it's created an entire rig for this guy if i select them let's go up here and select the base he's got a whole bunch of different colliders on them so we've got a bunch of little colliders here for his body parts and these are definitely not perfect now like that glider should be down that way i just don't care enough to perfect this guy but anyway he's got a bunch of colliders that are going to allow the dude to kind of go flying off and animate as a ragdoll and then he's got on him a bunch of joints too so you'll see that if i select the different body parts here there are character joints that are set up linking these all up together you don't have to do it all yourself so let's hit play see what happens okay let's try that again let's stop playing let's hit play again and let me see he's just kind of going off flying but what's actually going on here is if we expand this out it has all of those quiet now why is going flying off i'm still not completely sure something to do with that animator and the collision i i'm not even interested in trying to figure out what causes but i do know that what i want to do is really just turn off all of the um the other rigid bodies on this character so if we look here all of these have rigid bodies that are all set to use gravity i want to turn that off for all of them and make them all kinematic and then we'll just turn them all back off to not kinematic and use gravity once the character is flying and falling so we'll just write one little bit of code in our player for when we go flying so when we go flying we launch backward we're going to add force we're setting our rigid body to kinematic and our in our gravity field but we really want to do this for all rigid bodies that we have so we're just going to cache all of our rigid bodies so i hit f12 and where we're caching our rigid body here in a wake i'm going to cache all of our other original bodies i'll call these our ragdoll rigidities in fact let's see am i using any other instance of the rigid body i am i'm using it to add force to that one main one um yeah let's do it let's let's make it all rigid bodies so we'll just turn this into an array we'll rename this to rigid bodies ies and we'll change that to components and that'll get all of the components honest but i want the ones in children too so i'll change it to get components in children copy that scroll down to the part where we use it let's say for each var rb in rigid bodies we'll make this a loop loop through them and we'll say rb dot do that so i'm going to hold alt and select that area and hit type rb and then paste here and do or double click there and do rb as well that should just set up all of my rigid bodies to do the same thing so all of them will toggle on and off at the same time and they'll add force um to rigid all the rigid bodies at the same time too and the character should just go flying let's try it oh i need to turn all of those off by default so let's go into the player and let's go um actually let's say let's let's make this a method here so no i'm i'm just going to copy this little bit of code i'm going to go up into my awake i'm going to paste it add in a closing brace shift tab and then we'll just invert this is kinematic is true and used gravity is false on a weight so when we start the objects up um and this is really going to be like our toggle into player control mode so i'll i'll just pull that out in a second let's run over here oh what's going on with this dude this guy run okay i've apparently messed all kinds of things up here bam i knocked that dude off though and he went fine but uh let's try that again let's run this guy over here definitely gotta work out this uh rigid body animator stuff but first let's go knock this dude away i haven't got a clue what happened to him all right now we're going to turn off root motion because this is just killing me and it's it's too much of a distraction here and it's really just not very helpful so i'm going to uncheck the apply root motion option on both of my animators save we're going to go into the player and we're going to make one very very simple change so we'll go to our update and where we're setting our run we'll keep doing that but we're also just going to do this we'll say transform no we'll say let's get our main rigid body here so let's get our primary rigid body rigid body equals get component rigid body so we still do want to we want to have all of our children rigid bodies but if i'm going to move with the um the primary one then i'm going to add that as well i'm gonna add a field for it we'll just generate a private rigid body field copy that we'll go down into this movement code or the update after we set our direction so we turn towards the way we want to face we set our run animation i'm just going to move our character so we'll say rigidbody dot um we'll use velocity we'll say rigidbody.velocity since we're in update we're not in a fixed update right now and we'll just set it to the direction um and i'm not going to give it any speed right now let's hit play try that out real quick and then knock this dude back okay am i moving at all let me see did i miss something i must have missed something let's see what did i miss here so my animator is not set up to root motion cap oh freezing is oh his kinematic was on wait okay so animator is not on let me check this out let me figure out what i've done here i've definitely messed something up right i've got my rigid body here i'm going to turn everything off on this character because i don't know what i've done here i know i did something small and stupid and broken so my animator is there i'm going to turn the animator off i'm fine turn the player on fine and the animator on by itself seems fine and the player on and the animator seems fine okay turn just player on and move nothing turn the animator and player on and move nothing okay why is it not acting weird though like oh stop playing player on is kinematic oh okay so i'm messing all kinds of things up so in my awake i'm toggling all of these i'm gonna undo that for now no i'm going to do that and then i'm going to set my main rigid body we'll say if rb is not equal to rigid body then we'll do that because i don't want to do i only want to do that on the the ragdoll children here so i only want to turn off all of this stuff on the ragdoll children and then i want to leave the main one moving around so i can control it with physics so i want to make sure that my main one is not kinematic and is using gravity rotation is frozen and i should be able to now move it around with um interesting uh yeah okay let's play again and see if that happens again okay let's figure out what's going on here let's uncheck use gravity okay that's not that that was an odd one um let's uncheck the capsule it should just like fall right like theoretically the dude should just fall fully down oh but i'm resetting the velocity every frame so if the velocity is direction is that the y is zero that's normalized what is going on here let's see debug dot actually you know this is a value that i think i can just read in the inspector copy that and paste it up here all right we'll go figure this out play dude move that there okay so let's check the colliders here and see if it is maybe one of these other ones so uncheck i'm going to turn off um oh wait does not have headers where's the collider component okay because they're all different i'm going to just turn all of these off real quick double check they shouldn't be oh yeah i need to turn off all these colliders too it doesn't make sense what am i thinking let's just suzy selected he's got his capsule he's he's also falling really slow like something else is oh yeah that's right i'm resetting his velocity every frame that's what's messing up that makes sense okay there we go yep okay so the with the colliders turned off there we go looking better okay thank you everybody for holding with me and uh reminding me of things in chat cause it really does help it's very easy to just get mixed up and uh lose track of what you're doing and uh how things are supposed to work so here we go run over here we'll go smack doozy bam and he'll go flying back a little animation pop back up and keep knocking him back knocking him back and i expect eventually there we go knock him off the world looking good all right things are getting better all right let's set up some deadly ground now something to kill the player make it so we can get um i guess a little bit of a challenge um and like a score and and like a gameplay loop system so let's do that next we'll make it so we can kill the player set up a game play loop and uh keep track of points and stuff and have a little timer there all right before we do that though make sure that if you haven't already hit the like button and subscribe that you just go do that please really appreciate it makes a big difference and it helps a lot or just share the video out somewhere all right let's clear out our filter and get to work so we need a deadly ground piece something that will kill our players i'm gonna go create a new plane or let's go with a cube we'll make a new cube we'll reset the position i'll drop it down by like one meter so negative one on there scale it up to 100 on the x and 100 on the z and then let's make this into some sort of a lava now i'm positive i have some sort of a lava pack so let's just search for lava and see what shows up so we got lab interior let's see a lava flowing shader that looks pretty old though let's see what else we got mushroom land actually looks kind of like a cool map but not really what i want um let's see what else we got textures i'm going to find one in my asset packs and we're gonna pull it in here um see wall textures substances cartoon texture i guess i could use the water from the cartoon pack that's always one of my favorite ones um yeah we'll just do that use the cartoon but we'll use the water from this cartoon pack instead i would like to use lava but hey no it's not a big deal oh by the way the issue before with the character flying up is just um colliders and the colliders were hitting um they had their own rigid bodies and that makes so their colliders can interact which totally totally spaced on there if they didn't have their own rigid bodies they wouldn't have hit it because they would choose they won't um but yeah they shouldn't collide with each other maybe they will i only won't fire the message transition position all right let's um shut up and start importing art or setting up our art so i'm gonna take cartoon textures drag it into my asset packs folder after importing it and we'll go into the scene view and we'll just go find our material here oh oh beautiful this actually has lava so i'll just take the lava cracks bam drag it into there and it looks terrible go to the game view and let's set it up with some tiling so expand this out we'll set the tiling to probably match my size 100 by 100 and i think that's probably too much let's go to like a 25 by 25 there we go um i mean i'll go 50 50. now i've got some lava there that should light up and uh make the scene look a little bit better let's try that all right looks more dangerous more deadly um it does feel like i'm kind of high up off the lava oh see i guess i kind of am right see how far i fall down oh i can't fall down yet because my rigid body isn't there to um my rigid body is not set up or enabled to make me fall let's knock this dude off bam he fell to his death if he didn't die so let's make him die now so we've got this lava here and it's just a giant cube let's go take a look at it big giant cube probably way too big in fact but i'm going to leave it giant because i don't really care and it doesn't make a difference what we want to do now is set up a collider for it or a trigger really because i want it so that my players fall into it they don't stop on top of it they're just going to fall through it and they die and poof and go back so i've got the cube selected we'll just check the is trigger box and let's rename this to lava save it off and then let's add a lava script go to my scripts folder right click hit create make a new c-sharp script call it lava and then we'll select the lava here there we go and assign the script to it double-click on the script open it up and delete out the start and update and we're just going to add an trigger enter so on trigger enter we want to look for a player so say var player equals other dot get component player the other is going to be the collider that hit us we'll say if player is not equal to null so if we actually hit a player then we want to just kill the player so we'll say player dot die now we don't have a method for it so we'll generate a method i'll hit alt enter and hit generate method and we're just going to clean this up by deleting out those unused spaces or unused statements that use or unnecessary private keyword and the extra spacing there save it and then we'll go into our player method for our player script sorry our player script now should have a die method in it does it yep there we go it's actually added it right to the top when i generated it i hit alt enter to generate it and then generate it there i can hit f12 to go to it too and it's going to give me this method that's going to allow me to kill a player now to kill a player um i'm going to start by just resetting them to their initial position so say transform position equals starting position we'll save off a starting position or generate a field for it alt enter to create a field and enter again to just generate it now i've got a starting position and in a wake i'll just cache it so right at the beginning of a wake i'll say starting position equals transform.position now whenever we fall into the lava our players should just reset back to home pretty simple i mean that's essentially what happens right the character resets the home the other person gets a point and some some visual effects play or something let's just run this dude over here he moves way too fast let's speed these guys up first let's go into doozy and mousey let's open up the player script let's give him a movement speed so right now we're moving him with setting the velocity with velocity is equal to the directional state direction times underscore speed hit alt enter generate a field f12 to go to it it's always going to give me a vector 3. i want this to be a serialized field it's not a vector 3 but instead a float so i can just make it a simple multiplier i'll give it a value of 3 and then cut it and move it up to the top here now i've got a floating variable or a floating point variable or speed that i can adjust in the inspector i can control how quickly that moves i'm also going to move this die method down to the bottom and clean this up a little bit so nobody has to look at ugly unorganized code there we go we'll move that down here and i'll even rename this or not really rename it but change the modifier to public but it's more obvious for everybody what's going on all right we'll go back into unity now i have a speed of three my characters shouldn't move around like little slugs and it should be oh there we go that's more like an actual game right i can actually move my character let's run around here and knock this dude into the lava oh he didn't go flying get out there get in the lava family died and he reset looks good so um my mouse is a little bit crazy so far things are kind of working now i think i want to set up uh actually let's save let's look at our project management stuff real quick and reevaluate and then figure out what's set up i've got a couple ideas but i think that we should look through here real quick first and then decide so go back into hacking plan knock up is down that felt like it took like an hour i don't know and then player death is done and that took what like point one like six minutes some something small right so we've got audio bots and points that i want to add so let's add point score and let's add a uh timer those are like the the main things that i want to and i want to add in like a countdown timer you get as many points as you can and then um score so you actually get points so i think i want to do those first and then maybe jump to bots after bots will take a little bit longer the other ones i know i can knock out relatively quick so let's get those we'll go with um scoring system first so players can just have a score associated with them there's really no reason to do anything other than that just add in a score that's on the player whenever they kill a player so whenever you make a player die um that player will assign you a point right so wherever we want to do that i guess it'd be when we die we want to say underscore killer dot add point we're going to add a point to our killer whatever thing killed us i need to assign or actually let's not call it killer let's call it last hit last hitter that's really what it is the thing that hit us last we'll get a point for taking us out so i'll copy this last hitter and let's assign that when we turn towards a hitter so we turn towards the hitter let's do it before we turn towards so right up here before we turn towards the thing that hit we'll say last hitter equals hitter and then we'll hit alt enter and generate a field for it now we'll keep track of the last thing that hit us and then if it was oh it's going to be whatever player whenever that player hit us um they knock us off and we die and then they'll get a point um when we respawn we probably want to reset that last hitter to null so when we say what after we die we'll reset our last hitter to null that makes sense so we'll give them a point and then we'll reset the null let's open up our create ad point by generating a method there alt enter generate method and the add point method could just say score plus plus get rid of the private keyword or hit alt enter generate a field for it so i'm gonna go generate variable and pick property hit f12 and we'll yeah actually that's good it's an integer it can be set public or privately and read publicly so we've got a score now it can be read um yeah read by anything else and then set by us i want to add in a little ui element so we can see our score and then we can just make more players and be able to test this out let's go in and create a ui we'll go to game object ui and we'll choose text mesh pro text so import tmpa essentials which is just the stuff that you need for a pretty looking text in unity if you want to have text that looks nice this is the important part and then i'll import in the extras too just in case i decide to use well how's everybody doing in chat by the way hopefully everything's going good and nobody's getting lost and things are able to everybody's able to keep up and kind of get an idea of how they would build out their own game i'm going to rename this to player one score and then i'll switch into 2d mode hit f and then let's zoom out a bit and get these positions so this is my screen right now if i go to game view and change to standalone or i'll go to 1920 by 1080 go to my scene view now you'll see that the canvas looks a little bit better it's what i want to do first go to game just change this to 1080p essentially i'm going to go to scene view make sure i'm in 2d mode we'll dock this one to top left player 1 will be top left alt and shift here when i click to move it and anchor it and i'll set this to 0 0 0 comma or let's just say 0 and make it like one big score this would be my text value for how many points you've got i want to make this much much bigger though it's tiny and this is our score it's really the only thing we have so i hit auto size grab the box and drag it until it gets bigger and then change the max to be like 300. so that way it'll auto size up to my box size oops grab the wrong spot and then it'll get up to 300 by 300 i think 300 is probably a good size and i'll drag it out to out here duplicate it and anchor this one to the top right and this will be player two player two score and then we'll just anchor or align the text to the right so hit the right alignment here got my right alignment setup i want to add in a player score ui element or a script that will work so that we can assign a player to a ui element and just have it update to its score constantly we're gonna do this relatively quick and simple we'll just make a sloppy little one that just reads the player score that it's associated with and just updates it every frame if it's changed or something we'll go to create c sharp script call this player score and then we'll assign it to both of these two player score objects add it on there and then double click on it to open up the script and then in awake say awake text underscore text equals get component and we'll get the tmp underscore text that's our text mesh pro text object go over here and hit alt enter and add the using statement for it then i'll enter on the text to generate the field for it get rid of my private keywords extra words there and then in our update um the easiest and sloppiest way we can do this is add a serialized field or a player and call this underscore player and just say underscore text dot set text underscore player dot score dot q string now obviously this could be improved on but right now it doesn't make any difference and our code is going to be fast enough that it's really we're never going to if if i improve it it'll look better and somebody might recognize it and realize it but you're not gonna see the benefit here so i'm just gonna do it this way um that you don't think that there is a benefit in this little throwaway project of switching over to an event and keeping track but spamming up the score is going to be totally fine in this case um again throwaway project not worried about performance and not worried about going on to other devices um so run over here we'll knock them up knock them up knock them up knock them up and well it's not gonna work oh wow i don't know what i did there not quite the intended behavior but the problem here though is um i never set up these player score objects they don't have players assigned so even if i did kill him i wasn't gonna get points so let's go select player one and i'll assign that to mousey select the player two score and i'll assign it to doozy and this isn't allowing us to do character selection but we could always change up the way that we bind this later not very hard let's knock this guy back here let's move him i'm going to run him over by the the ledge here and then i'm going to go give him a punch bam falls in and i've got one point let's go knock mousey off now and see if doozy can get a point oh mousey goes flying and doozy gets a point so so far i think things are kind of working i mean gameplay is definitely not amazing by any means but oh except for the getting up so after they get up from getting knocked down they seem to act a little bit weird so let's um let's go through this a little bit and see if we can figure out how to clean that up a little bit and then i'll add in players three and four if somebody was asking if there's a benefit to using tmp text over the yu gui version of it the only real benefit is that it's the base class so if you use world space ui elements from text mesh pro or ui ones you can switch back and forth the code uh the code will work for both of them without having to switch it essentially that's the main thing that and it's a little bit shorter text so you just have to write um that's the main difference okay let's go into here again and take another p here so we've got the player moving around and when they get knocked up so when this guy gets hit let's take a peek at him he's got a ridged body they use gravity checkbox gets hit when he gets knocked up right so when you start playing it's off i remember right oh no but he's not shouldn't it be kinematic from the start no that's right i'm using velocity ah okay that's right he'll play he'll move at his velocity and then when he gets hit oh that's right i'm not switching this kinematic anymore i forgot okay so yeah actually it seems okay he gets hit and it's all good animations are not perfect then we could play like a a step up animation or something but we don't we don't have one right now now the one issue that i have is like if i run off the edge i don't fall and that's a bit of a problem it also is a bit of a problem when i knock people back because they're not going to fall exactly right so let's go fix that let's go into our player script and we need to make one more change and the movement when we're setting the velocity if we do movement this way there are a bunch of different ways that we can do movement we can move the position and we can set the velocity we can add forces we can use root motion where you saw me struggle earlier but what we need to do is make sure that when we set the velocity if we do it this way we don't overwrite the y velocity so that way if i'm flying up or down we don't control or we don't change that that movement at all so we keep falling down or we keep going up so we're going to add or a little bit of a change here and we'll say that um this is going to be equal to a new vector three or or actually let's just do this we'll say direction dot y no we'll do this we'll say var velocity equals direction times speed let's see what we're going to do in just a second and then we'll say velocity dot y equals underscore rigidbody dot velocity dot y um and then we'll say rigidbody.velocity equals velocity so let's just really quickly evaluate what this is doing i got rid of that extra line here so we're going to create our velocity by getting our direction multiplying it by our speed so if we're going forward at 10 meters a second it's going to be 10 on the z and 0 on nothing on everything else right assuming that's world space whatever it is and then we're going to read the y from our existing rigid body so if we're already falling we'll keep that following value if we're already going up we'll keep that going up by we're not going to modify our basically our y direction at all our y velocity and then we just set the velocity to that modified one let's try that one more time but it is important to make sure that i um normalize the direction before resetting the y otherwise i'd be messing it up using the wrong y now i should be able to knock him up and he just kind of goes flying off a bit oh i'm not sure what he hit there he might have hit a ledge um what's happening let's stop playing go take a look at doozy so doozy is actually hold on let me run this guy off the edge real quick and make sure that it did not work so my code didn't work to make him fall let's go take a peek at why it's not working to make him fall so on here he oh he has to use gravity on check let's check he's gravity bam now he falls let's stop playing i want to recheck that mousey's check for change worked real quick and then we'll jump over to doozy so he should be able to run off the edge fall and die let's check the doozy can run off the edge fall and die and then we'll do the knock back thing one more time looks good okay we'll run over here and let's try this one more time i'm going to get this dude over to the side run over here and punch him and he goes flying so i'm not sure why he was bugging out let's see if i punch him a couple times maybe oh now i fell off okay i don't know it seems like it's working okay and i'm good enough with it so i think now what i want to do is add in some more characters let's get in two more characters so i can be uh four players i'll have it ready for going over to the arcade actually let's look at our project plan one more time i've got score here bam that's done let's add the timer first and then we'll um we'll add in more players so let's go to time next that seems like the next logical step to add in so let's add in a timer ui or a timer element so i'll go to canvas ui and text mesh pro text switch back to 2d mode hit f and zoom out and then we'll anchor it to the top middle like that so alt shift hold that and click right there zoom out with the mouse wheel i've got my time variable right or my time text i'm gonna set this to zero colon zero zero and then crank up the size we'll hit auto size make that like 500 on the max and then just drag it until it looks like a size that i like i want it to be i think bigger than my score text but i don't know how much bigger maybe i like that let's re-center it so i'll shift click it again get it in the area and then i'm going to click on the center alignment here got this nice big text and let's change the font too i'll change this to be like a drop shadow version of it or let's go with um do an outline there and then i'm going to change these two player score texts let's switch to a different font i'm going to go to like the go to the number the digital display look which one is that electronic highway we'll do the electronic highway for our scores and then this big text for the timer rename this to timer and then we'll add in a script for our level timer and we'll add that to our timer code or our timer object right here and i think i'll probably just leave the control on this ui element temporarily like i said pretty much throwaway project and just going through the motion so i don't think that it's worth setting up a whole game management system yet uh if it gets to that point maybe we will but now we'll just add a level timer right here we'll give it an amount of time serialize field um call this a hint um seconds per level and i'll default it's like 60. so i have like one minute matches um let's see on enable we'll say that start time equals time that time just in case we end up enabling off of or going through more than one level at a time we'll generate a field for that it'll keep track of the time that we started at in seconds um what else do we want to do in our update we want to update our time remaining so let's get the time remaining field i'll say underscore text equals get component pmp underscore text add our braces and add the using statement alt enter and add the using there alt enter on the text and generate the field for it so we have our tmp text and in our update we'll say text dot set text and we'll set it to seconds remaining now seconds remaining is going to be in it so we'll say in seconds remaining let's get that up here bigger and it's going to be equal to time dot time minus our starting time right let me see no it's that's that's our elapsed so that second's elapsed is this say end elapsed equals our that time and then we'll say it's equal to our duration what did i call that our seconds per level minus elapsed there we go so that should give us the value that we want we'll just convert this cast it to an int let's do convert dot 2 into 32 instead of instead of a cast why not well you add the using system statement there so it added using system there so we can do the conversion and just do a convert we could also cast it but i felt like doing a convert so here we'll get the elapsed time we'll figure out how much time is left and then we'll set the text to that amount of time and we gotta to string it so that it or so that it works all right we'll save that off oh i'm getting hungry that's not a good sign then we'll jump back into unity check our timer here hit play and see if it just starts counting down i expect it to go 60 59 yep 58 57 and so on it's way too big though i think so i'm going to shrink it down go to the timer size and um let's stop playing zoom out a bit oh yeah that's let's scroll that down do something like that something a little bit more reasonable hit play and watch it one more time all right so now i've got a timer that'll count down let's make it so that my timer ends my level or restarts the game and the easiest way to do that is say hey if the seconds remaining is less than i'm going to make it less than negative five teen manager dot load team zero now if you're wondering why i was making it negative five just so i can watch the value go negative no real reason i just wanted to see the time go down below zero like the match ends is that zero and then um it should probably be zero and then do something else let's just go knock this dude off the edge though bam i still don't know exactly what i did to make that happen but it does make me happy so i don't really mind too much let's run over here and knock this dude off boom see he's got a big push big hit um looks good now i want to make a couple more changes though i think um i want to put in players three and four and then give these guys a little bit more control over their attacks so that they're not all the same attack and that the impact isn't determined based on the person getting hit but instead based on the person doing the hitting so i need to put in two more characters in our game so i'm just going to go back to mixamo real quick and we'll grab there were two other goofy looking dudes let's just go grab them real quick so go into the characters section and i'll go down to i oh here we go there's mousey there's doozy let's go to page two they're like two big headed cartoon guys timmy there we go grab timmy let's find him with a t-pose switch to the t-pose animation we'll download timmy make sure that he's on fbx for unity and download and then i'm going to go back to characters and there was one other dude that kind of looked like this guy oh i want to put this into a timmy folder new folder to me and save and then let's go find that other guy um there's one other character that kind of matched this theme of a dude not that one it was like one of these big headed guys i think it was on page three all right there ty timmy and ty two giant headed characters download those two and let's put this guy into his own folder and i really wanted to use these guys so they all kind of match that same big headed character theme um i feel like the animations will map a little bit better and if i try to mix it up i thought it might be kind of cool to mix in some of these other characters all kinds of like fantasy ones and horror ones and stuff but you can always just put those into your game it's easy to do you see the process it's really not any different just take a little bit more work figuring out the animations probably all right so let's set these both up as humanoids i'll select them put it here choose humanoid hit apply let it create its own avatar and do the same here humanoid oh did i do it on him already i didn't select him select him the humanoid hit apply all right now we're gonna assign well let's create these characters let's i've got doozy here and i've got mousey here let's grab my other two guys um i'm going to actually let's go to timmy i need to export my stuff for so good materials extract the textures hit enter and then we'll hit extract materials and get those set up so that he looks right and then we'll drag him into the scene we've got timmy out here go out of 2d mode oh we'll hit fix on that normal map and hit f to zoom into him i've got timmy here and timmy just needs to be set up just like doozy and mousey i'll rename them to timmy we'll go select the things on doozy and mousey so we've got a capsule collider a player script and a rigidbody and an animator just copy them all i hit copy component go over to timmy and right click and hit paste component values oh actually that just pasted over that component value instead of pasting a new one i'll go back to mousey got a rigidbody with use gravity and those checked i'm just going to copy it so i don't have to remember the component values and we'll paste it over here and here we've got use gravity and the freeze is checked we'll go back over to mousey again let's take a look he's got a capsule slider that i don't need to copy and then he's got a player script that one i'll just copy and paste it over so i can have the same values so paste in right here and then add a capsule collider and we'll move the position of this up to one and the height to two that's too big so we'll go to like a let's see point eight now let's go to point or 0.6 and 1.2 on the height that's too short we'll go to um i guess 1.6 and 0.8 on the y there we go now i've got a character that looks about right so i've got this dude this is timmy and he should be ready to roll except we need to select his avatar so we'll select the avatar box right there and choose timmy which is oh my which one is timmy jimmy where are you i don't remember which one you are um i don't think you're that one let's go check let's go find timmy let's go select his avatar oh it's ch14 okay it was one of those i just missed the name so go select it again go look for ch14 and it's um non prd that's a terrible name for it okay i should i should definitely rename that something else but that's his avatar file all right we'll save that off let's rename this to kimmy and let's just double check that actually is a is it timmy dropkick no it's timmy idle let me t-pose so there we go we'll name him timmy t-post all right so now he's got the timmy t-pose avatar let's hit play and see what happens you see he's standing there and he runs around and he's playing the mouse's animations i hit the attack he'll play the attack animations because i'm using that controller he's just going to use the same animation and because he's a humanoid they're just kind of targeted at him and i can run him off bam i've got two players in here i'm going to set up the fourth player now or two players have three really gonna set up the fourth player what's the error here oh last hitter dot add point so if i run into the lava without having anything that hit me i can't add a point to it so let's just add a question mark there the reason for that is that last hitter is not set so if i don't have anybody set up to give me a point then or to give a point to then i don't want to give them a point in fact what i should do is instead say if we have a last hitter let's do what games usually do say if last hitter is not equal to null then we'll set the last hitter or give them a point otherwise we'll say remove point and we'll just remove a point from ourself so here to remove a point we'll just subtract one from our score this is score minus minus now right now these score calls seem kind of extraneous i might want to get rid of them and strip them out but i'm going to leave them in for now just in case i decide to clean things up and actually make this more event-based now if i run off the edge i shouldn't get an error and i should just lose a point let's try that out real quick bam now yep i lose points and now i want to set up that fourth character so let's go set up tie i actually i think i already downloaded him right let's go into the project folder go to tie go select him we'll go to materials we'll extract textures enter and then we'll do extract materials enter and then we'll go select i and drag them out into the scene looking good ty we'll add a rigid body just like before we'll check the freeze rotation boxes add a capsule collider we'll set his height to oh he looks pretty tall we'll give him a height of two and give him a default oh sorry a height of two and a center of one there we go ty you are very tall compared to everyone else drag in his collider just a little bit on the radius then we'll add a player script up not a playable director let's remove that we'll add a player script and then on the player script we'll set the player mask to everything i probably should remove that code now and then um i think everything else looks good ty's tall though so let's make him even faster it's going to be the fastest one we've got so no controller set up so he should just oh he's just gonna sit there he's assigned to this guy so you see he's running around but he's not animating this is off of the keyboard so let's make it so he runs with the uh or he animates right so to fix that up we need to just give him an animator controller i'll just go select mouse or let's let him use doozies so he used doozy's animations instead of mousey's animations there we go now he runs and he attacks like doozy and this guy runs and he attacks like mousey because he's using mousey's controller and these guys should be able to run around and knock each other all around and i can control two guys at once yep and i can run them off the edges and things just kind of work i don't know so far so good i'm able to knock my dudes around i want to add in some scores though for these other guys so let's go find player 1 and player 2 score hit f and go out into 2d mode i'll duplicate them i'm going to take player 1 and change this to a3 get rid of that extra text there anchor this to the bottom left and let's assign this to uh tie i will get this one and then this guy would be renamed to player four score and we'll get rid of that space there we'll assign this to timmy all right now i've got my players i've got everything set up i want to clean up this organization just a little bit let's um make a folder for my camera so create an empty folder call this camera and let's reset the transform here i'm going to take my main camera i'm gonna take the v cam here and the target group and just make them all chilled um and then i'm gonna select my environment oh my environment is like one object right or two objects let's create an empty object for this called environment we'll reset the transform of that and then we'll take the lava and we'll take the grass here and make those children of that and then i've got my players right up here at the top i'll rename tie to tie we'll go into our prefabs folder make tie into an original prefab and we'll make timmy into an original prefab i'll save everything off um and i think we've got a relatively functional game i'll move that around clean things up hit play and let's see if everything just kind of works as intended or if i've missed anything yet so we do need to add in input controls for our other joysticks real quick that'll be easy to do before we can get it on to the arcade um oh but i did say i wanted to change up the attack type too the attack damage i kind of like having two players on one controller by the way and if you've lost track of how we did that or were kind of curious and didn't understand it the first time the way that that works if we just look at our player script here so let's find not a canvas go select one of the players these four at the top are our players now but if you look here i've got this controller prefix and right now mousey and timmy are using p1 which is set up to be the player one controller i also have one assigned or set up as player two but if there's none assigned then it's blank it's using the keyboard and the way that that works again edit project settings and then input input manager here has a horizontal and vertical these are like the default ones for keyboard wasd then i added a p1 horizontal on the p2 horizontally use the joystick and then for the fire buttons we use the same thing except instead of setting the joystick we have to put the joystick number so let's set up joysticks four three and four real quick and then set up the attacks and then i think we'll wrap it up and i'll start getting this on to an arcade system so you guys can see what it looks like played onto an actual arcade so let's duplicate the p2 horizon i'm going to stop playing first duplicate this p2 horizontal and duplicate it one more time we'll make a three and four and this will change to joystick three and then this other one is going to be four it's going to change to four the way that this works by the way is on the arcade system the controllers that have got set up and they're essentially work like a usb controller and a joystick so be able to see them as a controller just like a playstation controller the only part that's a little bit off is the um the axis is probably going to be different the axis on these will actually be correct instead of third axis it'll be the um the y-axis i think on those controllers let's save it off and take a look so i've got this one set up to joystick four this one should be set to joy oh joystick three i missed that yeah i almost missed it on that and then we need to set up the fire button so duplicate the fire button here let's duplicate fire two duplicate it again and then we'll rename we've got p2 fire one and we need p3 fire one and remember for joystick buttons we don't change the axis here or the join number we put a number in here so this becomes a three joystick three button zero and then for player four this will become joystick four button zero all right that's all i need for that i go to file and save project and now i've got controls for all four set up and ready to go for when i go over to the arcade but i said i wanted to do attacks that are specific right now when we hit a player and we knock them back it's the launch force on the person getting hit is what determines how hard they're getting hit i want to change that up to be the attack force of the player that's hitting them instead so we're going to change that up a little bit instead of having a launch force we're going to rename this to underscore attack force and then i'm going to search for it so control f and go find it here and when we launch backwards instead of not instead of using our attack force we'll say we'll use attackers force and we're going to make that a parameter so we'll make that a floating point parameter in our launch backward named attacker's force and then here we'll say hitter dot launch for what did i call attack force attack so we'll launch backward with our hitter attack force and pass that in here so if you're curious how this works by the way this attack course is accessible right now but it has the underscore and if i hit f12 it's private we can access it though because it's in this same class even though it's another object in the same class because it's in the same class we have access to that that line of code or that property or that field i guess really to set it when we normally wouldn't if we were outside of the class that should allow us to make it so that our players are now impending or controlling how hard they hit the enemies instead of the person getting hit let's go in here and let's make it some mousey hits now see his heart now massey used to get hit hard now he hits hard let's try it out yep mousey hits hard and now doozy oh yeah it's pretty hard too let's turn down doozy's power let's make it so doozy doesn't hit his heart jesus is going to hit for 100. he's maybe he'll hit he'll hit faster but not as hard i am okay well that was that was kind of a lame one okay you can see it now though right there there we go now he's doing knockback but unfortunately his buddy ty back there is knocking him down too so we'll save this off and then um let's see what do we got next let's go back into our into hacking plan one more time time is done we've got audio and bots left um i don't know though i'm getting i want to fix the attack though so i'm going to do um attack delays and then i think i might take a little break because i'm getting really tired and hungry so oh yeah i'll reposition the score let's add attack delays and let's fix the score position we'll do those and then maybe we'll do bots um a little bit later with audio and stuff and putting it on just getting really really hungry now so we'll go into attack delays let's do that so our attack system right now on our player just looks to see whenever we choose to hit the attack button so right here in our update method we look on line 61 to say hey if we pressed our attack button set the attack trigger let's change that up and say if we press the attack button and it's been enough time a very simple one we'll just add in a really quick timer we'll say if time.time is greater than or equal to next attack time and and i'll just hit enter put that on the next line and we've hit the button then we'll do it so just hit alt enter add a field for next attack time get rid of the private keyword both of those private keywords we'll copy that and then when we do the attack or right here we'll say next attack time equals time dot time plus underscore attack delay attack delay will be a serialized field so we'll alt inter-generate it f12 go to it and add the serialized field attribute and then we'll give it a default value i'm going to give it like a one so we can attack once a second actually let's make it like 0.5 so we can attack relatively quick um but not not so fast that um we're spamming them out too i don't know it's it's going to be adjustable and something that we can configure per player though i figure like sometimes you want fast attacking players sometimes you want slow attacking players there we go look at that i can't constantly attack too fast but i can't attack quick enough and i can kill my guys and see oh so far i think it's it's looking good i don't know i'm trying to think if i got any any complaints here i don't know everything seems to work okay and stuff's just kind of knocking around i think it's looking good i'm gonna fix that player score position and then we'll do a little bit of chat real quick let's anchor this to the bottom right zoom out a bit save this off i'm gonna hit play go into play mode for a minute just chat with everybody real quick about what we've got and then i've gotta go eat and we'll um it'll pick up later or just get this onto the arcade system later so you can get in there and start playing around and then man turn this into like a full video or can go through it in detail and kind of get an idea of all of the steps involved in case you missed anything so hopefully you guys like this kind of stuff i don't know it was interesting for me to just kind of go through and build this stuff out live without any plan so if you like that kind of thing is somewhat interesting you find it useful make sure that you've hit that like and subscribe and all that stuff and then let's just take a quick peek at chat so let's see um what's going on here any any questions and if anybody has any questions by the way anything you just wanted to ask real quick chat real quick uh now's time but in your opinion is it currently possible an entire game using dots in the ecs are there primary limitations could you make the same game making easiest so you definitely can make a full game in datsun with essentially dots but um it's just not something that i would recommend to anybody right now only because you probably don't need to and it's probably overkill for what it is you're building most of the time i find that people get into dots because it's got this like crazy performance characteristics you can do all kinds of crazy stuff but then you ask them what they want to do and the stuff they want to do isn't crazy complex stuff they want to do very basic simple things so it's important to make sure that um if you're going to switch to dots that you're doing it for the right reasons and that you're really getting the benefit out of it because it is going to take you longer it's going to be more more work to do it's going to take you longer to get the project up and running and out so i wouldn't just jump into it just because it's new and fancy jump into it because you're going to get the benefit out of it but it definitely could be done um it's just not something that i find a lot of people are at the point where they're hitting those struggles yet let's see if there anything else um oh christmas giveaway um why not and give away a free free mug real quick while we're at it um anybody wants one let's see if there's anything else in chat though i'll i'll make a really quick mug code um everybody hit the like button and i'll just flash a code for a free mug anybody wants a mug by the way it's just uh i'll show the page real quick they're just these fun little mugs but you just grab the the mug here um they just go to support the channel and they come in a bunch of different colors but i'll do a code real quick to give one away for free see if anybody else has some text some questions so how would you change the timer from seconds to minutes and seconds um in this case you'd either use a string.format to just get the time one way to do is like you just use a time span and do that the other thing though is to just um make a separate um you write a little bit of code to just do the the division and the remainders use the percent to get the remainder and you do the division to get the minutes with the remainder and then turn that into seconds uh it'd be an easy way to do it too um pretty simple it's just a couple little lines of code i'd definitely be happy to show it sometime though let me make this code though before i forget if anybody had any other questions watch as i just keep losing my game over and over copy this one and i'm going to flash up a code so if anybody wanted that mug and you wanted to go grab it just get on the screen get to the checkout page and i'll flash up a code in just a minute when we when we end the stream um so it'll be in in just a few more minutes after we take questions if there's anything else um look like i had any more questions though looks like it's relatively quiet out there i don't know if there's anything out um i guess if nobody has anything else um i just real quick update on some stuff i was gonna do so i'm gonna be building um some new 3d tutorials that'll be up on youtube soon some longer ones will go in depth in detail on building out a couple different game types um a big update for the architecture course where we'll be going much more in depth on um on on a bigger complex game um that would be coming sometime very soon it's still really in progress hardcore now and then um what else we got going on i think i'm going to start doing these streams weekly so i think the plan is going to be just like do a weekly stream every um oh sorry the website address let me just paste it in here uh so i think i'm going to do these streams every saturday because that's the plan going forward and then try to get into a really regular release schedule on youtube videos as well and do some technical stuff once a week and some less technical stuff once a week um but that's that's the plan and that's the system setting up with now so i'll be doing um yeah another stream next week too but i guess kind of kind of the way it goes somebody's asking about the audio so i didn't hit the audio stuff yet but that's actually the next video that i have so it's getting edited right now and it's a very long in-depth like 45-minute video about audio and how to set it up everywhere so if you're interested in that make sure that you hit like and just drop a comment too so my editor knows and as soon as he's done with it we'll drop it up there um let's see i think that was it so i think i'm going to wrap it up here if you're curious uh there's a question how do i start with game dev let me just change that um i would jump into creating a couple projects go through some tutorials first build some games uh try a couple people's tutorials see what it's like to see go through the process of building a couple simple things start with 2d stuff and then jump into 3d is usually what i'd recommend just because you can get down the code in the editor and stuff without having to navigate 3d world and the extra complications you know do that for a couple days a week and then jump into the 3d stuff and you'll find it'll be a lot easier to get into um let's see but yeah i'll do that go through some tutorials there's a bunch of them i've got some on my page i go through and make angry birds i'd highly recommend doing something like that let's see um can you do a video on ci and cd setup yes i will do one of those sometime soon we'll go through that um will you be using 2020.2 for the new videos soon using 20.1 right now 2020.2 is actually what the audio video is in i think so 2020.2 was there and it was stable but let's see um it would be used in 2022.2 most for a lot of the stuff going forward and 0.1 for some of the things where there are stability issues i guess um can you ask a specific question yep that was a great one see anything else if you finish this game where will you release it um i probably won't finish this game like and make it like a fully complete game but what it probably will do is turn it into a full-on tutorial where you go through the steps of building it and have everything really documented like step by step without me stumbling through the things that i get confused on so i'll probably do that sometime soon please build mobile games with optimization tips that's something i definitely want to do soon and do you think using bolt scripting is good or does it introduce issues i think that visual scripting can be really useful especially if you want to allow your game designers to get in and do crazy things and really have a lot of customization without killing programmers visual scripting systems are really good for that i don't like to use them for like my entire game just because it's just slower for me i'm faster at writing code than i am at hooking things up visually um let's see great stream oh thank you i often do 2d games in javascript and use that hollow filled shape the varying thickness size i want to be able to switch to unity how do i do it use a ui sprite yes use sprites so if you want to do a 2d game in unity create a new 2d project and use sprites again i'd highly recommend just go look at my channel there's a three hour long angry birds tutorial you'll learn all of the steps for building angry birds dragging them around making it work on mobile hitting things and everything else really tightly packed into exactly what you need for for building this i would check that out i think water with the water is going to be cooler i'm not sure but it is oh water could be cool let's do anything else we come back later today to set up the arcade i might it depends on how things go i either do it later on today or um get it recorded tomorrow i'm not sure so see how long it see what else happens today i need to go eat soon though and then will you do a tower defense game um i'd like to it's one of the things i've played around with a bit um and it may end up being part of my architectural course actually adding some tower defense elements to it um yeah it's definitely something that i want to hit soon though tower defense and strategy games in general all right i'm gonna flash up that code real quick for anybody that wanted that mug and then we'll um wrap it up here so here's my notepad window i will paste it in and drag it over in just a second so if you still wanted it make sure that you're on that site you go to the checkout page you're ready to add the coupon because it's just going to go to whoever is the fastest person to claim it probably have a better system like some kind of a drawing system but right now it's all about the uh speed of the click i guess and the speed of the connection all right let's just double check that this thing looks good make sure that my coupon is valid real quick for um it looks good all right we'll drag it over bam there you go so whoever gets that code and reads it i'll zoom it in for anybody who's got a tiny screen congrats um hope you like mug i hope anybody who uh wants a mug go grab one if you like it otherwise just hit like and subscribe i mean that helps more than anything just sharing the videos getting them out there and letting more people know about them all right i'm gonna wrap this up now thanks again everybody um i'm gonna go grab some food and we'll see this next up on an arcade system all right bye everybody i'm gonna switch to starting mode because i don't have an ending mode you
Info
Channel: Jason Weimann
Views: 29,112
Rating: undefined out of 5
Keywords:
Id: -Yv4KKWZEmE
Channel Id: undefined
Length: 203min 15sec (12195 seconds)
Published: Sat Dec 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.