PDA

View Full Version : GameMaker: Studio - First Game! (With Pictures!)



ModSim
01-23-2016, 08:57 PM
Hi Guys! I figured, that because I have learned pretty much all there is to GameMaker, that i would help others get started with their dream of being a developer! To start off, you will need GameMaker: Studio, which you can download from their trusted website here:
http://www.yoyogames.com/studio/download

What we will do after it is done downloading and installing, is open it up of course :p

You should be greeted with a window like this:

109254

Click "New" Right where I have circled it.

Then, click where it says "Project Name", and make it whatever you want. Then press "Create"!

You should now be greeted with a window like this:

109255

Now, there is a section called "Sprites", right click it and click "Create Sprite".

A window like this will show up:

109258

Name it either "spr_player" or "player_spr". Everyone does things differently!

Then click "Edit Sprite".

Now, click this little folded page, and click "Ok". It should be auto set to 32x32.

109260

Next, we will draw a sprite. There are several tools, so draw whatever you want.
Be sure you click the sprite you just created, otherwise you can't draw on it.

Be creative :P :

109262

Click the check-marks, to automatically save, and exit. Be sure to center the origin from clicking "Center".
109263

So, now that our sprite is done, we will create an object. Our object is what is placed into the game and does the actions we code.
We do this by the same exact thing we did wit sprites. Just right click the object section, and click "Create Object".

Now we name it "obj_player" or "player_obj".

We need to assign that sprite we just created, so to do this, we have to click under where the word "Sprite" is.

109265

Assign the sprite, then we add an event. We will add the step event.

So, to add code, we click over on the tab bar, we click "Control".

109266

Now, drag in the "Execute Code" Function. It is under the "Code" Section.

109267

So, we have a code window. What we will do, simply because I need to save space in this post, is I will just put the code for copy and paste.



//Movement
hspeed = 4 * (keyboard_check(ord('D')) - (keyboard_check(ord('A'))))
vspeed = 4 * (keyboard_check(ord('S')) - (keyboard_check(ord('W'))))


//Collision
if hspeed!=0
if !place_free(x+hspeed,y)
{
if hspeed>0 move_contact_solid(0,hspeed)
if hspeed<0 move_contact_solid(180,-hspeed)
hspeed=0;
}

if vspeed!=0
if !place_free(x+hspeed,y+vspeed)
{
if vspeed>0 move_contact_solid(270,vspeed)
if vspeed<0 move_contact_solid(90,-vspeed)
vspeed=0;
}

We will also need a wall. So just like before, create a sprite, just a simple square will work PERFECT! Then, create an object, and assign the sprite, BUT in this object, we will need no code. We will need no events, just simply check "Solid".

109268

So, we have our sprites, we have our objects, now we need a level. In GameMaker, we use "Rooms". They just mean level pretty much. So, just like objects, and sprites, we create a room the exact same way. Right click the room section, and "Create Room".

The room's GUI, is kind of confusing at first look, but gets really easy after a while. Here is what it will look like:

109269

Finished Product:

109273
So, from the movement code we used, we walk with keys "A", "D", "S", "W".

So, first of all, where it shows the "Width" and "Height" of the room, we want to set Width to 640, and the Height to 480. Now, go to the "Objects" Section in the rooms tab bar. Then, select obj_player, and place in, and throw in some walls. Then you can run the game and see what happens! If you guys encounter errors, post them and i will tell you what is wrong, and if it worked for you, and you want more tutorials, I am happy to do it!

Oh, and by the way, if your player is not a perfect square, you have to do this to fix collision issues!

109271

If your wall is not a perfect square either, create another sprite named "spr_mask" and make it a solid red square. Mask all imperfect objects to it for perfect collision.

CYA!!!!!!!!

MyLegGuy
01-23-2016, 09:40 PM
There's already tons of Gamemaker tutorials everywhere.

ModSim
01-23-2016, 09:43 PM
There's already tons of Gamemaker tutorials everywhere.

So? 10 letters

ModSim
01-23-2016, 10:05 PM
This is a good tutorial, and I might try it if I learn more programming. For now, I make games with MMF2.

Never heard of it xD

MyLegGuy
01-23-2016, 10:17 PM
So? 10 letters

This isn't really needed.

And this isn't really that good of a tutorial.
You don't explain the step event, or any of the code.
Somebody with no experience would be confused.

ModSim
01-23-2016, 10:30 PM
This isn't really needed.

And this isn't really that good of a tutorial.
You don't explain the step event, or any of the code.
Somebody with no experience would be confused.

Okay... Odds are, people aren't looking at RTsoft for gml tutorials

mrthadawee
01-23-2016, 10:36 PM
Personally I like Construct 2 better, but that's my opinion, both offer basically the same stuff, I find Construct 2 to be just that more simpler..

Not a bad tutorial, but surely wouldn't someone with the program would look at the official site for some tutorials first?, just my thoughts initially at least...

I'm gonna add in one more thing, generally I like my sprites on a 2d platformer to be generally small (memory isn't an issue, it's just it's much easier to make smaller sprites and have the camera pan in to that size), I'd go 32x32, because IMO it's easier to work with. Also I find a neat little trick to do is to warp the width based on a certain variable if you want the sprite to for whatever reason grow or distort, handy for making crazy mirrors *cough* like in Growtopia *cough*.
That's just one of the thousands of things you can make using these game making programs, it's actually quite fun to tinker around and make stuff with, when you get the general idea, the rest falls into place over time. Still interesting to find out what people can do with stuff like this.

