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 RUclips 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);
"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
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 }
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
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 RUclips 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.
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.
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.
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.
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.
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.
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!
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!
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.
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.
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?
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!
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.
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
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.
YOU ARE A LIFESAVER When using the code in the video, for some reason I was sticking to walls, and ive spent like 30 minutes trying to fix it and relpacing the two if statments with this worked. Thank you so much.
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!
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"));
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;
Something to note, if you run into a corner, like, if there is a L formation and you run into the corner from the outside, you'll be slightly in the wall, a way to fix this is by making a third condition check that checks for both x + xspd and y + yspd at the same time, and if those both end up in you colliding in a wall, set both to 0, the reason why you have to check for both is because the conditions that he tells you to set up are assuming you only want to move in the x or only in the y, and the reason why you need this and the other collision checks instead of just this one is because if you only have this one you will remove a feature where you can press left and run into a wall and then while still holding left press up and you'll go up but won't go left because you're at the wall (you can do this in any 2 directions as long as they aren't opposites, I just used that as an example)
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
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.
Wow, thank you! Amazing video! I have no experience with real programming (other than the children's programming language Scratch) and I felt like I understood everything ... because I did!
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)
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.
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
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! 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 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?
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
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!
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!
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!
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.
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 am a complete noob at this, I found a problem I don't know how to fix. when I type "right_key = keyboard_check(vk_right);", and the other directions, there is a yellow highlight under "right_key". am I doing something wrong?
In more recent versions you need to first create de variables in the create event some like: obj_player > create event right_key = 0; left_key = 0; up_key = 0; down_key = 0; same happened to me the first time i saw this video
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.
For anyone struggling with running your game and getting a black background for some reason. Check if you have renamed your project folder. It might have created a copy and is now making Gamemaker confused because there's 2 copies of a .yyp and resource_order files in the project folder.This causes Gamemaker to save new details of your project in the wrong .yyp file, thus causing the problem. In a nutshell, if you renamed your game, check if there's a previous version of it in your game files and delete the previously named project. Hope this helps!
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
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 Peyton! Great tutorial. I teach middle/high school game design and I'm considering using the tutorial for teaching GML, but did you ever get around to any videos for adding combat or the dialogue system shown?
Hey thats awesome!! I do have a dialogue series but I’m not sure it would be good for a classroom setting, it’s advanced compared to this series. But i did do a top down shooter series! That may be something you’re looking for!
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.
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 ^^!
I’m currently on part 4 of this tutorial, but I stopped working on my project for a few days since I have school and work, and when I ran what I had my collisions was messed up. Like I wouldn’t stop when I ran into a wall. I really don’t want to start all the way over. If someone can help with this, please respond when you get the time.
Great video, and I followed everything perfectly up until 18:51, but when I ran the game for some reason my sprite kept dragging along whenever I moved it, like how paint moves along with the brush when painting. Has anyone had this problem?? If so, please let me know how to fix it because I've tried everything I could think of at this point.
I just found this tutorial and its marvelous! I just have one thing here going on. So I tried doing diagonal walls rotating them but they behave like they were in a square. Instead of letting me go through diagonaly, there is invisible collision as in squares.... how could I correct this?
First of all, I'm new to coding, and it was so smooth for me to understand. Thanks a lot! However, I have a problem with (if place meeting). It doesn't work, and it looks like there is some error there.
hey!!! great video! just one question: if th arrays "right_key", "left_key", "up_key", and 'down_key', tell me that they werent mensioned before, even when i put them in to the xspd and yspd, what should i do?
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
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 RUclips 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.
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
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
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
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.
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!
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
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 RUclips 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!
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.
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 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.
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.
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.
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.
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!
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!
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.
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
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
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!
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.
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.
Ah yes. Nice Music, practical learning, nice voice and starting from the very ground up.
Thank You so much
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
You helped me passed my project 3 years ago. Bro, you're amazing. Thank you for creating this video.
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.
YOU ARE A LIFESAVER When using the code in the video, for some reason I was sticking to walls, and ive spent like 30 minutes trying to fix it and relpacing the two if statments with this worked. Thank you so much.
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
I really like the way you explain thing in PLAIN PROGRAMMING ENLIGH.
I also LOVE that you TAKE YOU TIME to explain and show what to do.
Thanks lot.
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
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
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 music... so nostalgic, I remember watching your videos and listening to this music. good times...
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!
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!
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
Something to note, if you run into a corner, like, if there is a L formation and you run into the corner from the outside, you'll be slightly in the wall, a way to fix this is by making a third condition check that checks for both x + xspd and y + yspd at the same time, and if those both end up in you colliding in a wall, set both to 0, the reason why you have to check for both is because the conditions that he tells you to set up are assuming you only want to move in the x or only in the y, and the reason why you need this and the other collision checks instead of just this one is because if you only have this one you will remove a feature where you can press left and run into a wall and then while still holding left press up and you'll go up but won't go left because you're at the wall (you can do this in any 2 directions as long as they aren't opposites, I just used that as an example)
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.
Understood this better than the actual Gamemaker tutorials
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*
Man... this was a lifesaver.. all the tuts are outdated and this is so good!!!!
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.
just got into coding and this was super helpful :D! really easy to understand and i appreciate that
Wow, thank you! Amazing video!
I have no experience with real programming (other than the children's programming language Scratch) and I felt like I understood everything ... because I did!
Have to say, you are pretty underrate hope people find you out so soon
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)
Genuinely one of the best tutorials i've seen. Absolutely outstanding!
the bassline in the background song is HEAT OMG
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.
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!
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!
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
Amazing work, i was completely bamboozled by game maker studio but your tutorial was perfect!
Thank you so much!
Amazing introduction to this game engine. Thank you!
Whats the background music, it's been stuck in my head for the whole day.
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! 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 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?
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
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!
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!
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!
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.
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 am a complete noob at this, I found a problem I don't know how to fix. when I type "right_key = keyboard_check(vk_right);", and the other directions, there is a yellow highlight under "right_key". am I doing something wrong?
In more recent versions you need to first create de variables in the create event
some like:
obj_player > create event
right_key = 0;
left_key = 0;
up_key = 0;
down_key = 0;
same happened to me the first time i saw this video
@@PensandoCientificamenteYT Literally thank you so much
Do you have a tutorial like this but in the visual language instead of coding? Amazing tutorial.
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.
WOW THIS IS EXACLTY WHAT I WAS LOOKING FOR, ur so underrated tysm!!
For anyone struggling with running your game and getting a black background for some reason. Check if you have renamed your project folder. It might have created a copy and is now making Gamemaker confused because there's 2 copies of a .yyp and resource_order files in the project folder.This causes Gamemaker to save new details of your project in the wrong .yyp file, thus causing the problem. In a nutshell, if you renamed your game, check if there's a previous version of it in your game files and delete the previously named project. Hope this helps!
I'm using GameMaker Studio as of now, and there are a few diffrences. Such as trying to run the game.
dude u are amazing! thank you for this clear and great tutorial!!!
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
Love the music in the background. Awesome video brother
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 Peyton! Great tutorial. I teach middle/high school game design and I'm considering using the tutorial for teaching GML, but did you ever get around to any videos for adding combat or the dialogue system shown?
Hey thats awesome!! I do have a dialogue series but I’m not sure it would be good for a classroom setting, it’s advanced compared to this series. But i did do a top down shooter series! That may be something you’re looking for!
this is literaly the perfect tutorial, im new to gamemaker 2
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
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
I’m currently on part 4 of this tutorial, but I stopped working on my project for a few days since I have school and work, and when I ran what I had my collisions was messed up. Like I wouldn’t stop when I ran into a wall. I really don’t want to start all the way over. If someone can help with this, please respond when you get the time.
Great video, and I followed everything perfectly up until 18:51, but when I ran the game for some reason my sprite kept dragging along whenever I moved it, like how paint moves along with the brush when painting. Has anyone had this problem?? If so, please let me know how to fix it because I've tried everything I could think of at this point.
I just found this tutorial and its marvelous! I just have one thing here going on. So I tried doing diagonal walls rotating them but they behave like they were in a square. Instead of letting me go through diagonaly, there is invisible collision as in squares.... how could I correct this?
best tutorial I ever watched
How do you put a cutscene in? Like, if I animated something and I want it to play after you speak to a character or defeat someone.
Youre the best ive found at teaching. Thank you
This is more helpful than the programing classes i went to, damn
First of all, I'm new to coding, and it was so smooth for me to understand. Thanks a lot! However, I have a problem with (if place meeting). It doesn't work, and it looks like there is some error there.
hey!!! great video! just one question: if th arrays "right_key", "left_key", "up_key", and 'down_key', tell me that they werent mensioned before, even when i put them in to the xspd and yspd, what should i do?
thanks!! this tutorial was awesome, i loved it!
Thank you!!
Thank you so much, been curious about getting into game development!
15:34
Actually. 1 is the loneliest number. 2 can be as bad as 1, it's the loneliest number since the number 1.
This is soooo beginner friendly!! Thank you!!!
Why is the window for the game so small? no matter how I change the viewport numbers it still doesn't change.
Thanks man, you're making my dreams true
Just started the video, gotta say that theme slaps!
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
Hi, Thanks for good looking series. I'm starting with this series, will this be still relevant for GameMaker version 2023.8 ?