Make a Platformer in 13 Minutes in GameMaker Studio 2
HTML-код
- Опубликовано: 27 сен 2024
- 🎁 Assets: thomasgvd.itch...
📩 Get indie dev tips, behind-the-scenes and more stuff in my newsletter: blobfish.dev
▬▬▬▬▬▬▬▬▬▬▬▬ FOLLOW ME ▬▬▬▬▬▬▬▬▬▬▬▬
📩 Newsletter: blobfish.dev (best way to follow my work)
🐤 Twitter: / blobfishdev
👽 Discord: thomasgervraud...
🐱👤 Steam: store.steampow...
🐱🐉 Itch: thomasgvd.itch...
▬▬▬▬▬▬▬▬▬▬▬▬ MY GAMES ▬▬▬▬▬▬▬▬▬▬▬▬
🎮 Space Gladiators: store.steampow...
🥔 Lost Potato: store.steampow...
For those that don't have the time, here is the script for the player object
*create event*
spd = 4;
xSpeed = 0;
ySpeed = 0;
*step event*
var xDirection = keyboard_check(ord("D")) - keyboard_check(ord("Q"));
var jump = keyboard_check_pressed(vk_space);
var onTheGround = place_meeting(x, y + 1, oWall);
if (xDirection != 0) image_xscale = xDirection;
xSpeed = xDirection * spd;
ySpeed++;
if (onTheGround) {
if (xDirection != 0) { sprite_index = sPlayerRun_strip7; }
else { sprite_index = sPlayerIdle_strip4; }
if (jump) {
ySpeed = -15;
}
} else {
sprite_index = sPlayerJump;
}
if (place_meeting(x + xSpeed, y, oWall)) {
while (!place_meeting(x + sign(xSpeed), y, oWall)) {
x += sign(xSpeed);
}
xSpeed = 0;
}
x += xSpeed;
if (place_meeting(x, y + ySpeed, oWall)) {
while (!place_meeting(x, y + sign(ySpeed), oWall)) {
y += sign(ySpeed);
}
ySpeed = 0;
}
y += ySpeed;
Thanks!
one question: im having trouble identifying jump, i even copy and pasted the code from this comment but GMS says that the computer cant identify jump even though i clearly typed in what it means
@@matrixpictures7799 what does the error code look like
@@growdot1961 here: cannot set a constant ("jump") to a value
Hippity hoppity your code is now my property
This video inspires me to give game making a try. I always thought it would be beyond me because I'm bad at math, but this gives me hope.
You usually don't need anything more than basic arithmetic operations to make 2d games. Tons of people are making games without even knowing how to code nowadays with all of the visual scripting tools that exist so you can definitely give it a go if you're interested!
@@blobfishdev That's so inspiring to hear. I'm looking into GameStudio 2 Maker right now. You are really good at making tutorials, I'll plan on digging through more of your stuff and hopefully play some of the games soon too!
@@MicahBuzanANIMATION Thank you and good luck with your own projects! I checked out your video on Patreon tips, that was very useful advice. Got me thinking about how I could set up one and give game dev related tools, scripts and assets as rewards.
@@blobfishdev Help, i use my own sprites and I'm on 6:17 time. Why does my character sprite just keep falling.
Nvm i just didnt press space, but..... i cant seem to go left with my controls
I love the style of the egg character, it reminds me of the binding of issac!
greg the egg
greg
@@cynicaldweller4925 greg
Yes please more tutorials like this. They are perfect for those of us who have limited time to learn, they really help a lot. Amazing tutorial and concept Thomas, merci beaucoup!!
I was thinking of doing this. I would need a Wacom.
For those that had trouble moving left to right, I had the same thing. What I had to fix was when I copied the code in the step function
while(!place_meeting(x+sign(xSpeed),y,oWall))
{
x+=sign(xSpeed);
}
I pasted it and replaced all the x's with y's. I missed one of the x's, once I changed it to y the code worked.
Very good and quick tutorial. Most people on YT need hours to explain all of this.
I'm learning Gamemaker by making a Mario clone now. Figuring out how to make the character move and collide is really confusing. But you explain it so well and concisely that it is easy to understand. Thank you for making this video.
Best Tutorial for RUclips for Platformer game
'We have basically recreated flappy bird.'
And that right there gets a like. The effectiveness of this tutorial gets a fav.
Thanks a lot, almost done with a year game design class and I have to do my own game as the final. This tutorial taught me so much since really the only thing they taught was making card and pinball type games
came from reddit, already know some of these things but your tutorial are really superb!
+1 sub
All tutorials should be like this. I am new to gamemaker and I am happy to find a video that's straight to the point. Thanks
minus the anoying ass fucking jumpcuts that video makers LOOOOVE to put in their videos, then yes
the intro already deserves a like and a sub
thank you! i was having alot of trouble with other videos on the topic
I think the very last thing you missed is how you close the game itself. Like pressing esc to close game when it's in fullscreen. But overall this whole tutorial have been more helpful then most others out there that span through hours of videos. Thank you!
Woah this is 100% gonna be the building blocks for something im planning
loved the content, it really helped
The style reminds me of An Untitled Story quite much
Also a bit reminds me of Wuppo
Quite nice
5:10 when I press the 'alt' button to draw in the tiles with the wall object, the whole platform moves, and it doesn't draw anything. How can i fix this?
Weird, you should just have to highlight the oWall object in the Asset browser and it should even display a message at the bottom f the room next to the x,y coordinates that says "LMB + ALT to paint with selected object resources". (just above the "output" tab)
Once highlighted if you press ALT (without letting go) the wall object should appear at the position of your mouse. If it doesn't work for some reason you can always just drag and drop the oWall object into the room directly or copy/paste it and move it after.
@@blobfishdev Thank you!! It works now! ^^
You really make the code seem less confusing then other tutorials I've followed! Have you considered putting together a GML platformer engine for sale on YoYo and Itch? 90% of them are outdated (GM 1.4) and the new ones that are there seem overly complicated.
I've thought about it but wasn't sure if it would be worth my time to put something like this together since it seemed to me like there were already alternatives (haven't looked much into it though). Last few weeks I've been playing around with Godot so still not sure which engine I'll use moving forward but might look into it if I choose to continue with GameMaker
@@blobfishdev Yeah I really couldn't say if it would be worth the effort. But what I will say is that the ones that are out there for sale are either very old (made for GM1.4) or have a lot of features that kind of get in the way of having a clean, easy-to-understand platformer engine that you can re-skin and build upon.
OMG THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUU AFTER A THOUSAND OF VIDEOS I FOUND THE EAISIST AND FASTEST CODE EVER, AMAZING TYYYYYYYYYYYYY
This is the most helpful tutorial I've seen in months. thank you
my dumb character keeps falling through the floor everytime i try starting the game, and also my coins are surrounded by a white wall that won't go away. help me please.
Make it xspeed = 0 in the player code and also y speed=0
helped a lot ty
superb!
if you changed the room size and the camera isnt working try putting the camera in the middle of the room i found having it where the camera's border is already outside of the room makes it bug out
This is so good! Just one question, how do I create those non-pixel sprites?
I drew them in Krita with a graphical tablet
@@blobfishdev imagine someone drawing it on a computer...
when my character changes direction, it teleports it forward a bit, it only does this when changing direction, How do i fix this?
Didn't realize for quite a bit that your using Gamemaker Studio 2 and not Visual Studios, which is what I am using. Is Gamemaker Studio 2 good for making games such as this one?
idk WHY but I tryied EVERYTHING perfectly but it STILL wont play
Great tutorial! Many thanks!
Is there another method for 5:23? my alt button is not working on game maker for some reason
i love how when he says "oWall" it sounds like "owo"
best tutorial on youtube
Im having a Issue. My character can't move left or right at all, but his animation does play. He only moves to either sides when I jump and press either A or D.
Hard to say what's wrong without seeing the code but maybe you put the x += xSpeed line in the else statement after the if (onTheGround) statement so the speed doesn't change when the player is on the ground. Try to see if the xSpeed value updates correctly when you're on the ground and pressing A or D (use show_debug_message(xSpeed))
@@blobfishdev Ok, here is the code. In my code xSpeed is hsp, while ySpeed is vsp.
var xDirection = keyboard_check(ord("D")) - keyboard_check(ord("A"));
var jump = keyboard_check_pressed(vk_space);
var onTheGround = place_meeting(x, y + 1, obj_tile);
if (xDirection != 0) image_xscale = xDirection;
hsp = xDirection * walk_spd;
vsp++;
if (onTheGround) {
if (xDirection != 0) { sprite_index = spr_potatorun; }
else { sprite_index = spr_potato; }
if (jump) {
vsp = -15;
}
} else {
sprite_index = spr_potatojump;
}
if (place_meeting(x + hsp, y, obj_tile)) {
while (!place_meeting(x + sign(hsp), y, obj_tile)) {
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
if (place_meeting(x, y + vsp, obj_tile)) {
while (!place_meeting(x, y + sign(vsp), obj_tile)) {
y += sign(vsp);
}
vsp = 0;
}
y += vsp;
@@gobro3900 I don't see anything wrong in that code, maybe something to do with the collision box of the player and the tile object, or when you're spawning him he gets stuck in the tile or something like that
thanks for the good tutorial, i have not money now for support you, but i subscribe and sell a like (for the free assets)
nice work!
YOU ARE AWESOME
For some reason i cant autotile it just doesnt let me place down my tile set
please help me if you have time :(
Make sure that you put the first tile in the auto tile as the last tile in the tileset
@@PeterRoyale4839 thank you so much!
@@thiccacorn9807 sorry for commenting so late!
@@PeterRoyale4839 nah its fine, I stopped making the game I was working on but I'm thankful you took time out of your day to help me.
When i start running, my character just flies away like a plane
Thank you!
Thanks so much
great job!
00:22 How did you get to Import??
hey, can I have some help? when I get close to the tiles, they stretch and get all weird.
how do you open a game make project????
How to fix my walls aren't lining up with the room
You probally don't even see those comment anymore but I have a problem, for some reason my character moves SUPER slow, and I can't Really point out where I can change his speed with this code, what do I do?
I finshed all the coding and ran the game but My character is not moving its saying in the same place , I need help.
This is a wonderful lesson. But when my character moves, its size becomes original and not the one I set in the editor( What i can do?
cam u make a video where you put enemies in or put a health bar
do you actually choose to press Q to move left in games??
damn nice tutorial
at 6:30 i input the code perfectly correct, yet when i try to run the game it says "Object: oPlayer Event: Step at line 6 : malformed statement" and im super confused pls help
does it not work for studio 1.4? character is getting stuck in the floor but can move fine left and right in air.
hey i'm having an issue at the player action part because I can't type in any of the code
When I try to put walls object by holding Alt its putting a question mark and I cant place the thing correctly anyone knows how to fix this ?
sssoooo nice and righgt to thge point. thx
Good Video
Is there a way to change the gravity in the step event?
when i use alt lmb it doesnt do anything?
what can i do to fix it
Why does this line:
var onTheGround = place_meeting(x, y + 1, oWall);
work with "y + 1" and not something like "y + sprite_height / 2"? I would have expected it to measure off of the sprite's origin, not its bottom edge.
Actually I think I just figured it out. It isn't checking whether a point is colliding with the given object, but whether the entire original object is colliding with the given object, if it were moved to the given x and y
@@ZachDurtschi Yep you got it
ça semble un peu "illogique" mais ce qui fais un bon platformer pour moi c'est l'art. Je trouve que ce que tu as fais , c'est peu commun et c'est pour ça que j'ai acheter ton jeu (je regrette pas)
jdis ça meme si ce n'est pas un platformer hein.
@@PhugLeGrand Haha merci !
Does anyone know how to add a new level?
Do you have to do animations yourself or does the program do it for you
You have to make them
@@blobfishdev ok
I have a little problem with the camera
Sped up the video 2x to make a platformer in 6.5 minutes.
smart
@@blobfishdev and the king still replies 👑
My player falls through the platorms, i dont know how to fix it as i am new. any idea why?
Make sure:
-That you have placed the oWalls objects where the tiles are (only having the tiles won't work) @5:12
-In the oPlayer step event that you're checking collision with the oWall objects @7:30
This is a great video! I'm having a very slight issue where occasionally when I jump into or fall on a corner my character gets stuck in the corner of the wall object
I think I had that happen too at some point when I put the lines of code in the wrong order
I had done it like this:
check x collision => check y collision => move x => move y
when it should have been:
check x collision => move x => check y collision => move y
Maybe you're having the same issue?
@@blobfishdev That seems to have fixed it, thanks so much! ^_^
i followed everything you said in the video, but the character doesn't move to the left. it only jumps and moves to the right.
Make sure you got these lines correct in the Step event of the oPlayer object, this should make you go to the left (A) or to the right (D) depending on which key you're pressing:
var xDirection = keyboard_check(ord("D")) - keyboard_check(ord("A"));
if (xDirection != 0) image_xscale = xDirection;
xSpeed = xDirection * spd;
@@blobfishdev That worked! Thanks
It wont let me install the assets: its saying it got lost
3:16 i have problem i cant it dont make code it make drag and drop variables
use gamerlanguage
I am currently trying this this tutorial on Gamemaker 1.4,. For some reason, the character runs really slow on the obj wall but really fast on air, is there anyway I can fix this?
I've never used GM 1.4 sorry, probably something todo with the collisions where the character is clipping into the wall
Hi I'm Seth and I'm making a superhero fighting smash bros like fighting game called xenomon
when i make a new project which one should i chose drag and drop or gamemaker language ??
If you want to follow this tutorial you should choose GameMaker Language.
@@blobfishdev thx bro
Il y a une petit probleme ! Je puet pas marcher gauche et droite . Quand j appuie A ou D jusque l 'animation commence
Ca peut venir de plusieurs choses. J'ai épinglé un commentaire qui reprend le script du joueur, copie colle le ou assure toi que tu as bien écris les mêmes choses dans le même ordre
@@blobfishdev Merci , Je copier coller et tout c'est bien
Hello,can you send the white potatos default and run running pictures please?
Good tutorial btw
All the assets used are there: thomasgvd.itch.io/platformer
I followed through the steps and a lot of parts I got stuck and could not fix what happened so I stopped
same
Stuck where?
is there a way to get the assets for free?
I have a problem thomas! Pls help
Whenever i try to move the player it just falls out of the room.. how do i fix this?
(Pls reply)
Maybe you wrote something like:
x = xSpeed
instead of:
x += xSpeed
or the same thing with y and ySpeed
Its hard to tell but you can check the pinned comment with the code and see if there's any difference with yours
@@blobfishdev sure! Btw thanks for replying! :)
@@blobfishdev also can you upload a tutorial about adding melee attacks with a sword or something like that? Pls it would be helpful. Anyway keep up the great work!
Help I can only move right
Without looking at your code, no one can help. Copy and paste your code so we can see where you may be going wrong!
Why do you expect me to have assets lol
is this dnd or gml
GML
How can I make the player fall at a constant speed?
Instead of writing ySpeed++ (which adds 1 to the falling speed every frame to simulate gravity) you can write ySpeed = 10 (which sets the falling speed to a constant 10 directly)
@@blobfishdev I did exactly that, but it makes the player jump extremely short, like being pushed to the ground.
@@plexim1591 True it'd actually keep you from jumping, you could put something like that instead then: ySpeed = min(ySpeed + 1, 10);
Where 10 is the speed at which you want to fall. The player will fall a bit slower until they reach 10 but it'll be constant after that. If you absolutely need the speed to be constant from the get go you'll have to change how the jumping is coded but I don't think it'd look or feel very good.
@@blobfishdev yeah, I figured it was better to do it with a gravity variable instead. Thanks for your input!
i'm 3 minutes into the tutorial and alreaady broke the game
My character isn´t moving to the left, what could I have done wrong
where it says "Q" in step code
do "A" instead
Can you get cracked game maker
8:16
google said this software doesn't require coding to make a game ;/
Yeah you have 2 modes you can use: drag and drop (without code) or GML (with code), here I use the code version
ah i see, thanks, i didn't notice this in other video, everyone is using code writing. What would i lose by not using code?
and the art aspects are only personally drawn? or do they have a library or something with images like trees and rocks and stuff.
@@sergykid I've never used drag n drop so not totally sure but usually with code you have more control and you can do more things faster than without it. If you don't care about coding or want to do simple games I'm sure dnd can work well too though. You can find a lot of free art assets on the web, check out Kenney's assets ( www.kenney.nl/assets ) or game dev market ( www.gamedevmarket.net/ )
I use mac and because the Mac version sucks and can’t even run the build I have no soul now.
hi james
hi
-not james
When I try and run the game my screen goes completely black and nothing happens. Do you know what may be causing this?
What if you remove the window_set_fullscreen(true) line in the oCamera create event?
@@blobfishdev It makes the screen smaller, but it is still just a black screen. I am curious how to fix this because this video has been a massive help :)
@@TheShnizNite That's weird, maybe something to do with your version of GameMaker? This tutorial was done in 2.3
@@blobfishdev I am using the 30 day free trial version, but it is 2.3
Very odd. I wonder what the problem may be
you move way too fast
ok
This isn't how you make a tutorial, you should instead teach how to make the game from scratch.
XDDDDDDDDDDDDDDDDDDDDD
I have some problems with this line:
var xDirection = keyboard_check(ord("D")) - keyboard_check(ord("Q"));
when i start test, it makes sprite more slim
Help pls
why my movement when changes direction it like dash?
You’re sprite origin is probably set wrong, should be middle centre / between the legs, etc…
Came from Reddit, thank you so much!
Thank you! Good tutorial. 13 minutes but took me like 2 hours XD
Edit: It's been two days. Still can't figure out what's wrong with the collision. @4:24 It's not clear for me how to set the collision as oObjects fall infinitely.
What do you mean by "oObjects fall infinitely"? The walls shouldn't be moving and in the oPlayer object you check for collision with them.
@@blobfishdev sorry oPlayer Wow coding is hard.
Just making this comment to thank you for everything blobfish. I was able to pass my college course for games programming from this tutorial and I’ll be sure to buy your games on Steam for literally any way to show thanks to such an incredible god tier gamemaker legend
Haha awesome!