Hey all, thanks for checking out this little series! If you want to help me make more videos like this (full turn-based RPGs, platformers, zelda-likes, beat 'em ups, etc), check out my Patreon! www.patreon.com/peytonburnham That'll help me focus more time on these videos and there's a bunch of cool perks like getting videos before UA-cam does, voting on future series, and getting the project files and assets from future videos! Thanks!
i have a question, when i try to run it why does it show this? ############################################################################################ ERROR in action number 1 of Step Event0 for object Player_1: trying to index a variable which is not an array at gml_Object_Player_1_Step_0 (line 1) - right_key = keyboard_check[vk_right]; ############################################################################################ gml_Object_Player_1_Step_0 (line 1)
You have no idea how much i appreciate the humour at 19:25. As much as I love learning, tutorials are always a bit of drag. You added some fun without dragging it on too long and got us back to work. Respect
For anyone wondering how to make WASD movement instead of the arrow keys, simply replace them with the letters like this: right_key = keyboard_check(ord("D")); left_key = keyboard_check(ord("A")); up_key = keyboard_check(ord("W")); down_key = keyboard_check(ord("S")); if you want both to work just like I did, just put the "||" symbol, which means "or", between one and another like this: right_key = keyboard_check(ord("D")) || keyboard_check(vk_right); left_key = keyboard_check(ord("A")) || keyboard_check(vk_left); up_key = keyboard_check(ord("W")) || keyboard_check(vk_up); down_key = keyboard_check(ord("S")) || keyboard_check(vk_down);
I remember trying to make a game with these tutorials in a school holiday break. I spent a month working on it before I broke Gamemaker itself (don't ask me how) and the project wouldn't open. Now I'm back to try again with a new laptop, and this music brings back so much nostalgia. I love the down-to-earth way you explain it, as if you're really talking to someone. It feels like it stretches on a bit sometimes, but in a good way, like you're actually explaining the concept instead of just reading off a script. I've never been more excited about making a thing run into walls. Thanks for the tutorial! Moving on to the next one.
@@peytonburnham4316 can u fix the error the Object: Obj_player Event: Step at line 13 : malformed if statement or unassigned variable_place meetting referenced
for those very new to gamemaker studio2 (me included) if your grid doesn't fit your players as they spawn at the top left section of the grid. Go to your room and beside the grid icon there would be a down arrow button press it and change the number 32 to 16 and that should work. Nobody is probably gonna see this, but it's pretty helpful to me, just want to share it. Also, here's a sprint script that I made up took me forever, but thanks to this tutoriel at least I know how to do it: sprint = keyboard_check(vk_lshift) if sprint == true { move_spd = 3 } if sprint == not true { move_spd = 1.5 }
this is probably the gamemaker tutorial where i learned the most. it's all SO well explained i can actually understand what i'm doing and i now see applications of the things i learn. thank you so much for doing such a wonderful tutorial.
"no but seriously this is pretty cool. you've run a game... and uh, you, you know, You did it! you cant... its not fuunnn at all, because you cant do anything with it." lol dead💀😆 I love this tutorial
Oh my god YES!!!! I'm bored of RPG Maker and wanted to learn to create an RPG in GameMaker Studio but the tutorials on UA-cam were not something I was looking for until this. Thank you and keep up with the videos cuz they're all gonna be in my playlist.
I've seen three different tutorials on movement and collision, and all three have totally different approaches. Very confusing for a beginner like me. haha. I would say yours is definitely the most enjoyable.
if anyone else is like me and got confused with placing the asset, you have to click specifically the RIGHT alt button, not the LEFT. the LEFT ALT lets you drag around the room. the RIGHT ALT places things.
This is the first programming tutorial I've ever seen that actually kept watching and didn't get frustrated from its really simple and I might stick to this game engine for quite a while.
This is absolutely the best tutorial I've come across. You're clear, precise, and are able to tell us what to do and teach us without backtracking and saying "jk, delete that, do this instead." It's really easy to listen to you, and I appreciate these videos. Thanks, Peyton.
Just started migrating all my assets from RPG Maker and I cannot believe how much easier this is. I mean the coding is still a foreign language to me, but holy heck game engines have come a long way. Super grateful that you're sharing your process! Opens up a world of possibilities.
I HAVE DONE IT. I HAVE MADE A MOVING SQUARE THAT HAS THE ABILITY TO TOUCH SHIT. jokes aside, very good tutorial! i ran into some issues mostly cause of my own inability to pay attention properly, but yknow, i dun did it. i still have no idea how the code works, like 0 clue, im not sure if im supposed to understand yet but it is how it is 🔥
For everyone having problems with the wall collisions not working going up and down. This works: if place_meeting(x + xspd, y, obj_wall) == true { xspd = 0; } if place_meeting(x, y + yspd, obj_wall) == true { // changed second argument to y yspd = 0; } x += xspd; y += yspd;
hey everyone! here's how to move with WASD and all. BTW, if you have trouble with the code and stuff, try reverting to a previous version. It worked for me! (just trying to help all of y'all from the same fate i suffered) CODE: create: xspd = 0; yspd = 0; move_spd = 1; step: key_right = keyboard_check(ord("D")); key_up = keyboard_check(ord("W")); key_left = keyboard_check(ord("A")); key_down = keyboard_check(ord("S")); xspd = (key_right - key_left) * move_spd; yspd = (key_down - key_up) * move_spd; x += xspd; y += yspd;
Thank you! Though i tried the tutorial, the arrow keys do not work. I tried your code and only the WASD keys work but not the arrow keys. I checked several times with the video and I just copy and pasted your code into my game. Is the tutorial outdated?
Idk why this tutorial is so nice, but words cannot describe how easily I'm able to follow this. Thank you so much for this tutorial and keep up the great work!
God this is the exact tutorial i've been needing. Every other one i've seen just jumps straight into game making process without explaining anything because i guess they assume you've made games before but on a different engine or something. This is actually a step by step breakdown of not just the 'how' but everything else as well. Thank you!
If you want to use WASD instead of the arrow keys you can use right_key = keyboard_check(ord("D")); left_key = keyboard_check(ord("A")); up_key = keyboard_check(ord("W")); down_key = keyboard_check(ord("S"));
To anyone whose sprite can phase through walls: This is a quick and simple fix, get your wall object and open it, then insert a "Collision" event, (not begin or end, just Collision) and use block code. Then enter a speed set block and have the speed set as 0. Then, go to the property window for the wall object, and make sure the "Solid" property is checked. There's your fix!
After watching the instructor on the game maker YT channel and then watching you, I have this much more ingrained in my head. He is very thorough and good at explaining it but how you explain it helps the information sink in better for me. So thank you very much for the great explanation on this! I only did two classes of coding in college and that was web design so these tutorials are helping me remember how to do it plus more!
This is breathtakingly helpful, thank you. I've been fiddling with GSM2 for a few days and managed to make a sprite and then yeet it straight off the screen and into the ether. Really glad to have the next steps mapped out.
the way you used for checking collisions is good for a simple rpg, but it's buggy for more complex ones since at certain speed the player will either not touch the wall and leave a gap, or it will not even register that there is a wall and pass right through it, so here is an alternative me and someone from the Gamemaker discord came up with (i'll also explain it for the people who don't know the language that well like me) right_key = keyboard_check(vk_right) or keyboard_check(ord("D")); left_key = keyboard_check(vk_left) or keyboard_check(ord("A")); up_key = keyboard_check(vk_up) or keyboard_check(ord("W")); down_key = keyboard_check(vk_down) or keyboard_check(ord("S")); xspd = move_spd * (right_key - left_key); yspd = move_spd * (down_key - up_key); repeat (abs(xspd)) { if (place_meeting (x + sign(xspd), y, obj_wall)) { xspd = 0; break; } x += sign(xspd); } repeat (abs(yspd)) { if (place_meeting (x, y + sign(yspd), obj_wall)) { yspd = 0; break; } y += sign(yspd); } repeat() repeats something as many times as you put in the parentheses i.e repeat(5) in this case it repeats as many times as the absolute value of xspd is, since it can't repeat something negative times. sign() takes the sign of whatever value you put in it and returns either positive 1, negative 1 or zero depending on the value i.e sign(5) = 1, sign(-2) = -1 so we can use it to find the direction that the player is going break just means to end the loop also if you don't put " == true" or " == false" next to the function place_meeting(), " == true" is implied so what this code does is check the next pixel in the direction that you are going, and if it doesn't see any collisions, it moves by one pixel until it has moved as many pixels as the player's speed is or it has detected that the next pixel is a wall
Just found your tutorial series. I have a little bit of coding background. But I am new to game development. Thanks for clarifying the y-axis. Seeing it visually helps quite a bit. 16:15 I came for the dialouge system but I am working through the whole series to get to understand where you are coming from. Have a nice day.
Just found this video since I wanted to expand on my very limited knowledge of coding and learn how to use the program. While adding movement I wanted to add a “sprint” button (shift) and I’m actually very proud of myself for being able to figure it out! In case anyone finds this in the future and also wants to add this, all I did was “shift = keyboard_check(vk_shift);” to set the variable and “if shift = true then move_spd = 2 else move_spd = 1;” There’s probably a more optimal way to add it but I’m still proud of being able to figure it out on my own! The video helped me a lot so thank you! (Even if I’m watching this almost 3 years after it was released)
Dude this is awesome, I always have problems focusing in tutorials because there is no background music to keep me engaged and your casual tone makes everything 10x times easier, this was not something to endure but a very fun way to spend my time.
Of all the youtube content I watch, I don't think anything has had me crying because I'm laughing so hard quite like the segment from 7:38 to 8:00. It might not even be a joke but the setup, slightly awkward wait and just "not much!" I've showed this part to people that have no interest in game making just cuz its so goddamn funny. Quality videos, my friend.
If you don't want to make the second if statement at 26:09 to check for collision use this instead: if place_meeting(x + xspd, y + yspd, obj_wall) == true { xspd = 0; yspd = 0; }
Nope, you gotta use two if statements here. This code basically means that if you bump into something horizontally, you won't be able to move vertically, even if there's nothing on top of you, and vice versa.
Thanks mate! me and my friend are making an RPG together and your tutorials have helped a ton with it! I hope that one day it will be good enough to publish
this tutorial was a breeze, i guess being in the computer science world for a while helped me out, but this was still so much easier (and quicker) than i have ever imagined, thank you.
2024, looking to actually make a playable game that i know i will enjoy. thank you for this amazing tutorial and i hope this will help me make a vision ive been thinking of for a while!
If you are a dumb dumb like me, and your square is stuck in the top left corner and only making small movements left and right, you've flipped your + and = sign, look closely at it and make sure it's correct. It took me restarting the project from scratch before it clicked for me that it was the issue
Thank you sooo much. I've been looking for this exact thing and I'm looking forward to create my own little game in the future with your tutorial ^^. I just woke up today and thought "let's learn how to make a game" so here I am haha
Really great series! For a while I thought it'd be great if someone did a tutorial where they actually "made" all the assets as well instead of just showing the engine. Looking forward to completing this
thank you very much for this tutorial i have wanted to make a game like this for a while now but all the other tutorials where really complicated so thank you again for this amazing tutorial!
Hey! Thank you so much for this! I had a ton of negative preconceptions about GameMaker, but I decided to give it a shot as an alternative to Godot and this is the tutorial I found and tried. And I think I'm starting to grok the love that folks have for this engine. Thank you!
I want to make a game like this someday. I have a plot, some basic ideas for mechanics, and a general idea of how drag and drop code works. It's possible to make, given the simplicity of the game and the shorter length i want it to have, but this video should help.
Not only was this tutorial very clear and helpful but you're a pretty funny guy. Looking forward to the whole series and the other stuff you got goin on on your tube. peace, hombre. Cheers!
Hey! I wanna say thanks for helping me to make sense of all this, man. I was able to understand perfectly what you meant and any error that came was able to be fixed because of what you taught (shouldn't have copy-pasted the x if code for the y if code...).
I hope this'll help me huhu I just downloaded Game Maker Studio and hopefully this tutorial will still work with the newer version. Great video though! I love the aesthetic too, might as well download your game, it's so nice!
Very very helpful, the ONLY thing I'd have liked to see in this tutorial is some zooming into the code. I'm sure for a lot of people it's fine but on a laptop it wass very hard to see anything you were coding without screening on top of my gamemaker. :P
The approach of updating x and y values manually leads to issues - I can see now why you put the move speed back to 1 - if you use a greater value, then the collisions become pixel imperfect - when using a speed of 10 you will end up with a collision while still being 10 pixels away. This gave me a pretty big headache when I tried messing with bbox values to correct that and ended up with a spaghetti code that still was buggy. Then I discovered the move_and_collide() function. If anyone knows any issues with this function let me know, but so far it looks like it works great, you just do it like this: var _move_right = keyboard_check(ord("D")) || keyboard_check(vk_right); var _move_left = keyboard_check(ord("A")) || keyboard_check(vk_left); var _move_up = keyboard_check(ord("W")) || keyboard_check(vk_up); var _move_down = keyboard_check(ord("S")) || keyboard_check(vk_down); var _x_speed = (_move_right - _move_left) * move_speed; var _y_speed = (_move_down - _move_up) * move_speed; move_and_collide(_x_speed, _y_speed, obj_wall) and you have perfect collisions regardless of move speed.
I think this is a great series. I had a hard time getting through this because of the repetitive whistling music in the background because of a brain injury I have. Is this uploaded anywhere without the music by any chance?
For some reason, although I've followed everything and copied the code, my "player" won't move when I run the code. But the Mac app seems very unstable, so I'm not sure that it isn't something with GameMaker itself. This tutorial is very clear though, and not annoying, which is a feat for this sort of thing!
@@katychidavid7862 Make sure everything's set up correctly. Your player object is the one with the code, there's walls to collide with, etc, etc. If it's still an issue try sending your code. There's probably a small mistake like a + instead of a - in there, it happens.
I've basically watched all your videoes so far, and I'm just loving them, you explain everything so well. I'm hoping you do some kind of "vehicle" tutorial, like riding a hores or wagon/car, or whatever. That's what I'm currently trying to do, but I'm running into issues... :( Keep it up!
this would most likely be done by changing your sprite(see next video) to a "vehicle" sprite (completely new sprite with you riding in a vehicle, and just changing your movement speed in player create event
Loved your way of explaining things! Talking about collisions...i still dont get the difference between making/not making the obj_wall solid ( flagged ) and if the event " collision " could be used for blocking the player or if it useless :S
Thank you! And we basically dont use the collision event and the built in “solid” since the collision functions are much more versatile! For example functions are better for checking collision *if* the player were in a certain spot vs only checking where the play currently is!
This is my first time coding and it's fun! You've made it easy for me to know how to, the only problem is when it comes to collisions for me. I copied your coding but no matter what my player sprite still can go threw the walls and it's a bit frustrating. Some help with this would be nice ^^!
Hey all, thanks for checking out this little series!
If you want to help me make more videos like this (full turn-based RPGs, platformers, zelda-likes, beat 'em ups, etc), check out my Patreon! www.patreon.com/peytonburnham
That'll help me focus more time on these videos and there's a bunch of cool perks like getting videos before UA-cam does, voting on future series, and getting the project files and assets from future videos! Thanks!
your welcome!
i have a question, when i try to run it why does it show this? ############################################################################################
ERROR in
action number 1
of Step Event0
for object Player_1:
trying to index a variable which is not an array
at gml_Object_Player_1_Step_0 (line 1) - right_key = keyboard_check[vk_right];
############################################################################################
gml_Object_Player_1_Step_0 (line 1)
man, you deserve way more subs than this, your tutorials a amazing
hey is this outdated I did everything right but no movement.
can u make it with gml visual pls
don't forget to make the room grid 16x16 (go to top right where the zoom buttons are. it is the first icon and you can change dimensions)
a lifesaver
Thank God I Thought I Did Something Wrong And Panicked Lmao
Thank you so much, I was wondering why I couldn't place my wall sprite down properly
Thank you so much! I started placing the walls and I thought I did something wrong in the code.
can this work on a 48x48 setting?
You have no idea how much i appreciate the humour at 19:25. As much as I love learning, tutorials are always a bit of drag. You added some fun without dragging it on too long and got us back to work. Respect
A good way to keep your sanity intact as a game dev
27:19 was hilarious as well.
For anyone wondering how to make WASD movement instead of the arrow keys, simply replace them with the letters like this:
right_key = keyboard_check(ord("D"));
left_key = keyboard_check(ord("A"));
up_key = keyboard_check(ord("W"));
down_key = keyboard_check(ord("S"));
if you want both to work just like I did, just put the "||" symbol, which means "or", between one and another like this:
right_key = keyboard_check(ord("D")) || keyboard_check(vk_right);
left_key = keyboard_check(ord("A")) || keyboard_check(vk_left);
up_key = keyboard_check(ord("W")) || keyboard_check(vk_up);
down_key = keyboard_check(ord("S")) || keyboard_check(vk_down);
dosent work set a #macro W_key 0x57 in your macro file then instead of vk_up you do keayboard_check(W_key)
OMG TYSM YOU'RE AN ANGEL!!!!!
no problem theres a lot of diffrent ways to do this but the way i stated makes it clean and controllable versus the alternative
methods
thank you so much!!!
i dont know how to get either one to work
The fact that this tutorial is still valid even after 2 years is insane. Teached me GMS2, thank you!
Also I love the humor
do the colissions still work? heard there was an update there
One of the best lesson video I’ve ever watched. What he’s saying is really easy to understand even to those who not good at English like me.
The Music makes this tutorial so much better, music always helps increase the mood of doing what will eventually feel like a job.
I remember trying to make a game with these tutorials in a school holiday break. I spent a month working on it before I broke Gamemaker itself (don't ask me how) and the project wouldn't open. Now I'm back to try again with a new laptop, and this music brings back so much nostalgia. I love the down-to-earth way you explain it, as if you're really talking to someone. It feels like it stretches on a bit sometimes, but in a good way, like you're actually explaining the concept instead of just reading off a script. I've never been more excited about making a thing run into walls. Thanks for the tutorial! Moving on to the next one.
You’ve answered my prayers, it was literally yesterday when i though “why are there no tutorials on this”
Oh awesome! I figure there's always future devs out there who just need the right starting point!
@@peytonburnham4316 can u fix the error the Object: Obj_player Event: Step at line 13 : malformed if statement
or unassigned variable_place meetting referenced
for those very new to gamemaker studio2 (me included)
if your grid doesn't fit your players as they spawn at the top left section of the grid. Go to your room and beside the grid icon there would be a down arrow button press it and change the number 32 to 16 and that should work.
Nobody is probably gonna see this, but it's pretty helpful to me, just want to share it.
Also, here's a sprint script that I made up took me forever, but thanks to this tutoriel at least I know how to do it:
sprint = keyboard_check(vk_lshift)
if sprint == true
{
move_spd = 3
}
if sprint == not true
{
move_spd = 1.5
}
ok
Thanks for the sprint script I always wondered what it was.😃
@@defect683 it’s fine! If you have problems, you can change the move_spd to something yours
@@ssharkiggo6432 Alright but thanks for the code. It's very useful in my opinon.
@@defect683 thanks!
this is probably the gamemaker tutorial where i learned the most. it's all SO well explained i can actually understand what i'm doing and i now see applications of the things i learn. thank you so much for doing such a wonderful tutorial.
7:38 "Let's see what we've done!" "Not much!" LOOOL
hi niko
"no but seriously this is pretty cool. you've run a game... and uh, you, you know, You did it! you cant... its not fuunnn at all, because you cant do anything with it." lol dead💀😆 I love this tutorial
Oh my god YES!!!! I'm bored of RPG Maker and wanted to learn to create an RPG in GameMaker Studio but the tutorials on UA-cam were not something I was looking for until this. Thank you and keep up with the videos cuz they're all gonna be in my playlist.
That’s great! Hope these help out and I’m hoping to have another one out either this weekend or early next week!
I've seen three different tutorials on movement and collision, and all three have totally different approaches. Very confusing for a beginner like me. haha. I would say yours is definitely the most enjoyable.
if anyone else is like me and got confused with placing the asset, you have to click specifically the RIGHT alt button, not the LEFT. the LEFT ALT lets you drag around the room. the RIGHT ALT places things.
I am from the future and you are a saint
thank you, its kind of you to let people know
Im new to coding and wow this tutorial is so clear and helped me so much, looks and sounds complicated but after practicing for a bit is so easy!
This is the first programming tutorial I've ever seen that actually kept watching and didn't get frustrated from its really simple and I might stick to this game engine for quite a while.
This is absolutely the best tutorial I've come across. You're clear, precise, and are able to tell us what to do and teach us without backtracking and saying "jk, delete that, do this instead." It's really easy to listen to you, and I appreciate these videos. Thanks, Peyton.
Just started migrating all my assets from RPG Maker and I cannot believe how much easier this is.
I mean the coding is still a foreign language to me, but holy heck game engines have come a long way.
Super grateful that you're sharing your process! Opens up a world of possibilities.
I HAVE DONE IT. I HAVE MADE A MOVING SQUARE THAT HAS THE ABILITY TO TOUCH SHIT.
jokes aside, very good tutorial! i ran into some issues mostly cause of my own inability to pay attention properly, but yknow, i dun did it.
i still have no idea how the code works, like 0 clue, im not sure if im supposed to understand yet but it is how it is 🔥
For everyone having problems with the wall collisions not working going up and down. This works:
if place_meeting(x + xspd, y, obj_wall) == true {
xspd = 0;
}
if place_meeting(x, y + yspd, obj_wall) == true { // changed second argument to y
yspd = 0;
}
x += xspd;
y += yspd;
i was fighting with this problem for an hour, thank you so much!
You are the goat, thanks!
It flippin worked, Thank you.
omg thank you! it worked!
i copy n pasted my x collision and for a hour didnt relize ty
hey everyone! here's how to move with WASD and all.
BTW, if you have trouble with the code and stuff, try reverting to a previous version. It worked for me!
(just trying to help all of y'all from the same fate i suffered)
CODE:
create:
xspd = 0;
yspd = 0;
move_spd = 1;
step:
key_right = keyboard_check(ord("D"));
key_up = keyboard_check(ord("W"));
key_left = keyboard_check(ord("A"));
key_down = keyboard_check(ord("S"));
xspd = (key_right - key_left) * move_spd;
yspd = (key_down - key_up) * move_spd;
x += xspd;
y += yspd;
thanks!!!
THANK YOU, NEEDED THIS.
i love u
Thank you! Though i tried the tutorial, the arrow keys do not work. I tried your code and only the WASD keys work but not the arrow keys. I checked several times with the video and I just copy and pasted your code into my game. Is the tutorial outdated?
Thank you so much for this, I really needed this code. :D
Idk why this tutorial is so nice, but words cannot describe how easily I'm able to follow this. Thank you so much for this tutorial and keep up the great work!
God this is the exact tutorial i've been needing. Every other one i've seen just jumps straight into game making process without explaining anything because i guess they assume you've made games before but on a different engine or something.
This is actually a step by step breakdown of not just the 'how' but everything else as well. Thank you!
If you want to use WASD instead of the arrow keys you can use
right_key = keyboard_check(ord("D"));
left_key = keyboard_check(ord("A"));
up_key = keyboard_check(ord("W"));
down_key = keyboard_check(ord("S"));
thanks
your a legend thank you
To anyone whose sprite can phase through walls:
This is a quick and simple fix, get your wall object and open it, then insert a "Collision" event, (not begin or end, just Collision) and use block code. Then enter a speed set block and have the speed set as 0. Then, go to the property window for the wall object, and make sure the "Solid" property is checked. There's your fix!
thanks bro it really works you should make your own tutorials thanks
After watching the instructor on the game maker YT channel and then watching you, I have this much more ingrained in my head. He is very thorough and good at explaining it but how you explain it helps the information sink in better for me. So thank you very much for the great explanation on this! I only did two classes of coding in college and that was web design so these tutorials are helping me remember how to do it plus more!
This is breathtakingly helpful, thank you. I've been fiddling with GSM2 for a few days and managed to make a sprite and then yeet it straight off the screen and into the ether. Really glad to have the next steps mapped out.
the way you used for checking collisions is good for a simple rpg, but it's buggy for more complex ones since at certain speed the player will either not touch the wall and leave a gap, or it will not even register that there is a wall and pass right through it, so here is an alternative me and someone from the Gamemaker discord came up with (i'll also explain it for the people who don't know the language that well like me)
right_key = keyboard_check(vk_right) or keyboard_check(ord("D"));
left_key = keyboard_check(vk_left) or keyboard_check(ord("A"));
up_key = keyboard_check(vk_up) or keyboard_check(ord("W"));
down_key = keyboard_check(vk_down) or keyboard_check(ord("S"));
xspd = move_spd * (right_key - left_key);
yspd = move_spd * (down_key - up_key);
repeat (abs(xspd))
{
if (place_meeting (x + sign(xspd), y, obj_wall))
{
xspd = 0;
break;
}
x += sign(xspd);
}
repeat (abs(yspd))
{
if (place_meeting (x, y + sign(yspd), obj_wall))
{
yspd = 0;
break;
}
y += sign(yspd);
}
repeat() repeats something as many times as you put in the parentheses i.e repeat(5)
in this case it repeats as many times as the absolute value of xspd is, since it can't repeat something negative times.
sign() takes the sign of whatever value you put in it and returns either positive 1, negative 1 or zero depending on the value
i.e sign(5) = 1, sign(-2) = -1 so we can use it to find the direction that the player is going
break just means to end the loop
also if you don't put " == true" or " == false" next to the function place_meeting(), " == true" is implied
so what this code does is check the next pixel in the direction that you are going, and if it doesn't see any collisions, it moves by one pixel until it has moved as many pixels as the player's speed is or it has detected that the next pixel is a wall
Thank you!
@@CynABsolver glad I could help
Just found your tutorial series. I have a little bit of coding background. But I am new to game development. Thanks for clarifying the y-axis. Seeing it visually helps quite a bit. 16:15
I came for the dialouge system but I am working through the whole series to get to understand where you are coming from. Have a nice day.
You helped me passed my project 3 years ago. Bro, you're amazing. Thank you for creating this video.
Ah yes. Nice Music, practical learning, nice voice and starting from the very ground up.
Thank You so much
Just found this video since I wanted to expand on my very limited knowledge of coding and learn how to use the program. While adding movement I wanted to add a “sprint” button (shift) and I’m actually very proud of myself for being able to figure it out!
In case anyone finds this in the future and also wants to add this, all I did was “shift = keyboard_check(vk_shift);” to set the variable and “if shift = true then move_spd = 2 else move_spd = 1;”
There’s probably a more optimal way to add it but I’m still proud of being able to figure it out on my own! The video helped me a lot so thank you! (Even if I’m watching this almost 3 years after it was released)
the music... so nostalgic, I remember watching your videos and listening to this music. good times...
My new years resolution is to make a full game this year and i don't know a thing about game creation. this is helping a lot
Thank you so much, I took a break from game developing and I've gotten super rusty and this tutorial has help me out so much :)
You’re welcome! Good luck!
Dude this is awesome, I always have problems focusing in tutorials because there is no background music to keep me engaged and your casual tone makes everything 10x times easier, this was not something to endure but a very fun way to spend my time.
exactly the thing I've been looking for to start getting into game development. thank you so much for these tutorials you are incredible.
the bassline in the background song is HEAT OMG
Thank you I love your tutoring
You take the time to explain the code we're writing, so the viewers don't just write code "in the dark"
Take care!
Of all the youtube content I watch, I don't think anything has had me crying because I'm laughing so hard quite like the segment from 7:38 to 8:00. It might not even be a joke but the setup, slightly awkward wait and just "not much!" I've showed this part to people that have no interest in game making just cuz its so goddamn funny. Quality videos, my friend.
Understood this better than the actual Gamemaker tutorials
just got into coding and this was super helpful :D! really easy to understand and i appreciate that
If you don't want to make the second if statement at 26:09 to check for collision
use this instead:
if place_meeting(x + xspd, y + yspd, obj_wall) == true
{
xspd = 0;
yspd = 0;
}
Nope, you gotta use two if statements here. This code basically means that if you bump into something horizontally, you won't be able to move vertically, even if there's nothing on top of you, and vice versa.
Thanks mate! me and my friend are making an RPG together and your tutorials have helped a ton with it! I hope that one day it will be good enough to publish
Wait a minuet...that's my picture
*did you like the game, I did my best to make it*
this tutorial was a breeze, i guess being in the computer science world for a while helped me out, but this was still so much easier (and quicker) than i have ever imagined, thank you.
Amazing work, i was completely bamboozled by game maker studio but your tutorial was perfect!
Thank you so much!
Man... this was a lifesaver.. all the tuts are outdated and this is so good!!!!
If you are using a laptop and trying to place the object in the room using alt and it just moves the room, turn off laptop mode at the top.
Thank you!
Genuinely one of the best tutorials i've seen. Absolutely outstanding!
Amazing introduction to this game engine. Thank you!
Have to say, you are pretty underrate hope people find you out so soon
2024, looking to actually make a playable game that i know i will enjoy. thank you for this amazing tutorial and i hope this will help me make a vision ive been thinking of for a while!
does this tutorial include how to make a rad duck? very important question
One way to find out, champ 😎
You gotta find the how to make a rad duck in game maker studio 2 tutorial.
If you are a dumb dumb like me, and your square is stuck in the top left corner and only making small movements left and right, you've flipped your + and = sign, look closely at it and make sure it's correct. It took me restarting the project from scratch before it clicked for me that it was the issue
Thank you sooo much. I've been looking for this exact thing and I'm looking forward to create my own little game in the future with your tutorial ^^. I just woke up today and thought "let's learn how to make a game" so here I am haha
Really great series! For a while I thought it'd be great if someone did a tutorial where they actually "made" all the assets as well instead of just showing the engine. Looking forward to completing this
thank you very much for this tutorial i have wanted to make a game like this for a while now but all the other tutorials where really complicated so thank you again for this amazing tutorial!
Hey! Thank you so much for this! I had a ton of negative preconceptions about GameMaker, but I decided to give it a shot as an alternative to Godot and this is the tutorial I found and tried. And I think I'm starting to grok the love that folks have for this engine. Thank you!
I want to make a game like this someday. I have a plot, some basic ideas for mechanics, and a general idea of how drag and drop code works. It's possible to make, given the simplicity of the game and the shorter length i want it to have, but this video should help.
Not only was this tutorial very clear and helpful but you're a pretty funny guy. Looking forward to the whole series and the other stuff you got goin on on your tube. peace, hombre. Cheers!
Hey! I wanna say thanks for helping me to make sense of all this, man. I was able to understand perfectly what you meant and any error that came was able to be fixed because of what you taught (shouldn't have copy-pasted the x if code for the y if code...).
this is the first time i have actually "written code, i hope i learn well, just need to make it fun, haha
I hope this'll help me huhu
I just downloaded Game Maker Studio and hopefully this tutorial will still work with the newer version. Great video though! I love the aesthetic too, might as well download your game, it's so nice!
this is literaly the perfect tutorial, im new to gamemaker 2
the background music is a bop
Whats the background music, it's been stuck in my head for the whole day.
This is more helpful than the programing classes i went to, damn
Thanks for making this. Btw, I was a supporter of your Kickstarter so this makes your stuff even more interesting !
Oh thank you so much! I hope it's informative!
@@peytonburnham4316 please continue to make more!
@@indiepunch3443 I totally will! I have a few more in mind!
dude u are amazing! thank you for this clear and great tutorial!!!
Love the music in the background. Awesome video brother
thanks!! this tutorial was awesome, i loved it!
Thank you!!
i would stop skipping school if you were my computer science teacher
Thanks man, you're making my dreams true
WOW THIS IS EXACLTY WHAT I WAS LOOKING FOR, ur so underrated tysm!!
This is soooo beginner friendly!! Thank you!!!
Just started the video, gotta say that theme slaps!
very good tutorial
Very very helpful, the ONLY thing I'd have liked to see in this tutorial is some zooming into the code.
I'm sure for a lot of people it's fine but on a laptop it wass very hard to see anything you were coding without screening on top of my gamemaker. :P
The approach of updating x and y values manually leads to issues - I can see now why you put the move speed back to 1 - if you use a greater value, then the collisions become pixel imperfect - when using a speed of 10 you will end up with a collision while still being 10 pixels away. This gave me a pretty big headache when I tried messing with bbox values to correct that and ended up with a spaghetti code that still was buggy. Then I discovered the move_and_collide() function. If anyone knows any issues with this function let me know, but so far it looks like it works great, you just do it like this:
var _move_right = keyboard_check(ord("D")) || keyboard_check(vk_right);
var _move_left = keyboard_check(ord("A")) || keyboard_check(vk_left);
var _move_up = keyboard_check(ord("W")) || keyboard_check(vk_up);
var _move_down = keyboard_check(ord("S")) || keyboard_check(vk_down);
var _x_speed = (_move_right - _move_left) * move_speed;
var _y_speed = (_move_down - _move_up) * move_speed;
move_and_collide(_x_speed, _y_speed, obj_wall)
and you have perfect collisions regardless of move speed.
Hi, can i get more info in this? I just go through the walls
The “it’s not fun” killed me 🤣
I think this is a great series. I had a hard time getting through this because of the repetitive whistling music in the background because of a brain injury I have. Is this uploaded anywhere without the music by any chance?
This really helps!
Youre the best ive found at teaching. Thank you
For some reason, although I've followed everything and copied the code, my "player" won't move when I run the code. But the Mac app seems very unstable, so I'm not sure that it isn't something with GameMaker itself. This tutorial is very clear though, and not annoying, which is a feat for this sort of thing!
Mind sending your code? Small mistakes are bound to happen. Or maybe it's a mac thing, I don't know.
@@katychidavid7862 Make sure everything's set up correctly. Your player object is the one with the code, there's walls to collide with, etc, etc. If it's still an issue try sending your code. There's probably a small mistake like a + instead of a - in there, it happens.
I've basically watched all your videoes so far, and I'm just loving them, you explain everything so well. I'm hoping you do some kind of "vehicle" tutorial, like riding a hores or wagon/car, or whatever. That's what I'm currently trying to do, but I'm running into issues... :(
Keep it up!
this would most likely be done by changing your sprite(see next video) to a "vehicle" sprite (completely new sprite with you riding in a vehicle, and just changing your movement speed in player create event
Thank you so much, been curious about getting into game development!
Love the humor i hope i can use this tutorial to make a game that i wanted to create
thanks for the video series big guy.
Loved your way of explaining things! Talking about collisions...i still dont get the difference between making/not making the obj_wall solid ( flagged ) and if the event " collision " could be used for blocking the player or if it useless :S
Thank you! And we basically dont use the collision event and the built in “solid” since the collision functions are much more versatile! For example functions are better for checking collision *if* the player were in a certain spot vs only checking where the play currently is!
best tutorial I ever watched
Do you have a tutorial like this but in the visual language instead of coding? Amazing tutorial.
This is my first time coding and it's fun! You've made it easy for me to know how to, the only problem is when it comes to collisions for me. I copied your coding but no matter what my player sprite still can go threw the walls and it's a bit frustrating. Some help with this would be nice ^^!
same for me
a red dot, blue walls and an empty background
*PTSD flashbacks*
JK, thank you for the tutorial it's easy to follow it's awesome
Great Video! Will use this for creating my new game!!
I'm using GameMaker Studio as of now, and there are a few diffrences. Such as trying to run the game.
This was a very helpful video, thank you.
INCREDIBLY helpful video. Thank you.
Thank you so much for this video, it's really helping me in my new project :)
done with the first video, you are a great teacher thanks!