[Beginner Tutorial] Make an RPG in GameMaker [P1] Basic Movement and Collisions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This is an offensively terrible tutorial. Why would you use the physics engine for such basic top-down movement? The whole game that it takes you 30 minutes to explain could have been coded in less than 20 lines of code, and then you could have used the other 29 minutes implementing something resembling an RPG like you say you're going to in the title.

👍︎︎ 2 👤︎︎ u/leinappropriate 📅︎︎ Sep 20 2015 🗫︎ replies

sloths?

Thanks for the video, watching...

👍︎︎ 1 👤︎︎ u/IITTII 📅︎︎ Sep 20 2015 🗫︎ replies
Captions
good morning afternoon or evening wherever and whenever you are my name is Benjamin and welcome to a game maker tutorial now I've been doing game maker tutorials for over a year now and today I want to do something a little different from what I normally do I'm doing a game maker tutorial for absolute beginners this means that if you're one of my common subscribers and you have you you kind of maybe you're more of an expert in game maker and you learn from my more advanced tutorial videos this video might not be the video for you because this video is designed for absolute beginners or people who are new to game maker and still are trying to figure out how to find their way around the program so I'm going to be going over just the very basics of an RPG game but I'm really excited for it because I think this will help a lot of people get started into game maker and see the power of game maker so I'm right now I'm on game makers on the game maker website which is yo-yo games calm now yo-yo games is the company that owns game maker and updates it and if we go to the game maker tab right here you can go to download free now and download a free version of game maker studio once you do that and complete the installation it's going to ask you for your email address and you register your email address with yo-yo Gamescom and then they will send you a key that gives you unlimited resources inside of game maker and you should be able to follow this tutorial with that version with the unlimited resources version it will show a little splash screen at the start of your game that says made with game maker studio but that's okay so let's talk a little bit about game maker studio game maker studio is a two dimensional development environment for building games it can do some 3d but that's not generally what it's used for it's used for 2d games some of the major titles out there are like hyper light drifter this game raised six hundred and fifty thousand dollars on Kickstarter and it's being developed in game maker studio and there's some other ones like spelunky you may have heard of spelunky the original was developed in GameMaker studio and deaths gambit which is a game that I'm kind of excited for this is being developed in game maker studio I guess it's kind of a Dark Souls game so there you go those are some big titles that are being developed in game makers to do so go to yo-yo Gamescom and download the game maker file and install it you can pause this video right now while you're doing that okay now that you've got game maker studio installed we're going to open up game maker and hopefully it'll open up here there it is and then we're going to go to the new tab right here this is just your welcome screen it gives you some different information there's tutorial videos right here demos release notes on updates and stuff like that I'm using version 1.4 point 15 67 but probably as long as you're using a pretty recent version you'll be good and everything will work for you if you're using an older version of game maker some things may not work you may have to modify so try and get the most up-to-date version it's free now we're going to do we're going to go to new project and I'm going to name this RPG basics okay and I'm just creating it in my downloads folder but I you can create yours in a better spot than that maybe create yours in documents or on your desktop so I'm creating this yes I want to overwrite and it will open up game maker studio right here now yours may have a different skin than mine currently has mine has this dark skin if you go up to file and preferences you can choose the skin right here that you want to do game maker green game maker html5 game maker 8 a.m. a cur green I think that's this one and I really like that another thing that you can do is you'll see this little checkbox right here big resource tree icons a restart will be required I always check that that just gives me larger icons over here on the left so they're easier for you guys to see and that was again that was under and preferences now inside of game maker there are a lot of different resources here you can see that you'll be using in your game there sprites and those just are the basically the pictures of your game characters and so you know your character could look like Mario you would create that in the sprite section there sounds backgrounds which will go inside of your levels paths we're not going to talk about casually scripts we won't talk about scripts right now yet either shaders font so for any text in your game time lines won't talk about those yet objects are really important objects are what run the code of your game and make everything work so you actually assign the sprite or the image to the object and then the object makes everything work rooms are the most important because you can't have a game without a room that's your level they call them rooms but it's basically just your level and then included files extensions and macros we're not going to talk about those either so the very first thing we're going to do in this tutorial is we're going to create a new sprite because we need some sort of an image to represent our game character so come up here and there's this little pac-man icon right here you can click on that pac-man icon and it's going to create a new sprite for you now I generally give each so any thing we create over here on the left hand side is going to be called a resource and this is called your resource tree and this is kind of the work area right here when we created that sprite it came up with a new window right here and you can have multiple windows open at a time but this window has information on that sprite like for example its name right here we don't want our sprite to be called sprite zero because that is meaningless we won't have any idea what that's going to do so let's change this right here I'm going to call s PR underscore player and that's all lowercase and the reason I'm naming it that is because s PR stands for sprite because we may have an object in our game that is also named player or we may have some other thing that's also named player most it's just going to be an object but because of that we want to make sure that we are naming them differently and they don't the names don't conflict because if you get conflicting names it will ruin your code and your game so we've created the sprite SPR underscore player now game maker has a built in sprite editor and if we do edit sprite it's going to open up game makers built in sprite editor now we need to press the new button up here to create the to create the image that's going to be assigned to the sprite and we're just going to leave it 32 width and 32 height that's measured in pixels you can see it creates a little image here of this little box but this image right here doesn't actually have anything in it it's actually just transparent so we're going to double click on it and it's going to open up kind of a paint editor like in Microsoft Paint and you can zoom in by scrolling in like this now what we're going to do for this sprite is we're going to use basic filler sprites in this first game and a filler sprite is just it's not going to be the finished product this is just temporary so you can start programming the game and then actually in later videos because I'm going to do a whole series for this so be sure and check that out in later videos I'm going to be doing I'm going to be doing some different sprites and giving you guys those sprites that you can use but for now we're just going to I'm just going to select this blue color right here and hit that I'm going to come over and click this paint option and fill this in and we're going to have that's our player is that blue sprite okay so that's looking really good got everything we need to do we're not going to worry about anything else inside of this we're just going to press okay and save our game so great you've got your first sprite we're going to create one more sprite for this RPG game because the basics of an RPG we're going to have a character that can move around and we're going to have walls that keep the character from you know going everywhere so we're going to create another sprite click on the pac-man actually you know what in this series I'm going to be doing what are called mini challenges so what I want you to do is pop what I want you to do is this is a mini challenge you're going to create your own sprite for the next object which is going to be a wall and it's just going to be the same thing we did only do it maybe black or gray whatever you want to do to represent the wall do that you can pause the video right now and go do that on your own okay hopefully you've unpause I'm going to show you how I would do it um just in case you ran into something along the way but let's do create a new sprite right here we're going to call this sprite wall give it a new name I'm going to edit the sprite let me create a new one and do 32 by 32 okay that looks good my double click on this come inside of here and I'm just going to get a gray color and fill it in that's going to be the wall actually I'm going to a darker gray just so I can see it and press the green checkmark the green checkmark and okay now I've got a sprite for the player and a sprite for the wall awesome now what our game needs is it needs some objects so that these sprites can actually do things in the room so we're going to come up here there's this little circle right here and clicking on that will create a new object for your game so we're going to click on that little circle and it creates a new object and look you can see it pops up with the window over here in the work area and creates a new resource over here in the resource tree and we're going to just name this obj underscore player so it's just kind of like the sprite that we did only obj stands for object instead of instead of SPR which stands for sprite now we can click on you can see there's a section under here where it says sprite and this section is what tells game maker what sprite is assigned to this object so we're going to select that and then select our player spread you can see over here on the right we get this our object now has that sprite assigned to it over here on the Left I mean now that we've done that we can press ok and we're done creating that object and assigning the sprite to it so we got another mini challenge here I'm going to ask you to create another object and assign the wall sprite to it and do that all on your own so you can pause video right now and do that okay great job now let me show you how to do it together so let's click on the object right here and we're going to call this out looks like sometimes I think that's a Windows 10 thing when it started doing that in Windows 10 but if you just press ok and then open it up again it seems to fix things so hopefully you don't have that issue but I'm going to name this object wall and then assign the sprite wall to it so we've got the player and the wall object okay now what we need the most important resource that I talked to you guys about just a couple minutes ago was a room or a level for our game so we're going to actually set that up we're going to create a new room and that's right next to the object one is this little window looking thing right here just going to create that and it's going to pop up this really big window with a lot going on here okay so we're going to name this one right here this room I just named mine our M for room underscore and I'm just going to name this one room number one so you can call it whatever you want for the width of this room I'm going to give it a width of 640 you can see automatically changes this if you zoom you can scroll to zoom out right here this is our room this gray area and the height I'm going to do 360 that's a basic that's a basic 16 by 9 aspect ratio we're not going to go in a lot of detail about that but that's a good size for our room now that we're inside of the room editor we can actually put objects inside of this room right here that we've created so if you come up here there's a tab that says objects ok you can see if I click inside of here it gives me options between the two objects that we've already created so I'm going to get the wall object and I'm going to place it in the room and if I hold down I can drag it around or I can click on it again and move it if I right-click on it it gives me some options to delete it ok so there's a lot of options you can see as these little teeny boxes around its corners too and that's really useful I'll show you why let's put a all all the all the way around the outside of our room here so I'm going to grab this wall right here put it right there and we could go through and put little objects all the way around but that's going to take forever you know we don't really want to do that if you hold control you can just right click to delete them you don't have to have the little window come up so control right-click you could you'll also notice that my my room editor is snapped right here there's a snap 32 by 32 and that's a good size because both of our sprites are 32 by 32 so that's that makes it easy that's a good snapping but we're going to click on this wall object and were going to grab this bottom right corner and we're going to drag it all the way down to here so we have one wall object that we've stretched down to cover that entire tire area now we're going to create another one right here we're going to grab the right top right corner and drag it all the way over here another one right here drag this all the way down here and another one right here and drag this all the way down here now just to keep things a little interesting I'm going to put one right here drag this down to about I don't know here and I'm going to put one right here and drag this down to here now what you can do you might already be ahead of me on this you can click your player and place him in the room as well him or her maybe it's a girl I don't know could be a girl so place your player in the room as well okay you've created your very first level congratulations now we can press the green checkmark and save our game again and we can at this point you can actually run your game you can press the green check or the green play button up at the top and it's going to compile your game and then it's going to run it whoops I've got mine set to html5 sorry up here at the top you can have a target that you want to set it to you'll want to set yours to Windows ok because you have to those are those actually cost money if you want to do is okay so we've got our little game here and nothing happens that we can't do anything it just shows the game or players in the room and nothing happens at all well that's because we haven't added actually any programming or events into this game and things that are going to happen so that's perfectly all right but let's get started doing that because that's going to make things quite a bit more interesting let me close out of this double-click on your player object and it's going to open up and you can see inside of the player object properties right here we have a section for events and a section for actions now an event is kind of like the when and an action is kind of like the what so for example an event could be when the player presses the space key and the action could be make the player jump right the what the what could be make the player jump when the space key is pressed what make the player jump okay so we're going to add a new event well actually uh one of the things that I'm going to do in this game is to simplify things I'm going to use game makers built in physics objects because that's going to simplify the collision system and it sounds complicated to use physics but it's actually really easy so I'm going to show you guys how to do that the first thing we want to do is go into our room again and go to physics up here at the top now you're going to want to check this room is physics world box right there check room is physics world and then we're also going to check and then you'll see here they've got gravity you also want to set both of these to zero point zero this one starts out at ten point zero well we want to put both of them to zero point zero because this is going to be kind of a top or more like an isometric when we get the other graphics in kind of an isometric game so we're going to set the physics on the gravity to zero on both of those okay and you can press the green checkmark and that part's done now open up your player object and open up your wall object well just one at a time open up the player object check the uses physics box right there and it's going to add some extra things over here okay you don't have to really worry about these other than the collision shape we're going to want to change that to a box instead of a circle and we want to make sure that this collision shape aligns with our sprites we're going to go to modify collision shape and it's going to bring up this window right here now in this window this yellow box represents where the collision is for this object but that doesn't align up with our actual sprite here you know you can see it's a little bit over to the left so if you move this right here and move this down here to where it lines up now the collision should match up with our sprite like that and we're going to press the okay button so we've created this physics object now just by checking users physics and modifying the collision shape right here and making sure that one box to create a physics object great now open up the wall object and we're going to do a mini challenge turn the wall object into a physics object as well see if you can remember how to do it I'm going to pop or you can pause the video right now and then I'll come back with you in a second okay great job now I'm going to show you how I would do it I use check the collision box right here for uses physics and then I do switch collisions shape to box and modify the collision shape and I would come in here scroll for zooming and I would align this to where it match up with this sprite and press the okay button so now we've created the wall object as a collision object as well now this particular wall we don't want the player to be able to move them we want them to be so heavy and solid that the player can't move them now the secret to making an object so heavy and that nothing can move it in the game is the density right here and we want to give it a zero point zero density what that essentially does is it gives it an infinite weight or matte infinite I guess weights a good example to where the object can't move at all nothing can it's got infinite weight and that's what we're going to do with the wall object okay so now all of our objects and our room are set up to be able to use physics so the rest of this is going to be really really easy to program open up the player object and we're going to add movement to this player object so we're going to add a new event we're going to add a win and we're going to go to keyboard and we're going to go to write so we've added this new event which is when the player presses the right key on the keyboard okay that's looking good now we're going to come over here to our actions and on the side here we've got a lot of different actions some of them are built-in actions with game makers drag and drop functions that you can use but I don't really like to use those I like to get people started on programming and even though this is very basic I'll only show you some really simple programming we're going to start with programming so go to the control tab over here and you'll see a section for code and over here on the far left there's one that is create an or execute a code you're going to drag that over into here okay now inside of this little action if you do three slashes like this there's a way to change it so that this doesn't say execute a piece of code anymore it changes that we're going to set this to move right okay now this is an actual code this is just called a comment but what that does is it makes it so this action now is labeled move right okay but if we run our game and try and move right it won't work we're not actually moving yet this is just a code it's like a label or it's not a code it's like a label so now we actually want to move our character to the right now inside of game maker it's game maker set up on a grid system if you've ever played battlefield or something like that imagine that where you've got a grid in the top top-left corner of game maker is position zero zero and every single object in the room has an exposition and a y-position the exposition is horizontal on this grid and the Y position is vertical on the grid so if we want to move horizontally we need to change the x position of the object right and to move an object to the right you add to the x position of the object to move it to the left you subtract from the x position of the object but because we're using physics we have to use the physics exposition so we're going to do pH Y position X so that right there stands for the physics x position and what we're going to do is we're going to add to that now you can set that equal to something if we do physics x position or physics position x equals 4 what that does and I can actually show you let's run the game now because we actually have some code that it's doing oh and real quick I always put this little semicolon at the end of my code okay it's not a hundred percent necessary you can leave it out but it's a good habit to get into so put that little semicolon at the end of your code let's run our game and see what happens when we press the right key okay so our player jumped clear over there to the left hand side of the room that's not what we wanted to happen well what it did was it set the players x position to four it didn't add 4 to it it set it to 4 well if zero is all the way to the left then 4 is almost all the way to the left so it basically just put it 4 pixels from the left side of the room we don't want that what we want is we want to add 4 to its current position and the way you do that as you do plus equals so physics position X plus and then an equal sign equals 4 so plus equals 4 now what happens right when we press the right key is that our object is going to move to the right you've already got a moving character that's really awesome okay now we're going to do another we're going to do a mini challenge I want you get I want you to add in the keyboard left event and add in moving to the left so pause the video right now and go do that okay great job I'm going to do it with you show you how I would do it I'm going to go add a new event keyboard left key and then I'm going to drag over a code action right here under the control tab code execute a code I'm going to put through a comment here that just says move left it's not code it's just a comment and then I'm going to do pH Y position Y minus equals instead of plus equals four so if you weren't able to figure that out that's okay because it was a little bit tricky but hopefully with my help you were good now what we're going to do is we're going to quickly add in up and down as well so let's do add a vent keyboard up drag over a code name I'm going to do the triple slash there move up okay now the Y position in game maker is opposite of what you would think up is actually negative and down is positive so with with the x position right to the right is positive and to the left is negative but with up it's a little bit different from what you would think up as negative down as positive so we're going to do physics position position y minus equals four and actually I just realized that I made a mistake and this is a really easy mistake to make so if you did it to that's okay let's go back into our left event right here and open up this code action you can see I used physics position Y Y is vertical that's not going to work we want to use X X's for horizontal movement subtracting from the X is going to move left adding to the X is going to move right but go back into your up now and we've got move up and that's looking really good there now I want to do a mini challenge I want you to add down in so I'm going to pause the video and add in down okay now that you've got that done I'm going to do it real fast so keyboard down control tab grab a code move it over move down physics position y plus equals four remember it's opposite down and the y is actually positive okay that's looking really good we've got all the movement let's see what happens in our game when we actually run it and use the arrow keys to move around in the room that is awesome our character can move anywhere in this room we've got complete control of our character and this is already starting to look like a pretty good RPG project well maybe not the graphics the graphics don't worry about those though I'm going to give you guys graphics I'm going to show you guys how to apply graphics in the next few videos so you can be excited about those but you've got the movement down you've got the programming already down but there's one big flaw and I'm sure you've already noticed it which is that we can go through walls and we don't really want to be able to go through walls so let's fix that all you need to do if you're using the physics system is add an event add a collision event with the wall inside the player so the player has a collision event with the wall now we need to add something we need you technically don't have to have an action except the game maker will remove the event if there's not an action there so we need to add an empty action basically so we can drag over this code right here and we can put a comment here that just says collide and this is just an empty action that doesn't do anything really except that it makes sure that this collision event exists so once we've done that we can press the green check mark and press play and you'll see that we can now collide with the walls and look it's kind of funny because when we go around corners and stuff because we're using the physics it automatically like turns the turns the block now we don't really want that to happen okay so I'm going to show you guys how to do one more thing and this last thing is kind of important as well we're going to add a new event this event is called the create event now a create event in game maker runs only when that object is first created so right at the start of the game our players created and so it's going to run this event we only need to do this on the create event and it's got a little light bulb so add event create event now go to control and drag over a code action right here and we're going to sit we're going to call this create event on set fixed rotation so we now we need to set the rotation so it won't rotate when it goes around corners and stuff like that you just do physics fixed rotation rotation if you can spell it right equals true okay so we're just setting the fixed rotation which means you can't rotate equal to true and that's it now you should have your very first game your very first RPG game I hope this gets you excited I've built a lot of games uh in my day and I really really love building games and game maker studio is a great resource for you and the indie game development scene right now is huge so learning how to do this kind of thing can be really exciting and fun and I'm excited to start this journey with you guys as you're creating your very first RPG I'll help you every step along the way hopefully this video was good for you you learn something you step to the mini challenges you did some of it on your very own and you've hopefully grown from that so thank you so much for watching this video if it was helpful to you share on Twitter you know share it with your friends if they want to learn game development as well and I'm going to post my website this video so that you click on that I actually have a lot of other tutorial videos I have a book on game maker and I actually have a game maker course on udemy as well so if any of those things interest you you can check them out on my website but thank you guys so much for watching and I will talk to you guys later
Info
Channel: HeartBeast
Views: 953,601
Rating: undefined out of 5
Keywords: GameMaker Tutorial, Game Maker, GameMaker Studio, RPG, Game Design, Game Maker Studio, Game Development, Indie Game, Indie, Pixel Art, Tutorial, Video Games, Game Builder, Programming, Coding, Art, Easy, Quick, Role-playing Game (Game Genre), Video Game (Industry), Game Programming, RPG Programming, RPG Game, Build a Game, Make a Game, RPG Maker
Id: WB2alpO62GM
Channel Id: undefined
Length: 31min 18sec (1878 seconds)
Published: Tue Aug 25 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.