GameMaker: Studio 1.x - Basic Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
alright guys welcome to tutorial number one for game maker studio what I'm going to do today I'm going to walk through very very very simple project basically going to show you how to make the little intro little intro game that I made in the the load the last video with a little like that scrolling clouds and the smiley faces you probably remember from the last video so the reason I'm starting that that's super super low level is because that project will basically take us through the like the four basic sort of building blocks of of any given game in game maker and it will take us through it'll basically explain to you if you're coming into the software but the very very first time how game maker works how all these elements actually fit together to create a game so I want to go through that and make it as sort of as clearly as possible what all these kind of elements are and how they interact with each other so that you you know you have a starting point and you kind of understand what the hell is going on when I'm doing stuff in later tutorials so you'll have to bear with me if you already know all this kind of crap um the yeah I am basically just going to start super super basic with this so go ahead start a new project quote whatever you want on a core tutorial or one I guess will do and hit create won't save the changes to my last thing then when it saves out that it'll create over here a blank project Explorer for you the project Explorer is basically where all the different elements and resources of your game are kept so all your sprites and sounds and objects and stuff are all captain in this area of the screen better find pretty much everything to do with your game over here the project we're going to be starting with today is basically going to walk us through four of these sort of major categories and show you how they kind of work together so we're going to look at sprites we're going to look at backgrounds objects and rooms all together we're going to start off with rooms so go ahead and right-click on room and go to create room our room is rooms are basically the levels or I suppose a better term is the screens of your game so like your menu might be a room your savegame might be a room and every level of your game might might be a room they basically sort of big like containers for rules like your your objects and backgrounds so and this is our very first room over here it's totally blank at the moment we can click this get rid of this this grid we've got going on and yeah it's just big empty grey room by default 640 by 480 if we go to settings over here we can set the name of the room while I set this I'm going to say something about naming conventions it's very important to give all the objects and resources in your game like sensible names so that when you're referring to them in code it makes things a lot easier and just makes everything a lot more organized and a lot easier to deal with you'll probably ignore this advice a little bit for a while and then you'll start to see why I gave it in the first place when your project becomes like a total mess of different objects that like you have the same name as each other and you get naming conflicts and all that kind of stuff so what I tend to do for naming conventions is I'll write like a two or three letter acronym but sums of the type of objects I'm using and I'll use that same acronym for every object of that type and then I'll put an underscore and then just assign a name that makes sense to me with no capitalization throughout so the everything just so that everything is consistent so for rooms I use RN which already typed underscore and say that this is like level one of our game I guess we'll just call it little one I guess or actually you know we're gonna make that that that this guy thing we'll call it the sky rule so this is the room sky room so if we hit tick just to save that out you can see it's changed the name of the room then open it up again we go to settings and we can say it see over here as well we've got the width and height sayings these for now you really basically need to know is this this is the the number of pixels in your room so if you change this to say one or two four you can see like in real time how that's made made the room a lot wider than it was before and we'll leave it at that will have a big white screen scrolling clouds room and the height over there is obviously the same we're not going to change that because my background clouds don't seem vertically so they only seem horizontal they only are only seamless when they scroll horizontally so we're going to leave the height at that speed a very very important value actually sets the the frame rate or the target frame rate at the very least of your game which determines the rate everything runs out in terms of the number of frames per second so what that also means later on when you do some coding and stuff is the everything most things in your game will revolve around what's called the step event which is an event which happens every single frame of your game so when something is moving it moves a little bit every frame or you know and so on so forth and the reason that means your frame rate is important is because those events are going to run that many times a second then it will give you an idea of how timing and everything is going to work in your game so but for the most part like you know getting ahead of myself a bit on that all you really need to know or all you really need to do at this point is set this to a sensible figure if you play games you know like 60 FPS is a pre sort of standard tutorial so if you set sexy to 60 suppose it's all smooth smooth speed like for your eyes to look at and all that kind of stuff so 60 FPS um so that's rooms next thing we're going to do is look at backgrounds so if we go to backgrounds right click and hit create background will create a new background again we want to give this a sensible name just as we did with our room so we're going to call it V G underscore sky or beat you understood clouds I guess because that's basically what they are what background is actually before I loaded is basically a static image for your game that doesn't have sort of any interaction or sort of mobility for so well you know sprites and stuff are used for objects that like animate and move around it can be controlled and stuff backgrounds are for things like like clouds for example or anything in the game that well they can be manipulated or moved around and sort of limited sense by the code they're mostly for things that the staff and don't root don't have any real sort of interactivity so if we go to load background we can use an image I made earlier which is this seamless clouds you've seen it before if you've seen the last video just a seamless image seams horizontally like so we can scroll horizontally I'm going to show you how to do that right now actually so if we hit OK and we'll come back to our room now we've got BG clouds and our project Explorer we've got two things now got I'll just go back in backgrounds we've got eg clouds rooms that got room Skyrim so you can see how the project is starting to sort of take to take some shape and that's how so the project is structured all your stuff is over here so to set that background we go to our room we go to backgrounds and we're on background 0 you want to take visible rain room starts that just you know exactly what it says on the tin it just means so you don't have to turn the background on through code which you might want to in some situations but for now you know you you just want this background on all the time so click visible when room starts and then just pick the image do you want to use BG clouds you can also set foreground images that means they will basically show on top of objects and things in your game so you know for whatever reason you might want like a UI element or something to be a foreground image instead of a background image but either way you can see how it's already set linker by default to tile like horizontally and vertically I can show you a tiling vertically as Wi-Fi sir like this is 700 you can see how it's tiling down but you can see it's it's not exactly seamless when it tiles with equally so I'll leave that 480 for now so it looks nice and pretty go to backgrounds again and the other setting down here we want to set is horizontal speed which is basically just an automated way of making the background scroll super useful you can make it scroll diagonally by saying like vertical speed if we set horizontal speed to 1 and we just save actually real quick and run our game and finally there we go we have our scrolling clouds so as you can see here they are scrolling at a nice 60fps they're scrolling and what I like I was saying before with 60fps is that's basically it's running one this horizontal speed is moving your clouds at one pixel every frame of your game so this is why it's very important to know what your your room fps and your target fps so that is because it's basically running that code to move that one pixel every single frame so basically you're going to be moving sixty pixels every second when you're running a 60 FPS this isn't quite a 60 FPS I don't think because I'm recording this video at 30 fps so that might be having an impact as well and it might be moving faster than this otherwise but I think this is still still looks kind of right to me so I think it's okay so as we see we have our scrolling clouds there if we wanted to move it in the other direction well we can do that horizontal speed by default you know it sets the value to how much it moves to the right so if you set this to a negative value like say negative 2 for example and then run the game again you can see it's scrolling left at a much faster twice the speed that it was scrolling right because it's at minus 2 and yeah that's pretty much all there is to it you can make it move diagonally I mean this will look terrible because it doesn't seem properly by just saying like a horizontal speed and a vertical speed you can see it's going rolling vertically and so we suggest set set that back to a sensible by maybe just just grow one to the to the right so that's backgrounds pretty much um the most basic level will cover like placing tiles and stuff another time um the basically that's all you need to know about how to make the scrolling background so I'm going to move on to sprites so a sprite is basically a visual element of your game for anything that's like animated or like is controllable or interactive we'll probably be using a sprite so right click on sprites and go to create sprite give it a sensible name as we do everything else this is just going to be those little smiley smiley do it's from before so I'm just going to call it s BR underscore smile go to edit sprite and this is the sprite editor where all the frames of like a given animation will be shown or sprite contains basically one animation like a South frames basically that's probably the best way to think of sprite is a set of frames and you know the there what you need to create objects and stuff with like for your characters and things like that so if we go ahead and make a new sprite in here I'm going to edit and we're just going to very quickly throw together as quickly as I can in this tool the little smiley face from before make those eyes a bit bigger make them super happy let me go and we track this out for space um got that yellow again go like a small black and do this there we go super happy sprite looks super happy and basically that shows you image zero there well that means is that's like the very first frame of the frame of the sprite so I mean if we add more in here you can see how it's creating like an animation and showing you like the result of that animation over here you can play that back as specifically make sure to set that link to the speed that your room is at so you can see exactly how it will look when it's actually in your room we don't actually need any animation for this this dude at the moment though so we're just going to leave it at that and hit tick and some other very very important options in here which I will cover probably I'll cover collision stuff in a later tutorial origin is very important and I'll basically cover that you know after we've gone through objects and I show you how to put this put these some smiley faces into your room I'll show you what the origin doesn't lie that's important but for now go ahead and click OK and we have our sprite smiley face now we need to basically assign that smiley face to an object that can actually place in the room because at the moment that's just a just an image it doesn't mean anything by itself it's not placeable it's just an image resource that other objects can use to display themselves so we're going to look at objects now so go ahead right-click on objects and go to create objects on one object is objects I suppose are pretty much the most important element of your game they're basically the containers for all interactivity and leg controls and like characters and stuff in your game all come from objects so we're going to just make an object to represent our little smiley guy we're going to call this obj underscore smile you can see now whether I the naming convention becomes handy because we have the sprite for smiley face and we have the object and we need to be able to tell them apart so you know putting the the type on the beginning helps you learn that this is the sprite and this is the object which is very important when you're in code and like you say you want to move like if you had these names the same thing for example you wouldn't be able to do something like move smile by 5 or something like that because they wouldn't know what you were referring to the sprite or the object so it just it helps you out and it's very important to have it's good naming convention so we call this obj underscore smile we've said it sprite to SBR underscore smile and so now we have basically we have the basics of an object actually we're going to click OK and save that our objects underscore smile go back to our room go to objects and we click object to add with the left Mouse as our object editor and click object smile so not the editor it's object placement even we can use this to place these smiley guys or around our room what's cool and GameMaker studio now is that you can set a lot of like base properties of this price within the object places so I can set this to be a particularly huge version of this sprite for example and set it to have like a predefined offset like this and move it around a bit like that just with the left mouse button there you can see all the different controls the like moving and adding objects removing them and linked moving around your room are all listed here so just take a take a few minutes to get used to those whenever you want so right now we have the objects in the game we can actually run that let me show you that in turn it into turn there we go and there's a smiley face that's not really doing anything but there in the game those are our objects at the moment so go ahead and close that what we want to do now is add the the interactivity to the game the well I'll just add not really interactivity since you're not really interacting with those smiley faces but make them rotate around and do that little fantasy effect I had before so first of all I'm just going to talk a little bit about how objects do things in your game they basically run off of these two big columns here events and actions what an event is is something that happens in your game so like the object just got created the room just got created the the player hit the left mouse button the player hit like a on this keyboard a certain amount of time has passed you know basically any sort of condition or event that the computer can pick up and say oh this thing has happened now I need to do this thing which will be all of that anything that you put into here which is actions so stuff that happens when events happen and that's more or less the structure of how everything in your game works so for example I'm going to add an event and I'm going to say actually instead of a rotation I'm gonna just just so lit it slightly interactive I'm going to add some keyboard stuff I'm gonna say every time we hit the right arrow key so now we have an event of the keyboard event for the right arrow key so every time we press the right arrow key everything that's in here will happen so I mean we can place various different actions so I mean we could set it to like scale to sprite or move the sprite around when we when we place the right mouse button so if I set like every time you press right move freely in Direction I can remember now exactly how the directions what I think directions zero think that might be right a car member has some sort of arbitrary system of degrees for direction where lay is it's 360 degrees and once you work out where it starts is easy to work out what direction is but we'll say 0 for now whatever direction that happens to be and say move - every time you press the right mouse button so let's just see what that does when we run our code now so we have all these objects here if I press the right arrow key tada they're all moving to the right I only had to tap it once and they will move like that forever because that's that's pretty much all I told it to do is when I press right started moving towards the right we can make it move like strictly like one space to the right like with different actions but I'm also going to just show you how to basically do that through code if we go to control over here and go to code and this little little bit of script here is just execute a piece of code and this is pretty much the most powerful form of functionality you can have in game maker allows you to do pretty much any of the actions over here if you know how to write them in the coding language in game maker along with a bunch of things that you just frankly can't do with these these drag and drop actions over here these will get you quite far for a while but I honestly recommend honestly just start diet straight into code and leg I mean there's hundreds of resources out there I'm planning to teach a lot of this sort of coding stuff as well but yeah I honestly recommend getting into the coding as quickly as you can because it's just honestly I find it easier to work with like it's it's so annoying when you can't find the exact right thing that you want to do through these actions over here when you know you can just write a couple of lines of code that will will do it all for you so for example um I mean this might just like blow your mind entirely and you have no idea what I'm doing here but I'm just going to write a piece of code that moves you to the right by like two pixels every time well whenever you're you're holding the right the right arrow key so you know we already know that you're holding the right arrow key because that's our event so you don't need to write like an if statement written like that so what we're going to do is take our x coordinate which is X and type a plus equals which means to add 2 X 2 um pretty much that's all there is to it that will move those two pixels to the right whenever we're holding right there's different ways you could write that you could a X equals itself plus two but the easiest way to do it is to do what I just did which is plus equals British adds two I mean you can do things like minus equals to take away my kind of stuff all that code is will be covered later and it's covered by like help menus in game maker and all that kind of stuff so basically that's what that line of code does so if we hit tick now we've replaced our our action earlier with this this little bit of code and we've run that now and we press write whenever we're by pressing this button it's it's moving us to two pixels to the right every frame while holding the button while we're not holding the bone it's not doing anything creating if T so you can set up events like that for left or down and you can pretty much imagine from that how you get for directional movement um obviously to move in the Y direction you would just pick Y X on what you want us you know to move up and down to move left instead of right you would obviously just subtract two which is going to be a bit weird me pressing right to move left but yeah that's how that happens and so yeah that's the very basics of how interactivity and stuffs works just to finish off just to create what we had in the intro video is I'm going to delete this event well you're going to add what's called the stepper then a very important event for me to actually cover what this does is this event will run regardless every single frame of your game as long as as long as the object exists while the object is in your game and frames are happening so 60 frames a second you know frames frames are pre processed by the game every single one of these frames the events in here the events are the actions in here will be carried out so if we go to code now for example if we do the same code X plus equal to hit the tick and hit f5 you'll see that they're just moving to the right by themselves now because they're every single frame of the game they're moving right to pixels so if we want the object to do what it did in my intro game was to do image underscore angle you actually probably if you watch the video you see me writing this code right at the start of the frame style video but if we type image angle plus equal add one for now plus equals along well that does is very similar to what we just did before where we wrote X plus equals one we change the the X property of the object to be enhanced by one every time and now we're just changing the angle of the object to be added one if we put minus one it would rotate it in the other direction you know so image angle is equal one so what that should do now hopefully is yet we see our object rotating we even see our massive one rotating so that's pretty much it really that's that's covered all the plot basic elements of playing very simple games together in game maker obviously doesn't show you how to do a complete game but it does show you pretty much all of the basic elements of a project in game maker and how sprites interact with objects and how objects execute functions and how they get their interactivity how to make a room how to set up backgrounds and all that kind of stuff so now that you know all the basics I can go into actually doing like add some like game projects and that kind of stuff in my future videos but for now I just really wanted to cover all this basic stuff and basically get everyone on the same page in terms of how so it's going on so no one is totally left in the dark when it comes to you know why I'm doing the things I'm doing later on so yeah thank you for watching guys and I'll see you on the next episode
Info
Channel: Shaun Spalding
Views: 1,607,733
Rating: undefined out of 5
Keywords: Game Maker (Video Game Engine), Game Development, Indie Games, Indie, Games, Tutorial, Information, Learning, Tutorial Series, Game Maker Studio, Steam, iOS, Android, HTML5, Windows, Making Games, How to make games, Basics
Id: hzMNunoPd0o
Channel Id: undefined
Length: 23min 57sec (1437 seconds)
Published: Sat Nov 17 2012
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.