GameMaker Studio 2: Action RPG Tutorial (Final Episode)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody and welcome to the final final episode of uh the arpg series where we're gonna be showing you how to make this title screen uh that's a nice way to kind of put a little ribbon on the game i have a nice title screen i press any key and it like it disappears and uh we're able to select and load from any uh of our three saved slots so let's start by bringing in the sprites we're gonna need for this the first one is going to be uh s menu s menu player i think i called it so i'm looking for s menu player strip eight over here um it's literally just like the run animation for the player but with like a white outline we don't really need um the whole animation system i'm actually going to delete most of the frames except for this one i'm going to drag the origin point to be like roughly not quite um like you can start from middle center and then just sort of drag down so we get it kind of like in the center of the kind of the sprite itself and that will do nicely and i'm just going to call this s menu player then the second sprite we're going to bring in is uh s title underscore strip 2 here and we're going to call it that s title all right and what this sprite is um you can see it's a lulu's adventure a game maker tutorial that's going to be kind of our our menu screen like image that's going to go sit over the top of the background and uh then we've also got this press any key frame that we're going to use and sort of like flash at the bottom okay obviously we're not animating this we're just using it as a place to store two similar sized um sprites the reason we've done it like this as well i'm leaving the origin in the top left here and it's a 320 by 180 image which is the size of our screen right um so what this means is that we can design the sprite um with an origin of zero zero in mind and uh it allows us to very visually position where i like how uh where this is going to look in regards to our screen like the outline here just is our screen right so that's why i was able to put this just right in the center bottom here and i know exactly where it's going to be on our screen if we just draw it as zero zero okay very useful way to use the origin there for this kind of thing don't worry about the excess like space around the edge like that that doesn't get wasted because when game maker makes the texture page by default you can change its behavior but by default it's going to trim away all of that excess space so you're not like using up any extra memory or anything like that it's very uh useful way to do these kind of things so we're going to actually make the title screen room so i'm going to right click in rooms create room call it art title makes sense right um in fact no what i'm going to do i'm going to delete that i'm actually going to duplicate our river um and call that our title um because what i want to do is i want to create a kind of background for the title screen that's sort of an area from the game and i'm going to use just sort of this error at the top where we actually have the cave um so just by duplicating this we can just get rid of most of the other elements like if i go to instances um select all of this and just hit delete this and hit delete and get rid of the player um get really bolder as well just in case we actually leave the slime there and the collision thing um and that will just make a nice interesting thing like a slime just meandering about on the title screen it might look kind of cute um and then i'm going to reduce the um height of the room down to 180 and uh this will be our title screen room now oh and of course the other thing is probably get rid of that um transition thing as well it doesn't really matter i guess but like just make sure we don't need it so we may as well get rid of it next we want to make sure when we start the game we actually go to that uh particular room in the game so i'm going to press ctrl t and type macros to give our macros a script back up and as you can see here we have this room start thing that tells us which room we're going to go to i'm going to change it from our village to be our title now if we run the game really quick we should see that we go to that room first of all and it's all good we have no players we can't meaningfully interact with anything um but you'll notice our ui is showing as well because our ui is always showing and we don't want to show that when we're in the title screen specifically so if i close that ctrl t i'm going to type oui come to here and just in the end step um i'm going to type either at the bottom or at the top actually we'll put it right at the top um up here what we can do is right here i can just write if roon equals our title visible equals false else visible equals true simple as that right um so like in a way you could say like oh that might get messy if there's lots of rooms but it's not really too bad as long as you know since this is a persistent object and it's everywhere in the game we do need to in some way specify what rooms to show it and what rooms do not and the simplest way to do that is just check if the room equals a room you don't want to show it make it invisible otherwise make it visible right and then you know run the game you can see that now we will just come into that room we won't have that ui there anymore it's still there technically but um it's it's not actually um showing any of it because we don't want it to in this room of course as i said just because we've made it invisible doesn't mean it's not still functioning so we actually need to make sure we can't pause the game as well during um in rooms where we don't want ui to show otherwise we'll be able to sort of inv we won't even know it's happening be able to like invisibly control the pause menu which is not what we want so i'm going to come into ogame and in the end step where we are able to pause the game and when we do this if keyboard check vk escape thing uh what we want to do is simply write and um o u i dot visible uh equals false or um oh sorry uh does not equal false um or or or equals true however you want to do it you get the idea so as long as oui is visible we're able to pause the game and toggle pause and unpause we just don't want to be able to do that while this is invisible and the reason i'm leaning on the visibility of oui rather than you know doing the same thing again and checking to see what room we're in it's because that means now um oui determines that for it's okay so we do anything in here that determines whether or not oui should be visible or not based on the different types of rooms and then that is essentially get like inherited by this check right by checking to see if it's visible or not we're simultaneously checking uh whatever rooms we've marked out as uh not being a place for the ui in the other objects so that we don't have to repeat those checks okay so now we have a room in which to actually create like our title screen right i'm going to make a new object um and call it oh title screen and uh we don't need to give it any kind of like sprite or anything like that we're just gonna go ahead and make the create event for it okay and in here i'm going to write title uh visible equals not point naught and uh the first thing we're going to do is make it so we fade uh those images in uh you know our lulu's adventure our title screen images over the top all right so create title visible equals not boy not then i'm going to add the step event and the step event i'm going to write title visible equals min open bracket 1 title visible plus 0.01 all right so we're going to increase it by 0.01 every frame until it hits one and we won't go over one because it returns the smallest because of min right then we're going to add the draw gui event and here i'm going to write if title visible is greater than zero because if it's zero we don't need to do any drawing or anything we can just skip over all this because we don't want to draw anything but if it's over zero we want to draw something at some kind of visibility so we're going to do draw underscore sprite s title 0 0 that is let's scroll down here just you can see the um the argument section on the bottom here so the sprite is uh s title sub image zero x is zero and the y however um is going to be minus resolution underscore h so just like a full screen height above um and then not a comma sorry plus title visible multiplied by resolution h all right uh close brackets let me call it um so what let's do because you remember ours title like we can just draw it to zero zero and that's it drawing in the correct place but what i want this title screen to do is actually like scroll down onto the screen so it's going to start off screen and kind of scroll down we do that by drawing it like a full screen height above zero so it'll be at negative 180 or 160 or whatever right and then we add a title visible which is going to go from naught to one multiplied by the screen height which will eventually give us uh minus resolution h plus resolution h which will give us zero right so it'll go from negative 180 all the way down to zero and then we'll be at zero zero and we'll be drawing it on the screen right let's just make this a little bit bigger um also though we want to draw that second frame of this title that press any key thing and what i'm going to do is i'm going to set draw a set alpha the transparency um what we're going to do is we're going to draw this um a second frame at a certain level of transparency that waves between 0 and 1 so it kind of like flashes all right but like a kind of pulse right like a pulsing alpha so it kind of draws our attention a little bit and now we're going to do that i've actually made our videos on scripts um and useful like helper functions and one of them is wav and it's a very good function that you can type in like situations like this without having to think about it and it's just like wave a value between naught and one and over so many seconds very very useful but um here i'm just going to show you how to do it manually and then you can kind of understand how you could make a function like that yourself if you really wanted to um so what i'm going to do is going to set the alpha to first of all title visible is our main factor here um because uh we want it to be 0 or 1 right depending on how visible the title is we're going to fade it in slowly over time so like at the start we don't want it to be visible at all so whatever it is we're going to multiply it by title visible all right so either from from naught all the way to 1 um this will multiply by whatever formula we want to do here and then whatever we put over here is going to be what makes our wave happen all right like our alpha over time now the easiest way to do um any kind of like waving function is to use something like sine or cosine cos as well um so i'm going to do sine open bracket um get underscore time timer now uh i'm just putting a little bracket there for the time being so sign if you're not aware i don't know if we've covered this on this particular series in the past at 51 episodes it gets really hard so please forgive me if i'm going over something we've already been through but um if i just zoom in for a second just so i can draw what a sine wave does is uh starting from zero depending on what number you put into it in these brackets it's going to return a value between one and minus one over time as the number increases so starting from zero and then getting all the way to like three point one four and then up to six and then up to nine and so on like uh it goes between like hitting one at these peaks and minus one at these peaks okay which means is you just if you just have a value that just increases over time but again it's a sign you get a shape back like this get timer returns the amount of time that's passed since the game was launched in microseconds right so that's a very useful thing to use if you just need a value that increases over time right um but since it's microseconds and there's a million of those in a second what i'm going to do is multiply that by naught point not nor nor nor not one uh to get it down to like seconds again essentially dividing it by a million right and then uh because of the way sine works it's like a trigonometry function if you know about this then you already know this but for those that don't um it works in radians okay which means like one uh i think it's like one um full peak or something like that i could be wrong um something like that one of those like full pinks or a full wave or something like that is um is going between naught and 3.14 so every 3.14 it like does one of those like full um curvy waves right um and 3.14 um which as i say just one of those four waves is like a special number called pi and that's a built-in function game maker you just have p i and you get pi so we can also multiply it by pi just so that we like normalize it to um uh on that so we get the idea that like every second it's going to be like one of one of those things i can't remember if it's like one peak or too big so you just google sine graph and you will you'll see what i mean and then um the problem though is that uh sine as i said it goes between one and minus one and we actually want to loop between um one and zero um so the simplest way we can do this so it just like keeps looping in that way and rather than looking like this actually looks something like this um is to just put an abs on the beginning here which will um i don't know what ab stands for actually i don't know if it's like absolute or something like that but like you do abs and you put something in it um it will just make sure that the number is always positive so if you put minus three into abs it comes back as three and so on again i may have explained all of that kind of thing before in the past sorry if that's the case it's really hard at this point there's too many episodes um once you've done that just close make sure all the brackets are closed right so let's start this one start this one start this one and this one close close close close right uh semicolon next up um we can actually draw that sprite so draw underscore sprite uh s title the sub image this time is going to be one um and the x and y should be zero zero right so we we're drawing that again if i just middle click this we're drawing this frame just as zero zero so it'll appear in the middle uh uh right right there okay um then once we're drawing that um we set our alpha back to zero so draw alpha um oh back to one sorry so that we don't draw everything um this will be a transparency forever so next up we can just uh put this into the game just go to our title on the instances layer we're going to pop uh oh title screen in fact actually just be safe we'll make another instances layer above it build a tile screen just make sure it doesn't like draw build it's draw gooey anyway but just to make sure it's on a layer above these things um you can see here like it's fading this in and out we've got lew's adventure gaming control and it just like i just keep pressing r there just to restart everything and see like it starts off screen comes down here and then this is just like fading in as well so that's kind of uh part one as it were of this uh extra length uh final episode special uh so we just got the title screen drawing now we want to actually like be able to progress on from this and show our save slots that we will be able to pick from so let's close that and press ctrl t and type uh title uh actually yo title is enough to get to our other screen object come to the create event i'm going to add a whole bunch more stuff in here other than title just a title visible we're going to want key pressed to equal false we're going to want slots visible to equal 0.0 uh slot selected to equal not and loading started to equal false all right that's going to be whether or not a loading process has started like we're loading for the next screen so we don't accidentally select multiple saves or whatever um keypress is going to be whether or not we pressed any key at the start and or to progress to the next bit and slots visible is going to work like title visible and it's going to be how much um we're showing the save slots on screen at any point between norton one and slot selected is which one we have like highlighted or selected okay then underneath that we're going to loop through our different save slots and uh load in the various uh data okay so i'm going to do four uh var uh slot equals zero and slot less than or equal to two and slot plus plus all right so we're gonna go just a simple loop over uh each of our three slots from slot zero slot one and slot two i'm gonna do bar let's go file name equals save plus string underscore slot plus dot sav and this is exactly the same as it is in our um save and load scripts all right you can check it against it so if you go to save game save string to file here hit save plus obviously the global game save slot plus dot sav right so just make sure it's exactly the same structure save plus the number plus sav or however you've done it in your game and then once you've got that file name we can do if file underscore exists uh underscore file name uh if that file is there in the first place we can get the data from it by doing slot data underscore slot equals load json from file remember that function we wrote just to get the json from the file and put it into a ds map in game maker file name um else slot data underscore slot is going to equal minus one and then we can always check if if that equals minus one then we can just show that there's an empty save file there all right whereas if we have uh save file what we wanna do is actually get all the data from it not so that we can immediately load the game or whatever but just get the information like what room the player was in how much health they had how much money they had so the player recognizes the saved game and we can show that on the save slot itself uh if the player had like an entered a name or something he could show that all that kind of thing okay then i'm going to come to the step event and uh what we want to do is we only want to only progress this um when we haven't yet pressed the the key to progresses onwards okay so i'm going to write if not key press um so at the start when we create it's false so this is gonna happen at the beginning and we're gonna fade in the title screen and all that stuff but then once we have pressed the key and once we've made that true we're going to do title visible equals max zero title visible uh minus uh 0.01 um so we're just literally doing the opposite there so we'll reduce it down towards zero um rather than increasing it towards one which will just make that stuff go in reverse that'll make the time screen float off the top of the screen and the press any key thing will turn invisible totally and then we're gonna do um well i'm just gonna copy and paste this line where we increase a title visible and we're going to change it from title visible to slots visible in both places there so we're going to basically do what we did with this variable but now to our slots visible variable okay and make that uh make our slots fade into view and uh obviously at the end here we need to actually check to see if we press the key so we're gonna do if keyboard check pressed uh vk any key and that will literally uh doing this we'll just check see if we pressed any key on the keyboard um and if that's true uh key pressed uh equals true right and then last but not least we're gonna come to the draw gui event and uh underneath this section where we're doing stuff based on if title visible is greater than zero we can actually just copy that and change it to if slots visible is greater than zero and if that's the case um we're going to first of all set draw set alpha to be whatever slots visible is so they like fade in over time right and then underneath we can do draw set alpha 1.0 so we remember to set it back right away and then in between here is where we're actually going to draw the slot i'm actually just going to copy and paste this one in so i'm going to copy it from my script and just get the indenting correctly because it tends to screw that up so this here that i have highlighted there's a bit we just pasted in here and then i'm going to be going over again we're looping over the three slots and we're going to draw each one as a text box um using our text box bg sprite um if i double click on that just to show we're going to draw the blue bit for for each slot but then the slot we have selected is going to have this one which is going to have a little white outline on it so we can tell it's selected right um the x and y for each one um is just basically going to be magic numbers i've used 160 because that's like halfway into the screen and then 16 just to give us like a 16 pixel margin down plus whichever slot this is times 48 okay so each one is going to be 48 kind of pixels apart and then uh when we get to whichever slot we have selected we're both going to set the frame uh of that text box bg we want it to be three which is the fourth image um and we're also going to set um we're also going to draw s menu player our uh oh this guy um just offset a little bit from that position so whatever x we're currently up to and whatever well the x stays the same but whichever y we're currently up to uh plus 24 and minus 32. these are just all magic numbers that just work for me in theory there's subtly better ways you can do it but even a lot of the better ways are still a pain to manage and they take even longer to set up so we're just keeping it simple magic numbers it's fine don't be afraid um uh so we're drawing that as like a cursor next to whichever slot we have as i say these numbers might not work for you but i mean if you're using the same resolutions in me they'll be a good starting point but just you just have to play around with them until you get what you want they're just sort of based on the size of the screen and then as i said we set image to be two or three based on if this is slot selected so now when we use our ninth slice function um we uh can draw that text box wherever and we just put in whichever index um we need to based on whether or not this is the selected slot or not all right so just drawing x and y and then the second x is just going to be 312 like or like close uh basically 320 would be the far right of the screen and i'm just giving it like an eight pixel margin um and then whatever y we're up to plus 48 so each one is 48 pixels tall and 48 pixels apart so they should sit right next to each other um um like like 16 pixels down from the top of the screen okay and then obviously we set alpha back to one afterwards now we can go ahead and run that and we should see now when we get this we get this again press any button play this way you see those kind of appeared instantly and it was kind of a little bit jarring that the corners are kind of fading in um that's just something we sort of overlooked when we did our nine slice function and third we don't need this function anymore right newest version of game maker has nine slicing stuff built in but since we have this function it's doing a bunch of work for us so we don't we may as well use it right um so what you want to do in here is where we put one kind of lazily at the end of like draw sprite part ext if you're using this function just replace these ones uh with uh draw get alpha okay open bracket close bracket take that function there and just paste it onto these ones on the end that's representing the alpha with which we draw each part um i think we just assumed when we wrote this that we were just always going to draw it in alpha 1 or whatever um obviously draw a sprite part on its own we'll just use the draw get alpha and that's why the corners were drawing correctly but everything else was kind of um ignoring it and just drawing a full alpha we just put drag a helper on the end of each one of those there it'll draw it correctly so now i've done that uh if we run it again um pressing you can see it it fades in properly so we've got this and then we press that and then this comes in just as we wanted to and you see the selector slot is like highlighted and has this little do next to it next up we want to draw some information in these boxes based on whatever is in our different save files so i'm going to close this first of all and i'm going to make a new script um create a script and i'm going to call it room to area name and i'm just going to copy and paste in the whole function here um this is what it should look like i have a function called room in fact we can change argument 0 really to just be a room name since we can we can name arguments now uh last version of game maker so we should probably start doing that um room to area name room name so whatever or rather no it shouldn't be room name it should just be room really thinking about it because room name is what we're going to get back so we pass in a room number or you know room index or something like our village our river or whatever and we get a more english readable like string back um so we just pass that in and then we just make a switch statement and for every like area of the game we're gonna have a name specifically for it okay um long term and a bigger thing you might consider doing this as external data that you load in but really there's not an issue in just doing this as a big switch statement it's not as bad as people will tell you that it is long term you might want to um make this data external rather than just being in a big switch statement because you might want to localize and change i don't know the language of each one of these different things and so on um so this is kind of really a one language solution for your game um that can also kind of get you know difficult as it gets really big and you have to manage it within game maker and do that kind of stuff um so you could make like um like a key pairings thing in an outside file or something but for now for a small game and one language this works as a pretty solid solution okay just have a switch and for every new room we add we just add a new case and it says if it's this room then return this string okay and then we have a default here that says unknown area and i don't know that we should hopefully never see that i think we will probably see it in this tutorial actually based on one thing but um in theory generally in your game you should you should never see this and you know if you see this uh that something's probably gone wrong or or you've not created a case for that room okay so it'll let you know okay so now let's pop back to a title screen um in the draw gui event that were working on before and let's actually just comment this a little bit so the starting bit here is draw the save slots um this bit is uh draw the uh boxes and then underneath the ninth slice box stretch while we're still in the loop for each slot uh this is where we're going to start to draw the save uh data if it exists so um the first thing we want to do um before we draw anything of any kind uh over we're going to draw some text either way right and before we do that uh we want to do our usual setting of the different things so i'm just going to paste these in okay so draw set font f text uh draw the h line uh fa-left always do both at once so v align f a top and set the color to be white okay and then as i said we need to check to see if the save data even exists so i'm going to do if slot data open square bracket underscore slot equals minus one uh if that's true then we have an empty save slot so we can go ahead and write something that just says like start a new game or something so i'm going to draw text uh underscore x uh plus eight so we give it like in at wherever the box is drawing but plus eight so like eight pixels in just give it a bit of margin and then the same for y so whatever the top left of the box boxes plus eight um start new game or something that's what we're going to draw there and otherwise else uh draw save oh actually we've got that coming on board we're going to put that um if it's not yeah if it's not an empty slave slot i think we know what the opposite of that is so then we're going to do draw text um again the same coordinates x plus a uh y plus eight again eight might not be the number but you know it's just the top left of the box plus some amount whatever works for you in your situation uh room two area name open square uh open regular bracket sorry slot data and then open square bracket slot close square bracket open another set of square brackets question mark room okay so again just using fancy new chained accesses here we're going to reach into whichever entry of this array is uh the slot data that we want and then that'll be the return of ds map and then uh we do this to access the particular bit of the ds map we want which is whatever room was in that save game okay then we send that to this function we'll get back a room name they'll be like the village the river what wherever the shop or wherever we happen to be and we'll draw that text in that slot okay uh then just to make sure we actually have a saved game to to try it with um because i think if we run that now it'll just show them all a start new game i'm just going to be sure of that yeah start a new game because it's not finding any saved data at the moment because i don't know this is i i save these as different iterations and there won't be any data from stuff we've done previously so um in order to test that out what i'm actually going to do is uh just go to the create event of a title screen and i'm actually just going to write like save game here which i'll just run that right because obviously your game and everything exists and we can do that save games though it'll just save the game on the title screen which is obviously not what we really want but it's handy for the time being to say that we've got saved game in here and it's got unknown area it'll also have all our basic settings like our three hearts and our thousand money and all that kind of thing uh but just so that we've got one that's different right um we could have even changed the slot and then doesn't save game to make sure it like put it in slot two and so on but you get the idea right uh this has actually got some data and it's loaded it um yeah important to do it here as well before we actually load the data so that it saves the game and then loads the uh it goes to load the data and actually finds a game to load um this is obviously super temporary just remember where you put this because we're gonna get rid of it okay let's do literally just to test that out now we know the basics of that is working we're gonna come back to draw gui and we're gonna draw kind of the rest of the data right um so uh underneath here uh once we've drawn the room that we're in i'm gonna paste in a whole chunk of more stuff um mostly because it's based largely on code reverend before i'm gonna paste it in let's maximize this and just so we can see the section i've brought in here nice and clearly so it's this whole section here draw health and draw money we'll zoom in a little bit okay so this is where we were drawing the name of the room and then we've got a draw health section and this is basically wholly copied and pasted with just um the variable names changed around to get the data from the slot data player health and player health max but it's exactly the same as what we do in um wherever it is oui when we draw the health of the player all right so it's exactly the same as that like looping through each heart and drawing them for the fractions and all that i didn't want to go over all of that again again you could argue this is kind of messy and you should put this in a function like if you're going to draw do this draw health thing multiple times and then you just sort of provide like an x and y for it so you can draw it wherever that is the smarter thing to do but i didn't want to go through all that like oh yeah and let's put this in a function and read it and so on right so i'm just copying and pasting the code but generally speaking yes you would want to put this into a function um that took in the coordinates so it would just draw took in the coordinates and the amount of health so that we could provide like the health from the different save data as well as whatever health is currently being used so you want to take in player health player health max and an x and y and then do all of this referencing those coordinates but for the sake of ease we're just copying and pasting the code and we're just changing the coordinates around um just to be based on the x and y of wherever this box is and the various margins and so on you'll have to play around with it but you get the idea okay we're just drawing that health um onto the text box um using the data that we get from slot data or whatever slot this is and the same again for money all right let's get it basically it's based entirely on what we do in our ui just drawing that coin again um again these numbers are a little bit weird and offset because like the coin different origin and so on this is why doing ui stuff in game maker is horrible because there's not really a lot of good ways to do it without like writing a whole lot people have made some good libraries and thanks for handling it but um generally speaking it's quite tricky to do because you just all the time the best way is to just put numbers in and try them out which is uh frustrating but it just is how it is um and yeah we're just drawing that text slot data slot getting player money out and drawing that in there so we can just run that now having basically all that in this comes up press that goes away you see unknown area thousand money three hearts okay now before we carry on i am going to get rid of that save game thing in create i guess like we've seen it's working okay and then i'm also going to just get a folder open go to uh app data right um local and then whatever the name of your project is so you can see mine is currently a rpg underscore final r because it's final episode and our for recording um just find that um in your local app data folder and you should see your save files okay and we've got save zero here created from before i'm just going to delete that okay because it's kind of a dodgy save in an unknown area so we just get rid of that um so that we don't have it going forwards now let's come to the step event and underneath this section here um oh actually in between this section we'll put the the any key thing at the bottom still that's fairly important i'm just going to copy and paste another huge chunk in and we'll just go over it all right um let's zoom out a little and we've yeah i always put in the space and then remember that the pasting just gives you the space anyway i don't know why i still do that after like 20 years or whatever but anyway uh this is this section here is what we've just pasted in um we'll zoom in a little bit actually and nice so you can see it all um if keep pressed or vk up or key press uh w uh slot selected minus equal one if it goes less than zero we set slot selected to be two if we press down or s we add one to slot selected so we're moving down the list and if slot selected is greater than two slot selected to zero all right simple kind of a chunky there's probably like much smaller ways of writing it but i just did it nice and chunky so it was simple to understand if you press the key increment the variable if that variable goes over the edge wrap it around okay and then the same in the other direction right really really simple way to just do wrapping around selecting different elements of a menu then underneath that uh we check to see if we press enter or spacebar i forget either those are decent confirmation buttons that the player is likely to just try on a whim right and also though um key pressed is a thing so we've pressed any key so we're past that stage where we're just showing the title screen on the press any key bit and also um loading um loading started is not true all right if that's all the case then we set global games save slot to be whichever slot we have selected and we try and load the game okay and you remember when we wrote the load game script we we set it up so that it would return true if it worked and we started a room transition to actually load into that room and it would return false if there was no save in that slot okay so now we can make use of that by doing if not load game that so like it's going to do that function and then it'll return true or false and uh that'll make the that the condition for this if statement right so that is to say we're checking to see if load game comes back false and if it does come back false we'll do whatever is in here um and whatever is in here is doing room transition uh trans type slide to our village so it's just starting the game essentially because when we start the game up in the first place ogame already sets our globals to whatever they should be for a new game we get three hearts we get whatever our starting money and equipment is etc etc so we're already ready to start a new game we just actually have to go to the starting room okay um so if there is no game to load then we just you know we've set the safe slot appropriately we just go to that room and we just start a game from there and then we set loading started to equal true so that we can't press this button again while the transition is happening okay now before we test all this out because we're actually done with the code um we're going to quickly go to oh player and change back this uh this sort of testing stuff we had for the save game okay so get rid of our sort of manual load button um and then we're gonna change key press f2 we're gonna go right click that and go to change event and change that back to uh room start okay so it just saves at the start of every room um save that um and then run that we'll just test that now we'll get our title screen there's adventure game and guitar press any key got a bunch of empty safe slots uh we'll start in the middle one um so we've got a game here with our attack we'll probably want to change that back as well uh or 1000. many but we'll do that in a second we'll get some more money um six 1007 we'll just come through to here we'll just take a little bit of damage and it'll save at the start of that room but we can also save you remember by just going to pause and go into like save quip we'll come back to here press any key and we see here we've saved and quit and we've got the river which is where we were a thousand seven money two hearts one missing all right another game if we go back for there we'll come back and start this room with a hot uh heart missing and everything loaded in correctly okay um do the same thing save and quit that's good it's all that we can start a new game here um i don't know maybe we can go into this room uh save and quit back here and saved it right so we've got different safe slots and we can load one go back to the river let them quit come back to here go back to the shop safe game still working we've got multiple save slots and uh yeah it feels really weird to be at this point but we are we are done we made a whole whole dang video game um there's things that are missing short and it's not like you know it's not a it's built to be a tutorial you know we just we build it to just cover everything in a minimal way so we have like a basic shop and basic items and that kind of thing um oh i think we were going to cover that at some point as well like making the transition there's little things like that that we will try and cover if we can at some point in the future um just little clean up things here and there but if you've been following along and learning and growing with this series and hopefully doing more than just this tutorial you know we've been reading the manual you've been uh practicing honestly all the little rough around the edges things um that maybe we haven't covered perfectly you're probably well equipped to cover now okay we um we've done 51 episodes we've called a whole lot of stuff we have a character it moves around we've got a cool screen shape we've got rolling um we've got different items that you can like equip and use that do different specific things got bombs uh we've got characters you can talk to quests like dialogue that you could split between these signposts uh that you can read and uh that can otherwise we've got this like entity system that allows you to like flag things different things grass you can cut uh items to drop we've got enemies that like chase after you in different aggro states got different types of enemies got those bats going on we've got little shadows that pop out things got rocks you can pick up we've done a lot right is it like it's not exhaustive there's going to be things people think we need to do now like oh it's an rpg no rpg is complete without xyz and there are features even i thought like oh we kind of missed it would have been good to do this sort of thing but um it's it's time for me to move on um we've been doing this for a very very long time now um so i'm sorry if there was something i said like i will cover this later and maybe i didn't maybe i forgot or something like that and i'm not cutting uh closing the door entirely on like i don't know if we get a lot of i mean there will be loads of bugs and stuff i'm sure but like if we get a few that like um uh loads of people really struggling with or like oh we just get a whole bunch of them that we've isolated and we can fix in one nice episode or if there's a feature people just really really want to see like my patrons are like hey could you do this for the action rpg that'd be really cool i'm not saying we won't ever do that um like for completion sake he's wrapping a couple of things up um for example we never put sound in this game at all i figure people probably know how to do that at this point but if you don't then like you know maybe we could explore that and um there's little things like me a thing i thought of was like the fact that you can't delete a save file from here like if that's i think you could probably work that out now but if you can't maybe we can cover that let me know in the comments if you really really want to see that kind of thing but um you know you see the views as much as i do you know it says 51 episodes in and uh it's not really worth anyone's time i think that's part of me to be going over little things just for the sake of like um a very small number of people who really want it so it'd have to be something people really wanted to see um otherwise what i'm gonna be moving on to is doing um different content and so obviously still you know game maker tutorials on that kind of thing um but we're going to focus more on smaller more isolated topics that i can really get into and explain in a very clean way we've had to get quite messy towards the end here how many times have i said in these last few episodes this approach can be a little bit messy and we should do this instead um so i i want to you know dig into some things that we can do in a really clean polished way um mostly for my own sanity i just want to do something different we've been doing this for a very very long time now um and it really it's all thanks to my patreon supporters as well so if you enjoyed any part of this um you found it useful the fact that you are here now um is because of those guys who supported me throughout all this they voted for it happened in the first place they told me they wanted it to continue even when it was like you know getting kind of low views and that kind of thing um so they're the reason that we got all the way here um so a huge thanks to those people and uh if you made it here if you just watch the whole thing i'm very proud of you i'm very proud of you for getting all the way through here i really hope he did get a lot out of it i'm proud of myself for actually actually sticking with it and getting through to the end of the series despite everything um so it's cool um i'm glad we've been on this journey together um uh thank you for watching however you got here even if you just you know watched a few episodes then skip to the end to see what it's like hello to you too um i hope you're getting something out of this as well and uh yeah i don't really have anything else to say it's weird we've wrapped up i never really know how to wrap things up very well but but here we are we finished it um i hope you got a lot out of that thank you for watching and i'll see you on whatever we make next um thanks guys catch you all next time if you found this video helpful or you enjoy the work that i do you should know it's only possible and only exists thanks to the help of my patreon supporters if you become one of them today you can get access to my source code videos before they even release and have a vote on the topics that i choose to cover doing so will help me make more better quality videos for the future that are free for everybody to watch so thank you to all my patreon supporters and of course thank you for watching i'll catch you all next time
Info
Channel: Shaun Spalding
Views: 10,873
Rating: undefined out of 5
Keywords: Game Maker (Video Game Engine), Tutorial, GameMaker Tutorial, GameMaker, Game Development, Indie Games, Tutorial Series, Game Maker Studio, Making Games, How to make games, GameMaker Studio 2, GMS, GMS2
Id: 8KD4_2CHLR0
Channel Id: undefined
Length: 44min 4sec (2644 seconds)
Published: Fri Jul 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.