ModSim
01-24-2016, 05:32 AM
Personally I like Construct 2 better, but that's my opinion, both offer basically the same stuff, I find Construct 2 to be just that more simpler..

Not a bad tutorial, but surely wouldn't someone with the program would look at the official site for some tutorials first?, just my thoughts initially at least...

I'm gonna add in one more thing, generally I like my sprites on a 2d platformer to be generally small (memory isn't an issue, it's just it's much easier to make smaller sprites and have the camera pan in to that size), I'd go 32x32, because IMO it's easier to work with. Also I find a neat little trick to do is to warp the width based on a certain variable if you want the sprite to for whatever reason grow or distort, handy for making crazy mirrors *cough* like in Growtopia *cough*.
That's just one of the thousands of things you can make using these game making programs, it's actually quite fun to tinker around and make stuff with, when you get the general idea, the rest falls into place over time. Still interesting to find out what people can do with stuff like this.
True. Also why did you make that your profile pic, it would be cooler if it was you when you where a mod. Just my stupid judgmental behavior :P

mrthadawee
01-24-2016, 08:45 AM
True. Also why did you make that your profile pic, it would be cooler if it was you when you where a mod. Just my stupid judgmental behavior :P
Because I prefer the look of the One Ring.

Also, it seems somewhat egotistical to have a profile picture that implies I am a mod when nowadays I'm not a mod. There's tons of screenshots out there of me when I was a mod, I just don't see it as something to flaunt around like that.

Kittens
01-24-2016, 01:04 PM
this looks like a more complicated version of scratch.mit.edu

ModSim
01-24-2016, 02:13 PM
Because I prefer the look of the One Ring.

Also, it seems somewhat egotistical to have a profile picture that implies I am a mod when nowadays I'm not a mod. There's tons of screenshots out there of me when I was a mod, I just don't see it as something to flaunt around like that.

I like your logic m8. It does not really make sense to have a profile pic of a mod when your not a mod :P

- - - Updated - - -


this looks like a more complicated version of scratch.mit.edu

Personally, I find scratch useless .-. It doesn't really teach you anything about coding, but I guess it inspires them to learn??

MyLegGuy
01-24-2016, 10:10 PM
Okay... Odds are, people aren't looking at RTsoft for gml tutorials
Doesn't that just prove my point?

ModSim
01-25-2016, 02:25 AM
Doesn't that just prove my point?

Mkay, some people on the forums may be looking around here, in the development section, looking for tips on making a game. I learned to code without my code being described in a way anyone could understand. I actually learned to code from the guidebook built in to GM: S. So if they need to see what it means, they could look at the functions in it ey???

peck
01-25-2016, 05:11 PM
Im just going to critisize that move_to_contact and using gamemakers solid feature is few of the worst ways to do collision. The use of hspeed and vspeed is also very horrific if you wanted more control over the speed.
You should be manipulating x and y over your own xspd and yspd variables and moving to contact would be more optimized to have been made yourself. The more you use built in functions and features the less you get to change.


//horizontal collision
repeat(movespeed)
if (!place_meeting(x+xspd,y,parSolid)
x+=sign(xspd);

Now with this, any object of your choice that has the parent of parSolid, is now solid.

ModSim
01-25-2016, 09:38 PM
Im just going to critisize that move_to_contact and using gamemakers solid feature is few of the worst ways to do collision. The use of hspeed and vspeed is also very horrific if you wanted more control over the speed.
You should be manipulating x and y over your own xspd and yspd variables and moving to contact would be more optimized to have been made yourself. The more you use built in functions and features the less you get to change.


//horizontal collision
repeat(movespeed)
if (!place_meeting(x+xspd,y,parSolid)
x+=sign(xspd);

Now with this, any object of your choice that has the parent of parSolid, is now solid.

That is more of simple collision, but it still does the exact same thing. It is really no different than doing:



if(!place_meeting(x+<SPD>,y,<WALL>)) {
if(keyboard_check(vk_right)) {
x += spd;
}
}


Then, just doing this to all keys and directions. I have chose to use that code above. Although it is not the "simplest", it works better than any of the other collsion.

peck
01-26-2016, 05:33 PM
That is more of simple collision, but it still does the exact same thing. It is really no different than doing:



if(!place_meeting(x+<SPD>,y,<WALL>)) {
if(keyboard_check(vk_right)) {
x += spd;
}
}


Then, just doing this to all keys and directions. I have chose to use that code above. Although it is not the "simplest", it works better than any of the other collsion.

It is entirely different from the next piece you just posted.
Your tutorial example is pixel perfect collison while using an absurd amount of cpu cycles. My piece is pixel perfect collison in an optimal way. And the code you just posted claiming to be the same thing has no pixel perfect collision and is a mistake all GM noobs make.

Not only does your tutorial example use more cpu cycles with move_to_contact, but the use of built in variables will have a domino effect on how many more if statements you're going to have to write to account for these variables that will always take immidiate effect.

If you dont understand what you're doing entirely and want to share it here, have it approved and criticized in gm forums before you start a generation of games that use 20mb ram for a hello world.

VendLolx
01-30-2016, 04:41 PM
There's already tons of Gamemaker tutorials everywhere.

So?

............

- - - Updated - - -


There's already tons of Gamemaker tutorials everywhere.

So?

..............

peck
01-31-2016, 04:21 AM
So?

............

- - - Updated - - -



So?

..............

The point is hes making a copy of tutorials that already exist and are best found elsewhere, and his tutorial isnt even a good one. I think it wouldve been more helpful making a list of GM tutorials as introducing to the community instead of trying to make a new one. Though its cool for people to actually take a step up and be willing to spread it, I think they need to be a little more credible.