DUDE. Your game maker tutorials are the best on youtube...just sayin man. Once I discovered this channel- there was no reason to go to any other GM tutorials. Keep it up!
Thanks for the tutorial. I have something to add, however: When the hitbox object is set to not visible (Visible checkbox ticked off), the draw event won't take place. That means the post draw instance_destroy will never happen. Which means there will be invisible hitboxes littered around the place wherever the player attacked. Since the hit detection takes place in the player object, the moment the hitbox is created, it might not affect anything. However if you have something in your enemy object, for example to play a sound when it collides with the hitbox, it will play that sound each time it touches one of the invisible boxes, like if it walks past a point where the player attacked earlier and the hitbox is still there.
Shaun, all i wanna say is thanks! I LOVE your videos. Im so thankfull. With your tutorials now im able to make my games. Now im working on a game that hopefully will get launched on steam. I love you and your videos thank you so much. I do not know where i was going to be now without you. To be honest, your videos changed my life. Thank you so much. Please make advertising on your videos, so people can help you without patreon. I wanna help you as much as i can so i disable my adblock. But im SO sorry im not able to help you on patreon. And once again... THANKS! :-)
CAUSE I'M GOING DOWN THE STEPS ON A WHITE LINE, GOING DOWN THE STEPS ON A WHITE LINE. GOING DOWN THE STEPS ON A WHITE INE STRAIGHT TO NOWHEREEEE ( excuse necropost, couldn't not for a fellow AiC fan )
Really Cool! i've just started learning GM to make an RTS like the days of old (SC1, C&C, Dark Reign) so really appreciate all your videos Shaun, keep it up mate :)
Hey I need help with something. I want to know how to make a like 00:00:00 stopwatch, that keeps continuing until the end of the game. Can I have help?
Great to hear from you again. Awesome comeback! I've looked into your channel bio and it wanted to ask on which projects you have worked at Ubisoft and what was your job there?
It may have been shown and explained in a tutorial I haven't seen, but tell me if I have this right. Within the project files for this tutorial, there's a script called Player_MoveCollide and within it is a section titled //====Fractional Movement Storage. In it is the first use of *hsp_f* and *vsp_f* within the code, and I was trying to figure out what they are for. Simply, my question is: Is that section of the code for removing the decimal values of the *hsp* and *vsp*, leaving them at whole numbers, making it easier to use *hsp_final/vsp_final* in commands such as place_meeting? Or is something else happening that I'm not quite getting? I just want to understand every part that's happening, and there's a lot here that I haven't seen and am figuring out myself
Hey Shaun love your tutorials! If you're planning on more combat tutorials id love to know how to do a more in depth COMBO system kind of like in smash, that would be freaking amazing! Keep it up man!
+stejkrobot its really simple, in GM you can do this: create a var (i.e: comboTime=0), you need to manipulate the var every time you do an action, in this case, a hit, so: if ("PRESSING A BUTTON" = 1) { if(comboTime > 0) { comboTime+=1 alarm[0]="NUMBER OF STEPS" "DO AN ACTION" } } note, that since the var detection its only active when you're doing an action(pressing a key or mouse button), the var will become 0 again, then you change the state of comboTime to 1, you will verify that var every time you press your action button, and activate an alarm while doing that. Every different action will be performed in the comboTime var, so, if you want to create a multiple hit combo, you will need to make a switch, insted of an if statement. The comboTime will be affected every time you press you action button, so it will increase, and change the action performed each time, the alarm will set the time you have before reseting the comboTime to 0, and its affected by every button action, this will allow you to reset the alarm every time you press the button, allowing you to increase the var to perfomr a different action or combo. This is just Pseudocode, but its basically what you can do in a simple way to perform chained action, or in this case, a combo.
I have a problem where my player object gets stuck inside floor objects. For example, I can reproduce the error ; the player is a sprite of 42x42 (though the bounding box is less for collision as the character isn't a square box), every wall object I use is also 42x42 and are square boxes for collision. When my player moves and turns the opposite way quickly when falling (at the corners of walls), the player object then becomes stuck as if one corner of the player has fallen into the object and the game wasn't fast enough to stop this? Any help would be appreciated.
Everything works pretty well in tandem with the code for the enemy AI as well, however the enemy's animations won't play upon movement. Any way to fix?
What if I want to be able to move and attack at the same time? How might I get the hitbox to follow the player? The code I have now includes assigning a "Creator" variable (equal to the "attacking object" in a script that creates the hitbox), and in the step event of the hitbox I have x = Creator.x(plus whatever offset) y = Creator.y but despite a lack of conditions on this code, it only runs *once.* The hitbox shows up at the location it was initially executed and remains there.
You should do a tutorial about high score systems, I'm trying to make one for my asteroids game, and I have succeeded. However, the high score system restarts after I close the game.
Amazing. Fixed my problem. however it raised another. If i keep my hitbox 'visible' it works fine, but when i turned 'Visible' off, it was like it was always there, and doesn't go away after being created. Please help?
Thanks for this, but I found a bug. The draw end does not work if the hitboxes are invisible, so they are never destroyed. Every swing creates a new object that just stays there.
Thanks for helping me out, I ended up just putting the "instance_destroy();" in a collision with the enemy parent event. Working pretty well so far, but still interested in your solution. Thanks again!
This is a great tutorial and helped a lot. I do have one issue I'd love if someone could help me with. My animation is quite a few frames long and the hitbox is only appearing when the button is held to the point where the hitbox appears. If you were to just tap the button, the animation plays, but the hitbox doesn't. Anyone know what I can do to fix this? Or possibly even a way to force the button press to register for the duration of the animation regardless of if it's held or tapped? Hope this makes sense
How can i make my character Dash Forward when he uses the attack? In my game you have to be walking in a direction for him to dash forward and if you hold the Movement Keys he usually stops the animation prematurely, I do not want that.
I have an issue. When I press the attack my horizontal speed goes through the roof, if attacking in air the fall cycle (gravity) is interrupted so he floats through the attack cycle and the hitbox is not registering a hit. Also how do you get the hitbox orient for both directions?
Hey Shaun, think you could make JRPG tutorials? It could be an entire series on how to make worlds with smaller town rooms, how to make random encounters every few steps, how to make different enemies spawn in newer map areas, how to make the turn-based combat, etc.
So does this work as precise collision with the hitbox? Because I'm confused by it, wouldn't it hit the enemy when the hitbox sprite touches the enemy, not the red box and make it hit even when not colliding with the enemy? Or is there something else being done that makes it precise?
Thanks for the video. I have a question. I removed the instance_destroy(); because I wanted to make sure that my hitbox object after it was created when I collided with the enemy (my enemy moves) my enemy dies, but it does not work, it only works when they collide when I'm creating my hitbox object. I tried changing the instance_place(); function to place_meeting(); but it does not work either
I have a problem: When I press my attack button (in this case J, because Shovel Knight) the player gets stuck in the 1st frame of the attack animation ant won't let me move it; but whenever I press it while moving it works as it should. Also, if i'm jumping I can't move either (but keep the momentum) but it plays only the first 2 frames of the animation, which has 5 frames. I'm using the code from your Platform Game series and yes, I'm using State Machines
I am using the lines of code from the platformer tutorial, and I can't get the attack animation to run because I think it conflicts with: //animation if(move!=0) image_xscale = move; if (place_meeting(x,y+1,obj_solid)) { if (move!=0) sprite_index = spr_player_run; else sprite_index = spr_player_stand; } else { if (vsp < 0) sprite_index = spr_player_jump; else sprite_index = spr_player_fall } what should I do?
Hi Shaun! Can this code be used in commercial projects for example in Google Play? Heavily modified though, but saving the base moving, jumping, combat and particles codes.
hey shaun! awesome video! I downloaded the project files and saw that you had an object obj_wall but no sprites selected, you also had no sprite for the Grass and box texture. So, my question is: how can I do this or at least have an object that holds more sprites than one for obj_wall so I can use different textures for my ground. thanks in advance.
so im working on a space invaders type game and need help with randomly making enemies drop "bullets"..i can make them all drop at once but cant figure how to make random and continue until shoot them
Sorry for bugging you... But I'm doing some text boxes - problem is I'm using views and I can't for the life of me figure out how to destroy the old text boxes without destroying the new one. The text box has to be destroyed after 3.5 seconds (like any normal text box). The basic premise is this (without me trying to destroy the old text boxes): I create the text box from some condition being checked. It's created but it's created at specific coordinates relative to the view. I then continue meeting the check and it spams text boxes for days...
I would do a similar thing to this for my own game but I would like to know how *you* would overcome the following issue: With this method, multiple hitboxes are created within a certain timeframe (of the swing) and each time if the enemy isn't knocked back or doesn't move out of the hitbox quick enough it will take multiple damage instances. Without making the enemy invulnerable, how would you stop an enemy from taking damage more than once from the same hitbox? Would you just assign each hitbox an attack ID and disable damage if last hit ID == current hit ID? Or is there a more intuitive method or something I'm not thinking of?
SencilSketches i don't understand why you need to avoid making the enemy invincible. that's the easiest way to stop it from being hit multiple times in the same swing
Olivia Because I want it so that you can hit the enemy multiple times from multiple simultaneous attacks or a barrage of attacks within a small timeframe, just not the same hitbox because it is a combo-heavy focused combat. The hitbox needs to last longer than one frame so you don't always need precise frame-perfect execution but only deal the damage instance once.
edit: nevermind, this probably doesn't answer your question. I didn't see you say you want simultaneous attacks to be possible. sorry! I'm leaving the rest up in case it helps someone else. SencilSketches i still think timers or timer variables will work. if you have code in the Step event that says "if (hit != 0) health -= 10; hit = 0;" and it's taking too much damage, try delaying the "hit = 0" part. here's a vague outline of how it could work: frame 0: disallow new hits if we just took one (if hit==1) frames 1 thru 4: if collision occurs then "hit = 2" and define damage/recoil for the combo hits frame 5: remove the timer, hits after this point are "hit=1" regulars again I hope that makes sense. if the combo'd hits work exactly the same as initial hits then ignore the hit=2 nonsense
Interesting.My way of doing it is similar but I only create one object. This object's sprite is only the weapon swinging from the original sprite. Once it checks for the attack keypress it just does the animation and create the object. Since the object's animation matches of that of the character. The hitbox object deletes itself after the animation is finished.
I got this program and I really want to start game development. I know almost nothing about game development though, any idea what I should do to get started?
for some reason as soon as my hitbox is visible it doesn't deal damage. and when its invisible it takes forever for it to despawn! idk how to fix? help?
this is a quite unrelated question, but im trying to have two different sizes of text. when i draw_set_font i change all the fonts. ive been looking on the internet but nothing seems to come up. help would be nice, thank you
Hey so i downloaded the project files from this tutorial, as i wanted to use the skeleton animation when the skeleton gets hit for my own enemy, however, after adding in movements to my enemy, the enemy gets knocked into the player character(forwards). Anyone knows a way to reverse that, so that the enemy gets knocked AWAY from the player character(backwards)?
I had a question about something very specific. A simple character dash. Seems I'm having a tough time even with help from the GM community. Sorry I know this video isn't about this but I was wondering if you had a video or tutorial somewhere that covers a dashing mechanic?
quick request could you make a video on having a moveable game, or the game moves with your character so your not restricted with in the space of a room( like in mario, mario is technically not moving left or right but the game is making it appear like that)
If visibility is on it works like a charm BUT when I toggle the hitbox's visibility off the PostDraw event does not destroy the hitbox instance. I'm guessing with the visibility off it is not registering a draw event and hence no PostDraw event is triggered?
ATM I've changed it to destroy at Animation End but am hoping for a better work around. If I were to have multiple frames in my hitbox sprite (different hit box for each attack perhaps, for example a punch hit box and a lower kick hit box) and just reference the required frame when creating an attack then animation end wouldn't work, right?
In doing all these steps my game attack sprites are now broken. I tried following all these steps and it didnt work so just got rid of all the code and now when i press the key for my attack it doesnt come out at all even though ive completely remade the sprites and object events for them
image_index based melee doesn't work in gms2 as far as i can tell its because even if image_speed = 1 the image index doesn't increase by multiples of 1 heres an example, if you have: image_speed = 1; if (image_index > 1) and (image_index < 2) { with (instance_create_layer(x,y,"layer0",obj_playerstrikehb)) { image_xscale = other.image_xscale; with (instance_place(x,y,obj_enemy)) { hp = hp - 1; } } } with obj_playerstrikehb being the hitbox you would expect 0 damage since no integer of image_index can be >1 and 1 with image_index > 0 and image_index < 2 with image_index < 3 you would expect the code to only apply damage on image_index 1 and 2 (>0 and and < with = signs and the and function with or therefore getting: if (image_index = 1) or (image_index = 2) the code works perfectly only applying 2 damage each time (on index 1 and 2) killing the enemy in exactly 5 hits each time. did other testing but to lazy to write it all my theory is that image_index does not increase by integer amounts even with image_speed = 1 but by some other amount (maybe a pseudo spectrum of half images ....idk)
I have a concern. Whenever my player stands right over the enemy's sprite and attacks, the enemy disappears. This also happens in your project file. What's going on?
There is a part "image_xscale = sign(hsp)" that world most likely return zero if the enemy is standing still, causing it to disappear. I recommend replacing that line with "if(hsp != 0) image_xscale = sign(hsp)"
Mario susanto or just make a collision between the player and the enemy, you know, you wouldn't really want your players be able to go throgh your enemies. But if you do, your method is good. I would just change some stuff, but i would do it with Shauns code too because i want some things different and my way, obviously
Hey Shaun can you make a tutorial for platformers how to make propeler and switch blocks. switch blocks like from mario galaxy and propeler/fan to propel the player up.
How can i move and hit at the same time, I sure know some codes,but you're more experienced, and I wanted to know the best approach to this situation Thanks for the awesome videos.
Hi Shaun, would this work in a top down shooter if I had a melee sprite for example, it would create the same object the platformer player does when it attacks?
Great to see you making content every now and then, hope YoYo's treating you well!
i like ur tutorials
Great to see a fresh tutorial Shaun.
Since when do you do Game Maker?
About two years ago I started messing around with Game Maker.
That's cool :D
omg me to and the same time now for me its been 3 years and you as well now
DUDE. Your game maker tutorials are the best on youtube...just sayin man. Once I discovered this channel- there was no reason to go to any other GM tutorials. Keep it up!
it feels like Christmas when my phone notifies me that Shaun added a new video!!!! :)
I literally started doing a melee game a week ago and was sad that I would have to figure all this out without your tutorials haha
So happy you're doing vids again!
My game is halfway there because of you (code is done, too lazy for animating).
Thanks so much for the tutorials!
Thanks for the tutorial.
I have something to add, however: When the hitbox object is set to not visible (Visible checkbox ticked off), the draw event won't take place. That means the post draw instance_destroy will never happen. Which means there will be invisible hitboxes littered around the place wherever the player attacked.
Since the hit detection takes place in the player object, the moment the hitbox is created, it might not affect anything. However if you have something in your enemy object, for example to play a sound when it collides with the hitbox, it will play that sound each time it touches one of the invisible boxes, like if it walks past a point where the player attacked earlier and the hitbox is still there.
Holy crap, Gun That Shoots Bees is already a year old? o_o
Good to see another tutorial, it's been a while!
Its been quite a while since I have seen a video from you Shaun. However, I can really tell the quality of your videos is a lot better!
Shaun, all i wanna say is thanks! I LOVE your videos. Im so thankfull. With your tutorials now im able to make my games. Now im working on a game that hopefully will get launched on steam. I love you and your videos thank you so much. I do not know where i was going to be now without you. To be honest, your videos changed my life. Thank you so much. Please make advertising on your videos, so people can help you without patreon. I wanna help you as much as i can so i disable my adblock. But im SO sorry im not able to help you on patreon. And once again... THANKS! :-)
Finally, you've returned! With great timing too; I've been having some trouble with melee attacks myself.
Perfect timing for this; just getting started on making melee attacks and animations
CAUSE I'M GOING DOWN THE STEPS ON A WHITE LINE, GOING DOWN THE STEPS ON A WHITE LINE. GOING DOWN THE STEPS ON A WHITE INE STRAIGHT TO NOWHEREEEE ( excuse necropost, couldn't not for a fellow AiC fan )
xD
This was an amazing video this time around!
Great visual representations here to help with understanding.
Good work
Hey Shaun, how do you make the windows for room editing and stuff always appear in that empty space on the right?
Thanks for coming back :)
Just when i am trying to focuse on the combat of my project,however
the part that bother me the most is the A.I
Thank you so much man! Before watching this video, I couldn't get my melee to work, but now it does! Thank you so much!
Really Cool! i've just started learning GM to make an RTS like the days of old (SC1, C&C, Dark Reign) so really appreciate all your videos Shaun, keep it up mate :)
I'm learning GM to prototype games on it. Thanks for your amazing tutorials, and I hope you the best! :)
SHAUN! THANX FOR ALL THE GM TUTORIALS!!
I miss your videos, please upload more if you have the time, thanks!
that production value holy shit
Thank god your still doing vids
The legend returns
Please keep uploading. I love your videos!
Hey I need help with something. I want to know how to make a like 00:00:00 stopwatch, that keeps continuing until the end of the game. Can I have help?
I miss your tutorials... Please say this is one of many...
We all hope that
Hey man! Your videos help me out immensely, thanks for your hard work!
Been waiting for weeks for this!! ^_^
I'm very happy with your comeback :)
Dang boy! it's about time, You get yourself a real job and you forget about us... {LOL} Thanks as always.
+Shaun Spalding your videos have helped me a LOT very appreciated.
It would be nice if you could create more tutorials and/or work with Heartbeast to create official tutorials that are easy to follow!!!
I see ya making tutorials after a long gap. anyways expecting some advanced tutorials too. and thanks for continuing making tutorials :D
Thank you dude, for this video! I have been searching for this for a long time!! ;)
Great to hear from you again. Awesome comeback! I've looked into your channel bio and it wanted to ask on which projects you have worked at Ubisoft and what was your job there?
YOURE NOT DEAD
+mlizzo Just thought the same!
+mlizzo Hopefully he is back!! we miss him!
Yeah! If you want to " talk " with him, just search on twitter :D
guys, i need help, i can't figure out how to make player or enemy knockback.
I read that with Amethyst's voice.
It may have been shown and explained in a tutorial I haven't seen, but tell me if I have this right.
Within the project files for this tutorial, there's a script called Player_MoveCollide and within it is a section titled //====Fractional Movement Storage. In it is the first use of *hsp_f* and *vsp_f* within the code, and I was trying to figure out what they are for. Simply, my question is: Is that section of the code for removing the decimal values of the *hsp* and *vsp*, leaving them at whole numbers, making it easier to use *hsp_final/vsp_final* in commands such as place_meeting? Or is something else happening that I'm not quite getting?
I just want to understand every part that's happening, and there's a lot here that I haven't seen and am figuring out myself
Hey Shaun love your tutorials! If you're planning on more combat tutorials id love to know how to do a more in depth COMBO system kind of like in smash, that would be freaking amazing! Keep it up man!
+stejkrobot its really simple, in GM you can do this:
create a var (i.e: comboTime=0), you need to manipulate the var every time you do an action, in this case, a hit, so:
if ("PRESSING A BUTTON" = 1)
{
if(comboTime > 0)
{
comboTime+=1
alarm[0]="NUMBER OF STEPS"
"DO AN ACTION"
}
}
note, that since the var detection its only active when you're doing an action(pressing a key or mouse button), the var will become 0 again, then you change the state of comboTime to 1, you will verify that var every time you press your action button, and activate an alarm while doing that. Every different action will be performed in the comboTime var, so, if you want to create a multiple hit combo, you will need to make a switch, insted of an if statement. The comboTime will be affected every time you press you action button, so it will increase, and change the action performed each time, the alarm will set the time you have before reseting the comboTime to 0, and its affected by every button action, this will allow you to reset the alarm every time you press the button, allowing you to increase the var to perfomr a different action or combo.
This is just Pseudocode, but its basically what you can do in a simple way to perform chained action, or in this case, a combo.
I have a problem where my player object gets stuck inside floor objects.
For example, I can reproduce the error ; the player is a sprite of 42x42 (though the bounding box is less for collision as the character isn't a square box), every wall object I use is also 42x42 and are square boxes for collision.
When my player moves and turns the opposite way quickly when falling (at the corners of walls), the player object then becomes stuck as if one corner of the player has fallen into the object and the game wasn't fast enough to stop this?
Any help would be appreciated.
A very cool Tutorial there think im gonna get goin on gamemaker sometime again when i will find more time.
Everything works pretty well in tandem with the code for the enemy AI as well, however the enemy's animations won't play upon movement. Any way to fix?
What if I want to be able to move and attack at the same time? How might I get the hitbox to follow the player? The code I have now includes assigning a "Creator" variable (equal to the "attacking object" in a script that creates the hitbox), and in the step event of the hitbox I have
x = Creator.x(plus whatever offset)
y = Creator.y
but despite a lack of conditions on this code, it only runs *once.* The hitbox shows up at the location it was initially executed and remains there.
You should do a tutorial about high score systems, I'm trying to make one for my asteroids game, and I have succeeded. However, the high score system restarts after I close the game.
Well he's made a highscore system, coicidentally the highscore system tutorial he made is a highscore system on the Asteroids game.
Amazing. Fixed my problem. however it raised another. If i keep my hitbox 'visible' it works fine, but when i turned 'Visible' off, it was like it was always there, and doesn't go away after being created. Please help?
Thanks for this, but I found a bug. The draw end does not work if the hitboxes are invisible, so they are never destroyed. Every swing creates a new object that just stays there.
Did you ever find a solution to this? I'm currently having this very problem...
iirc, I added a draw event and left it blank (well added a //don't to it so it would run)
I'll have to check my code.
Thanks for helping me out, I ended up just putting the "instance_destroy();" in a collision with the enemy parent event. Working pretty well so far, but still interested in your solution. Thanks again!
HE IS ALIVE OMGGGGG
This is a great tutorial and helped a lot. I do have one issue I'd love if someone could help me with.
My animation is quite a few frames long and the hitbox is only appearing when the button is held to the point where the hitbox appears. If you were to just tap the button, the animation plays, but the hitbox doesn't. Anyone know what I can do to fix this? Or possibly even a way to force the button press to register for the duration of the animation regardless of if it's held or tapped? Hope this makes sense
Wouldn't it be easier to draw a Sprite over the top of the character and set a mask?
Cool stuff Shaun, keep 'em coming :D
Thanks for the tutorial and the project files.
How can i make my character Dash Forward when he uses the attack? In my game you have to be walking in a direction for him to dash forward and if you hold the Movement Keys he usually stops the animation prematurely, I do not want that.
I have an issue. When I press the attack my horizontal speed goes through the roof, if attacking in air the fall cycle (gravity) is interrupted so he floats through the attack cycle and the hitbox is not registering a hit. Also how do you get the hitbox orient for both directions?
Hey Shaun, think you could make JRPG tutorials? It could be an entire series on how to make worlds with smaller town rooms, how to make random encounters every few steps, how to make different enemies spawn in newer map areas, how to make the turn-based combat, etc.
So does this work as precise collision with the hitbox? Because I'm confused by it, wouldn't it hit the enemy when the hitbox sprite touches the enemy, not the red box and make it hit even when not colliding with the enemy? Or is there something else being done that makes it precise?
I just figured out that if you have just a retangle or square than the colision mask will just cover that area clears things up for me
Thanks for the video. I have a question. I removed the instance_destroy(); because I wanted to make sure that my hitbox object after it was created when I collided with the enemy (my enemy moves) my enemy dies, but it does not work, it only works when they collide when I'm creating my hitbox object. I tried changing the instance_place(); function to place_meeting(); but it does not work either
I have a problem:
When I press my attack button (in this case J, because Shovel Knight) the player gets stuck in the 1st frame of the attack animation ant won't let me move it; but whenever I press it while moving it works as it should. Also, if i'm jumping I can't move either (but keep the momentum) but it plays only the first 2 frames of the animation, which has 5 frames.
I'm using the code from your Platform Game series and yes, I'm using State Machines
Thanks, finally found has been looking for in relation to this, and thank you very much!
I am using the lines of code from the platformer tutorial, and I can't get the attack animation to run because I think it conflicts with: //animation
if(move!=0) image_xscale = move;
if (place_meeting(x,y+1,obj_solid)) {
if (move!=0) sprite_index = spr_player_run; else sprite_index = spr_player_stand;
}
else
{
if (vsp < 0) sprite_index = spr_player_jump; else sprite_index = spr_player_fall
}
what should I do?
The hitbox shows up during the walk animation instead of during the attack animation, I'm not using states.
very new to gamemaker how do you make the player use the sword when space is clicked
i would go into a key press event.
Good lord, you're doing alot of editing in these videos! Hope you don't overwork yourself. Nice work btw.
Hi Shaun! Can this code be used in commercial projects for example in Google Play? Heavily modified though, but saving the base moving, jumping, combat and particles codes.
you made me realize that guns and swords are so similar
hey shaun! awesome video! I downloaded the project files and saw that you had an object obj_wall but no sprites selected, you also had no sprite for the Grass and box texture. So, my question is: how can I do this or at least have an object that holds more sprites than one for obj_wall so I can use different textures for my ground. thanks in advance.
so im working on a space invaders type game and need help with randomly making enemies drop "bullets"..i can make them all drop at once but cant figure how to make random and continue until shoot them
Come back man, we need the vids
Sorry for bugging you... But I'm doing some text boxes - problem is I'm using views and I can't for the life of me figure out how to destroy the old text boxes without destroying the new one. The text box has to be destroyed after 3.5 seconds (like any normal text box).
The basic premise is this (without me trying to destroy the old text boxes): I create the text box from some condition being checked. It's created but it's created at specific coordinates relative to the view. I then continue meeting the check and it spams text boxes for days...
I would do a similar thing to this for my own game but I would like to know how *you* would overcome the following issue:
With this method, multiple hitboxes are created within a certain timeframe (of the swing) and each time if the enemy isn't knocked back or doesn't move out of the hitbox quick enough it will take multiple damage instances.
Without making the enemy invulnerable, how would you stop an enemy from taking damage more than once from the same hitbox? Would you just assign each hitbox an attack ID and disable damage if last hit ID == current hit ID?
Or is there a more intuitive method or something I'm not thinking of?
SencilSketches i don't understand why you need to avoid making the enemy invincible. that's the easiest way to stop it from being hit multiple times in the same swing
Olivia Because I want it so that you can hit the enemy multiple times from multiple simultaneous attacks or a barrage of attacks within a small timeframe, just not the same hitbox because it is a combo-heavy focused combat.
The hitbox needs to last longer than one frame so you don't always need precise frame-perfect execution but only deal the damage instance once.
edit: nevermind, this probably doesn't answer your question. I didn't see you say you want simultaneous attacks to be possible. sorry! I'm leaving the rest up in case it helps someone else.
SencilSketches i still think timers or timer variables will work. if you have code in the Step event that says "if (hit != 0) health -= 10; hit = 0;" and it's taking too much damage, try delaying the "hit = 0" part.
here's a vague outline of how it could work:
frame 0: disallow new hits if we just took one (if hit==1)
frames 1 thru 4: if collision occurs then "hit = 2" and define damage/recoil for the combo hits
frame 5: remove the timer, hits after this point are "hit=1" regulars again
I hope that makes sense. if the combo'd hits work exactly the same as initial hits then ignore the hit=2 nonsense
Interesting.My way of doing it is similar but I only create one object. This object's sprite is only the weapon swinging from the original sprite.
Once it checks for the attack keypress it just does the animation and create the object. Since the object's animation matches of that of the character.
The hitbox object deletes itself after the animation is finished.
OH WOW HE IS BACK YES
Can you make a tutorial about top down games? exactly like the game at beginning
Sort of... I don't know what type of game is it tho
How does this work for top down shooters? I followed both the tutorial vid and this and I can get neither to work?
I’m trying to make the enemy knock back my player but it isn’t working with your moment code. How would I do that?
How do you make the font when making codes bigger ? i cant find it on google because no matter what i type in it is off topic
I got this program and I really want to start game development. I know almost nothing about game development though, any idea what I should do to get started?
Wow, I just started trying to make a game a few days ago too. Just in time!
Everything is working, but I'm wondering if it's possible for the player to keep moving after attacking as opposed to a full stop?
yes
I believe all you'd need to do is remove the hspd = 0; part. Try and see what happens. You probably figured it out already. Just other people to see.
for some reason as soon as my hitbox is visible it doesn't deal damage. and when its invisible it takes forever for it to despawn! idk how to fix? help?
this is a quite unrelated question, but im trying to have two different sizes of text. when i draw_set_font i change all the fonts. ive been looking on the internet but nothing seems to come up. help would be nice, thank you
Hey so i downloaded the project files from this tutorial, as i wanted to use the skeleton animation when the skeleton gets hit for my own enemy, however, after adding in movements to my enemy, the enemy gets knocked into the player character(forwards). Anyone knows a way to reverse that, so that the enemy gets knocked AWAY from the player character(backwards)?
is it possible that the collision mask animates on par with the animation?
if so how should it be coded?
Hey Shaun, could you do a tutorial on Shaders, because I have no clue how they work or what they even do.
for the "par_enemy" variable, couldn't i make its "obj_enemy" and have other enemies be parented to that one enemy?
Yup. The "par" stands for "parent".
Cool.
Bring more tutorials back
I had a question about something very specific. A simple character dash. Seems I'm having a tough time even with help from the GM community. Sorry I know this video isn't about this but I was wondering if you had a video or tutorial somewhere that covers a dashing mechanic?
I just looked at it. Awesome! Thanks.
greetings, I have a question, how do we get this code work if we want the facing left and facing right sprites to be different??
great vid btw!
quick request could you make a video on having a moveable game, or the game moves with your character so your not restricted with in the space of a room( like in mario, mario is technically not moving left or right but the game is making it appear like that)
yess you're uploading again!
If visibility is on it works like a charm BUT when I toggle the hitbox's visibility off the PostDraw event does not destroy the hitbox instance. I'm guessing with the visibility off it is not registering a draw event and hence no PostDraw event is triggered?
ATM I've changed it to destroy at Animation End but am hoping for a better work around. If I were to have multiple frames in my hitbox sprite (different hit box for each attack perhaps, for example a punch hit box and a lower kick hit box) and just reference the required frame when creating an attack then animation end wouldn't work, right?
This will be really great for my first game O.O Thank you so much!
In doing all these steps my game attack sprites are now broken. I tried following all these steps and it didnt work so just got rid of all the code and now when i press the key for my attack it doesnt come out at all even though ive completely remade the sprites and object events for them
won't increasing your sprite with to include your sword swing give you all kinds of collision problems?
You can manually edit hit boxes by clicking "Modify Mask" on the sprite menu.
Are going to start mondev again
nice video, never seen this topic out there,,,keep it coming
image_index based melee doesn't work in gms2 as far as i can tell its because even if image_speed = 1 the image index doesn't increase by multiples of 1 heres an example, if you have:
image_speed = 1;
if (image_index > 1) and (image_index < 2)
{
with (instance_create_layer(x,y,"layer0",obj_playerstrikehb))
{
image_xscale = other.image_xscale;
with (instance_place(x,y,obj_enemy))
{
hp = hp - 1;
}
}
}
with obj_playerstrikehb being the hitbox you would expect 0 damage since no integer of image_index can be >1 and 1 with image_index > 0 and image_index < 2 with image_index < 3 you would expect the code to only apply damage on image_index 1 and 2 (>0 and and < with = signs and the and function with or therefore getting: if (image_index = 1) or (image_index = 2) the code works perfectly only applying 2 damage each time (on index 1 and 2) killing the enemy in exactly 5 hits each time. did other testing but to lazy to write it all my theory is that image_index does not increase by integer amounts even with image_speed = 1 but by some other amount (maybe a pseudo spectrum of half images ....idk)
You should make another tutorial on platformer knockback, this is the first video I've found that has a fully working knockback with collisions! :D
I have a concern. Whenever my player stands right over the enemy's sprite and attacks, the enemy disappears. This also happens in your project file. What's going on?
There is a part "image_xscale = sign(hsp)" that world most likely return zero if the enemy is standing still, causing it to disappear. I recommend replacing that line with "if(hsp != 0) image_xscale = sign(hsp)"
Mario susanto thanks, i'll give it a try
Mario susanto or just make a collision between the player and the enemy, you know, you wouldn't really want your players be able to go throgh your enemies. But if you do, your method is good. I would just change some stuff, but i would do it with Shauns code too because i want some things different and my way, obviously
The Link doesnt work, please fix. Great vid.
+Shaun Spalding it works now, thanks! :)
+Shaun Spalding i have a question create a video for a buy item white game money and realy money
Hey Shaun can you make a tutorial for platformers how to make propeler and switch blocks.
switch blocks like from mario galaxy and propeler/fan to propel the player up.
If I were going to work on a game with friends in game maker how would I go about doing that? Thanks
How can i move and hit at the same time, I sure know some codes,but you're more experienced, and I wanted to know the best approach to this situation
Thanks for the awesome videos.
Hi Shaun, would this work in a top down shooter if I had a melee sprite for example, it would create the same object the platformer player does when it attacks?
I think you just gotta flip the hitbox vertically (from this "->" to this "^")
+Dialga700PixelMaker I thought it was something like that lol, thanks
No problem
thank you so much for your tutorials