Make a Top-Down Shooter in 11 Minutes in GameMaker Studio 2
Вставка
- Опубліковано 10 лют 2025
- 🎁 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...
I've done many tutorials in the last 6 months (both paid and free) and this was one of the absolute best. As a beginner I often find the code and logic hard to follow, but I understood this 100%. Not only that but it took hardly any lines of code to make a decent little top down shooter and I appreciate the little touches you added like placing the gun behind or in front depending on the direction it was facing. Cheers!
Thanks Sam glad it helped!
Quick, easy, straight to the point, you earned a sub my guy.
Exactly! Just show me how it's done. More coding videos should do this instead of explaining and droning on lol
everybody gangsta until some potata starts walking with SQZD
shut up
What a useful and well done tutorial, I am really going to use it, thanks dude. I wish you continue with this project, get luck
Thanks glad to hear it's helpful!
@@blobfishdev It Has this error in my code:
Object: o_game Event: Step at line 4: malformed assignment
This was what i wrote for the code at the step event:
var enemies = instance_number(o_enemy);
var allDead = true;
for (var i = 0; i < enemies;i **) {
if (!instance_find(o_enemy, i).dead) allDead = false;
}
if (allDead) game_restart();
@@vipergamingyt4974 its suppose to be i++ not i**
@@zitrix7848 Thanks
I love how straightforward this is
As I said, rapidly becoming the best GMS:2 channel on YT.
im gooning to this
I made my first game because of you and I am gonna improve my game from here now, THANKS!!!
This is exactly what I needed! Just a basic start for me to build off of!
Hi Thomas, Just wanted to thank you for this great, very concise, informative and clear tutorial, thoroughly enjoyed it!
T'es le Edmund McMillen français (ou autre pays francophone je ne sais pas) pour moi
Franchement t'as un super style et tu mérites tellement de succès,
ça fait plaisir de voir de l'originalité en France ! J'ai acheté ta collection et j'ai très hâte d'y jouer !
J'ai aussi hâte de voir du nouveau contenu sur ta chaîne
Haha merci beaucoup !
Wow! I was just browsing youtube for some tutorials, I found your channel. I love this bitesize tutorial and the way you explain makes it look so easy. Thank you for taking the time to share your knowledge.
You are a lifesaver dude!
These are really great! Love the multiple short tutorials!
Thanks dude:) youre helping me a lot with this things, im finally going to finish my first project, so thanks
Thank you for this well made tutorial! I appreciate that you are quick and to the point, but still take time to explain what you are doing. I wish more tutorials used this style and tempo!
I learned a few useful things that I will use in my own projects soon.
If you make more videos like this, I will definately check them out. Keep up the good
work!
just found this game on steam and it's cool to see some behind the scenes of it
damn i am shoked how good this was
this is incredibly straight forward :)
This was a really nice introductory tutorial on game maker and it helped me understand the ui a bit more. Though I do think you need to make a video on gamemaker language for others to understand it a bit easier, I write in csharp so this was quite easy for me to understand. But really nice video overall!
Btw if u didn’t notice ( I my don’t notice at first ) you go to file explorer and that’s where u get all the asssets
Great tutorial! clear and concise.
No wonder this reminds me of Brotato, you created the game!
You deserve more subs man!
best tutorial thanks now i understand it a bit
you the best you helping me a lot thanks
how do i add health to the enemies?
i've tried to create a variable health
and then health--; each time the enemie get's shot and if the health reaches 0 than the enemie dies but then all the other enemies are 1 shot? Can someoney help please.
Hey, first of all I'll tell you that my English is not very good and I'm also just learning this programming thing, but I still see the changes I made and it might help you,
We first go to the create event of the enemy object and there you add the variable health_ with the life you want to put
You just add a line like this
health_ = 3;
Later on the same object but the collision event with the bullet, some lines were added so that the event window should be with these lines
instance_destroy(other);
health_ -=1;
if health_ < 1 {
dead = true;
audio_play_sound(aDeath, 1, false);
layer = layer_get_id("bodies");
} else {
dead = false; }
And that's all, if something goes wrong or you have questions you can still send them here
One last thing, if you want to try this, I recommend that you move the enemies away from the player in the room
was a really greate tutorial! , hope you will have more tutorials :D
i quit game maker but this gave me hope to move forward
Can you make a tutorial of how to add collision to the walls
i love this moment when i follow the tutorial word by word and the game doesn't fucking run for no reason. I've been writing and rewriting the same codes for five hours and the game simply refuses to run, I've lost count of how many times I've watched this tutorial and the game just won't run, i give up
edit: btw, awesome tutorial, i am just way too dumb to do anything right
me to
thank ya
This Is A LIfe Saver (I Had To Make a Game In Less Then 2 Days Thank You SO Much BRo)
When I shoot the enemy, it makes the sound of death but the enemy does not disappear. How can I solve it or what would be the error? Thanks
Thanks!
Thank you!!
blobfish is the best
Thank you sir!
this is honesty the best tutorial ive seen the only thing thats not working for me is the gun angle it follows the mouse but quite poorly and sometimes just stops
nevermind it works perfectly i just did the mouse_y wrong
I wish you are back making few tutorials each month, you have great teaching skills. Cu you in 2024
Brill... love to see more, ta
Your character will displace faster if you activate both axes, you need to normalize the x and y vector magnitudes by Pythagoras' theorem:
if(xMove != 0 && yMove != 0) {
x += xMove * sqrt(0.5) * player_speed;
y += yMove * sqrt(0.5) * player_speed;
}
else {
x += xMove * player_speed;
y += yMove * player_speed;
}
Good point
@@blobfishdev i figured a less messy way:
var diagonal = 1;
if((hSpeed * vSpeed) != 0) {
diagonal = sqrt(2)/2;
}
x += hSpeed * walking_speed * diagonal;
y += vSpeed * walking_speed * diagonal;
thank you so much! I just started learning GMS2 and I can say it easier than I thought. Thank you. But question how do you add collisions on the walls?
You'd usually place objects where the walls are and check for collision with those objects. This is what I've done in the platformer tutorial ua-cam.com/video/uKXCI1qC_LQ/v-deo.html and you can do the same thing here
how do you put the Ogame in the instances?
never mind, i figured it out
how can i make the player collide with the room, so the player doesn't go out of the window?
If player touches object set acceleration to 0. Something like that.
you earned a sub!
nice tutorial, keep it up!
When I add event and create it the o game events pop up doesn’t show the lines where I’m supposed to add the code
dude, i wanna ask you something if you don't mind. Can you tell me how did you balance the card system and stat system? :D is there any way to balance it mathly? ^^
when i shoot it adds speed to me not the bullet
thank you
thanks vary useful and fast and easy.
Your video was very helpful, but how do I aim with the a joy stick?
how do i get more enemies?
That's great! Are you going to make a serie out of this one ?
I'm probably going to make more tutorials for other types of games in the same style (platformers, tower defense etc) but not on this specific game
your a legend cheers mate, if I want to make the player object follow the camera/mouse instead of the gun object can I use the code from the gun in the player object instead,
for example if I want the character to strafe based on the direction they are facing rather than going right on the screen when I press D the character goes to thier current right when I press D
the ALT dragging is not working
so, for some reason, my character shoots with his belly
thx
How could you make the enemies gradually spawn on the edges?
Code a simple timer (or use alarms) and everytime it goes off, spawn an enemy. To get the spawn position you could create an enum Direction { TOP, BOTTOM, RIGHT, LEFT } then choose randomly between those and then set the x and y depending on the direction:
x = 0 and y = random_range(0, room_height) if it's Direction.LEFT
x = room_width and y = random_range(0, room_height) if it's Direction.RIGHT
x = random_range(0, room_width) and y = 0 if it's Direction.TOP
x = random_range(0, room_width) and y = room_height if it's Direction.BOTTOM
@@blobfishdev I ended up doing a simpler version of this where there's a floored random number 0-3 and if its 0 then x=0 y=random(room_height)
Good tutorial.. but I think it could be more useful if you explained why we do the stuff
whats up with the sharp noise at 4:07
ram into a problem where the bullets make me fly away and the bullets don’t move at all lmao
ran *^
i dont have any of those options for maps
Thanks for the tutorial but how do I add more levels
Basically create more rooms and instead of restarting the game when all enemies die change room to the next level instead
@Blovfish sorry where's teh code u mentioned in the description bc i wanna try~it and idk where's the code
Btw great video
thomasgvd.itch.io/top-down-shooter
You can download the .yyz file here which contains the gamemaker project. Then the steps are:
Extract the file from the zip archive (right-click => extract here)
Open GameMaker Studio 2, click on File then Import Project and select the .yyz file
Save the project wherever you want.
Hey! Very nice tutorial! I downloaded the asset pack and I notice you can go outside of the corners? How do you fix that? I just want it to be in the square when moving
An easy way to do it would be to replace this code in the oPlayer step event:
x += xMove * spd;
y += yMove * spd;
With this:
x = clamp(x + xMove * spd, 32, room_width - 32);
y = clamp(y + yMove * spd, 32, room_height - 32);
This limits the min and max position of the player to the borders of the room. If you want to make more complex levels you'll need to create wall objects (or tiles) and check for collision with those when moving the player.
@@blobfishdev Thank you!
@@blobfishdev Was also wondering? How do you get out of the full screen when you run the game? Pressing escape, doesn’t seem to work
@@angelbaby3342 Yeah GameMaker doesn't do it automatically, we need to code it.
In your oGame Create event, remove the line:
window_set_fullscreen(true)
And in the oGame Step event add some code to check when the player presses the esc key to switch the full screen mode.
if (keyboard_check_pressed(vk_escape)) {
window_set_fullscreen(!window_get_fullscreen());
}
With this code if the game is in full screen, pressing escape will make it windowed and if it's windowed pressing escape will make it full screen.
can i use the assets for another game? like the egg
Sure
@@blobfishdev thx i was gonna make a game tysm i can make demos with the assets
Player and enemies can escape through the wall layer. Shouldn't you collide with the wall layer?
Yep I wanted to keep it short but you should add collisions if you want to expand on it
5:42
can't find the code
pls add how to make infinite levels or a wave mode
can you make a tutorial about a platformer shooter?
I'll add it to the list
my game crash everytime i kill an enemy, can anyone help?
Never seen someone use zqsd before
it said 11 mins but it took 4 hrs or more to finish this vid
Salut
Merci pour ton tuto j'ai quelqeu souci a crée le layer Bullets a :9.47
Quand je tire j'ai cette erreur :
ERROR in
action number 1
of Step Event0
for object o_player:
instance_create_layer :: specified layer "bullets" does not exist
at gml_Object_o_player_Step_0 (line 20) - with (instance_create_layer(x, y, "bullets", o_556)) {
############################################################################################
gml_Object_o_player_Step_0 (line 20)
Je trouve pas ou est mon erreur.
Merci
Tu as du oublié de créer le layer appelé "bullets" dans la salle (ce que je fais à 9:53) ou alors les noms ne correspondent pas exactement
@@blobfishdev merci j'avais pas vue ... j'ai chercher pendant 2h XD merci pour ton tuto exeptionnel !
WHEN I PRESS A IT BRINGS ME TO THE TOP LEFT CORNER AND WHEN I PRESS D IT BRINGS ME TO THE BOTTOM RIGHT CORNER HELP MEEEEEEEEEEEEEEEEEEEE
make sure when you use the x = or y = command that you make it equal itself plus the movement speed. Example: x = x + Pspeed;
brown blaster
@Thomas Gervraud It Has this error in my code:
Object: o_game Event: Step at line 4: malformed assignment
This was what i wrote for the code at the step event:
var enemies = instance_number(o_enemy);
var allDead = true;
for (var i = 0; i < enemies;i **) {
if (!instance_find(o_enemy, i).dead) allDead = false;
}
if (allDead) game_restart();
In your for loop you wrote i** instead of i++
@@blobfishdev Thanks!
@@blobfishdev NOOB QUESTION How do you get out of full screen esc does not work
@@vipergamingyt4974 You need to code it. In your o_game step event add some code to check when the player presses the esc key and set full screen mode to false. It'll look something like
if (keyboard_check_pressed(vk_escape)) {
window_set_fullscreen(false);
}
@@blobfishdev Oh thanks, you rock!
Hello i am Back after 1 year :) still enjoy you
How to do this in unity ?
I'll probably make the same tutorial for Unity later
Are you french ?
Yes
where is the code
thomasgvd.itch.io/top-down-shooter
Import the .yyz file into GameMaker Studio 2 and you'll have the code
he can walk through the walls
Yeah there's no collision code
4:21 Je ne comprend pas pour les controles, j'ai écrit exactement pareil
var xMove = keyboard_check(ord("Q")) - keyboard_check(ord"D"));
var yMove = keyboard_check(ord("S")) - keyboard_check(ord"Z"));
et j'ai toujours un logo rouge a gauche et les messages d'erreur lorsque je lance le test
Il y a écrit quoi dans le message lorsque tu passes ta souris sur l'icône rouge ou quand tu essaies de lancer le jeu ?
@@blobfishdev sur la première ligne, la première icône rouge me dit "Obtenu 'D' (str) alors que ',' était attendu" et lorsque je lance le test, il y a marqué :
Objet : Oplayer Événement : Étape à la ligne 1 : got 'D' expected ',' or ')'
Objet : Oplayer Événement : Étape à la ligne 1 : got 'D' expected ')'
Objet : Oplayer Événement : étape à la ligne 1 : malformed assignment statement.
Désolé du dérangement ça se trouve c'est très simple et je passe pour un débile 😅😂 Mais merci d'avance !
@@Guigui1080p Tu as oublié une parenthèse pour le deuxième élément de chaque ligne : keyboard_check(ord"D")) et keyboard_check(ord"Z")), juste avant le "D" et le "Z"
Ca devrait être :
var xMove = keyboard_check(ord("Q")) - keyboard_check(ord("D"));
var yMove = keyboard_check(ord("S")) - keyboard_check(ord("Z"));
(et d'ailleurs tu as aussi inversé le Q et le D par rapport à mon code ce qui va t'inverser le mouvement sur l'axe horizontal)
@@blobfishdev Hoo okai merci !👌🏻
is gml or dnd
GML
Weres The Code hmmm?
The project file is on the itch.io page
WHY SPRIT COST MONEY
I NO
now how to spawn enemies hahahaha
why the fck movement is QZSD
In France our keyboards are AZERTY and not QWERTY so the layout is different
french
great tutorial!
but it will be better if it in 30min not 10min.
Why take 30mn if it can be done in 11?
@@blobfishdev make it better xD
its good but I it still need a lot of things so maybe 30 is better (I mean make it longer and add more stuff)
fait en en francais ;)
Thank you!