Farming RPG Tutorial: GMS2 [Intro for Beginners]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys so welcome to the first video in the tutorial series on making a farming RPG this is a little preview of what we're going to be making so we're going to be creating a controllable player a collision system a robust crop system which allows for many different types of crops with different properties such as growth times and prices and also a night-and-day system will make NPCs including people and animals will go through creating a dialogue system sound effects houses with different rooms and levels interactable objects and furniture now just a little disclaimer here the assets I'm using are not my own there are many different creators on a website called open game art and this site has all different kinds of assets including 2d art and music and they're all free to use so for most of the assets you can use them even commercially but some of the licenses are more restrictive than others so be sure to check the asset license if you're using them in a commercial project especially and as for giving credit again this will depend on the license as well so often it's not required but it is appreciated and I would always recommend that you give credit so now in the rest of this video I'm just going to be giving a basic introduction to game maker itself and some programming concepts so if you already know what sprites objects and rooms are and how basic code logic works then feel free to skip to the next video we're not really going to be doing anything else here so the next video we'll be doing the proper project setup will start importing the assets that I was showing you in the preview and and will code the players movement in a way that allows for collisions and more complex interactions alright let's get started alright so if you're opening up game maker studio 2 for the first time this is probably what you're seeing right here so we can do a number of things here we can open up the market place so you can download assets there's some tutorials and game demos opening and importing assets or projects into this project but we're just going to click new we're going to start a new project we're going to be using game maker language so we're going to be coding when I'm going to be using the drag-and-drop system and I'm just going to call this farming RPG okay so before we begin let me just acquaint you with the project window so everything we do in game maker studio 2 is within what's called a workplace which is kind of like a window or a tab so you can have multiple workplaces and you can switch between them you can have different tabs up you can undock them move them around if you've got multiple monitors you can drag it over to the other monitor redock them and get rid of them up the top here we've got some buttons so homepage urban saves the most important ones are probably these ones here so this little play button here this will run the game or you can just hit f5 so if we just hit that right now we haven't done anything so it's just coming up with a black screen stop here we'll stop the game this is the debugger tools that will be going into the simulator projects and here are the magnification tools if we have tabs up we can zoom in and out of them over here is our resource panel and this is basically holding all of the stuff that makes up our game so in our game project we're going to have a collection of what's called assets or resources so these include the art the music the sound effects the fonts the objects and the levels of rooms of our game also everything all these represent different types of assets that is stored in these separate trees so we'll go over all of these all most of them anyway as we make our game as we go through the series but just to start you off we're going to destroy through three of them so we're going to go through sprites objects and firms so talk about sprites first they're probably the easiest to explain and understand so sprite is one of the types of assets in your game the graphic images anything that is an image so any type of picture in our game the grass our characters our background all of these are going to be stored here as the sprite so let's go ahead and create a new sprite so over here this little window will pop up you can move it around and it will show you a little preview of your sprite so obviously there's nothing here right now we haven't made anything and in this window you can change a bunch of properties about your sprite so you could change the size here you can import from an image in your desktop and we'll be going over this whole window a bit more in later videos but for now I want to dive right in and just draw a sprite using the built-in image editor so to open the image editor you can double click this square right here or you can hit edit image so this is the image editor right here over here this is where we can make new frames of the image so I'll just make a bunch of more frames here so if I wanted to animate the sprite it would appear here's different frames you can press play to preview that animation so you can hold control and then use the mouse wheel up and down to zoom in and out of the image if you click the middle mouse button and then move the mouse around you can move around the image over here is the different tools we can use to draw a sprite this is just a basic pencil this is the eraser tool as with other programs you can just hit ctrl said to undo can draw shapes with these and I'm going to make this the character sprite so if you want you can go ahead and draw something a bit prettier but I'm just I'm is going to draw a square so there we go that's a very basic sprite and we're done here so we can just go over here and quit and let's move on to objects so the Feynman object is I want to use a bit of an analogy because it's actually very similar to what an object is in the human mind so for example let's think of an object I think of the object bird so without giving you any more information you're probably already picturing what a bird is in your mind you're thinking maybe feathers two eyes two wings and a beak you might also be thinking of what it sounds like what noises birds can make you might be thinking of actions that birds can perform flying waddling and you might also be thinking of many different types of birds or with their own properties their own sizes colors wingspans speeds and so on and as all of these things combined the give rise to the idea of what a bird is as an object in your mind so objects are sort of abstract things that don't really exist in the real world you can have instances of those but there is no buried object outside your mind and that's exactly what an object is in programming we create objects and assign them properties to make them behave in a certain way we can make them look a certain way we can give them variables properties we can give them a name we can make them perform actions we can make them emit sound effects and we can have them interact with other objects we can even set up what's called an inheritance system with a hierarchy of objects ER think back to the bad example remember how we have the bird object as a sort of umbrella and then we have many different types of birds that come under it so in the context of programming we call the parent object and it would be defining properties that all of the birds have and then the different types of birds would be its children and they would define the properties specific to those bird species and we can use these hierarchies in our game so for example we can define a parent object called enemy and this would describe actions that all enemies have so it could set up the health system maybe movement attacking the player and then we could define enemy types which will have their slight variations on those actions and variables let's go ahead and create an object so this little object editor window will pop up so get an object to do something we have to use events basically we have to tell it if a certain event happens do this thing and that's basically the fundamental logic of all programming if this do that so if we created and then we can tell it to do a bunch of things here when we get destroyed maybe we can get it to blow up if we click the mouse and one of the most important ones is when we want it to be doing something every step so this will include things like movement or collision checking so we're going to be wanting to do something every single frame in game maker we don't refer to this as a frame it's called a step but it's basically the same thing so every single step the game or vertical frame perform a certain action so the moment this is an empty object it doesn't have any variables and I'm not telling you to do anything but it has a potential to be anything I code into it so now I'm just going to delete these events and I'm just going to assign it a sprite that's right that we drew before all right now let's move on to rooms so rooms are kind of like the game world so I'll just point out that while all game engines they'll have something like rooms they might be called something different so they might be called a world or a level and the game maker version of this is just called a room so by default when you make a new project game maker will already have made a room for you and that's room 0 and we'll just use that one so to bring up the room editor just double click on room and it will bring up this window so as you can see it's just a big black empty sheet right now and you move around similarly to the image editor so middle click to crack move hold ctrl and the mouse wheel to zoom in and out and we'll be going over this window in more depth in the next video but for now I just want you to know that this is where we will be putting all of our objects so remember who I said that objects themselves I just abstract ideas and don't really exist that's pretty much the case in a game engine too so you can create objects but if you never actually put them into a room they will never exist in the game world so to put an object in the game to make it real we create an instance awesome so to do this in here we can just click and drag this into the game and you can have as many instances as you want write as many birds as you want so this is how we actually put objects into a lot so now if we run the game we can see our object here and of course they're not going to be doing anything books we haven't told them to do anything but sort of still exercise let's just make them move when we hit the arrow keys so to go back to the object we can either we can just quit out of this or we can double click on the object here but this leave the tab open so just to give us more space just quit out of that and now let's think about how to make the object move so which event should we use basically we want to be checking if I'm pressing a button to move the character that's the logic we're going to be using so we could go if we're pressing a key down left right up or down and then we can tell it to move and these they check every single frame kind of like the step event we will run every single frame but we can actually do everything from within the step event which happens every frame so let's go ahead and click the step event so remember our logic so we were saying if we press a button move the player and the basic structure of that code is going to look like this so if some kind of condition in the parenthesis then do that in the curly brackets make sure you're using the correct bracket sir these normal parentheses will enclose the condition and if this works out to be true it's going to do whatever we put in these curly brackets so now what is the condition so the condition is a keyboard press so in game maker we put if keyboard check and there's a few different options here so keyboard check will just check if a specific keyboard key is basically pressed down and it is different to keyboard.check pressed because this is just checking if you have just pressed it on the previous frame if you've just press the key down like if you're hitting space to jump and you hold the space key down it's not going to keep jumping it's only going to check if you pressed on the last frame and that goes for release as well so it's only if you've released it on the previous frame so if I use this for movement if I said keyboard if keyboard check pressed left key and then I'm holding down the left key button when I'm running the game it's only going to move it once I would have to keep tapping the left key I would have to keep pressing it for this code to work so we're going to be using keyboard check so whenever it's down do this thing all right so if keyboard check and then we have to give it a specific key so if you're ever unsure what a function does you can actually just middle click it and it will bring up the documentation and it will tell you what it does with a little example here too so if we're looking for a list of keys you can click here to keyboard input and here is the format that we have to give it as an argument so we can say if space is basically left/right up/down if you wanted to give it a character you actually have to give it in this sort of format you have to say odd and then a little quotation and then the letter but I'm just going to be using the left/right up/down keys so let's get out of that and go back to our project I'm going to put if key book checks VK left so if I'm pressing the left key move the player left so in the game world all objects have a position in the room and position is given by a certain coordinate a certain X y coordinate so we basically want to tell it to change its XY coordinate in the event that we press a keyboard button so to move left we're going to be changing the x coordinate so we're going to put x equals and then what we want to equal we basically want it to be getting smaller because we're going left we want X to equal itself but mine's a bit and to move it right up and down we're going to be using exactly the same format so I'm actually just going to copy this and a few times and we can change the buttons get rid of this and let's change the button so let's go BK right up and down - right we want X to be getting larger larger than its current position so we're going to put plus so now for up and down we're not going to be changing the X quarter and more we're going to be changing the Y right so change the y all right now this is important in game maker the y-axis is a little bit unintuitive so the Y origin y equals zero it is actually starting at the top instead of down the bottom so to go down we're actually going to be making Y larger and to go up Y is getting smaller I know it's a bit weird it takes a little bit of getting used to but that's just how it's done in game maker all right so we're done let's test this code so just hit f5 or come up to the play button and hit play all right so here's our room and let's give it a little test to the buttons left down right up so there we go we've set up some really basic movement so now this video was just a basic introduction to game maker and the fundamental assets that we're going to be using but in the next video we're going to be having a bit more fun so we're going to import some art assets we're going to be refining the movement system we're going to be adding some collisions and I'll introduce you to some more concepts with game maker so until then take care and I'll see you next time
Info
Channel: FriendlyCosmonaut
Views: 204,859
Rating: undefined out of 5
Keywords: farming rpg tutorial, farming rpg tutorial game maker studio 2, farming rpg tutorial gm2, farming tutorial gamemaker studio 2, farming tutorial gamemaker, farming tutorial gm2, friendly cosmonaut, friendly cosmonaut farming tutorial, game maker studio 2, game maker studio 2 tutorial, game maker tutorial, gms2 tutorial, game maker, gms2
Id: cdJoJdtFbwc
Channel Id: undefined
Length: 16min 45sec (1005 seconds)
Published: Fri Jun 23 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.