"Approach" is a script, not a built in gamemaker function. For those looking to emulate the exact acceleration code I used you can get the script here: pastebin.com/7gzJTLKj
@@littlericeball1872 /// Approach(a, b, amount) // Moves "a" towards "b" by "amount" and returns the result // Nice bcause it will not overshoot "b", and works in both directions // Examples: // speed = Approach(speed, max_speed, acceleration); // hp = Approach(hp, 0, damage_amount); // hp = Approach(hp, max_hp, heal_amount); // x = Approach(x, target_x, move_speed); // y = Approach(y, target_y, move_speed); if (argument0 < argument1) { argument0 += argument2; if (argument0 > argument1) return argument1; } else { argument0 -= argument2; if (argument0 < argument1) return argument1; } return argument0;
I suppose it's possible that I'm just being silly, but what exactly is the advantage to using this "Approach" script instead of just using a lerp function? They look like essentially the same thing to me -- am I overlooking something?
Hi all, getting some flickering between sprites and a very slow approach to the collision when I've applied this to my own project. Any thoughts on why this might be?
For those of you who have problem about Player motion not running, try to add this code, because for me it worked : hsp = (key_right - key_left) * hsp_walk; put it in oPlayer, then in the "Step" section at the end before the code: if (hsp != 0) sprite_index = OPlayer_BlueWalk; else sprite_index = OPlayer_BlueIdle;
Nevermind, I came up with a decent solution if hsp > 1 && key_left || hsp < -1 && key_right { sprite_index = sPlayer_Skid } else { if (hsp != 0) sprite_index = sPlayer_Run; else sprite_index = sPlayer; } maybe there's a cleaner way of doing it but whatever
If you have topic suggestions you can add them here: goo.gl/forms/sjOznhhFQgJo5TBD2 HOWEVER, topics are ultimately selected by patreon supporters ( www.patreon.com/shaunjs ) in polls. I only use these suggestions to help determine what sort of things should be in the polls.
Another amazing and very interresting video ! It 's very well explained, I'm french and I I understand very well. His videos are addictive, I see 20 video of shaun in 2 days :)
Hi, quite new to the GML language, how you you wall jump only from running and jumping as opposed to standing still next to a wall and then still sliding down the wall? if that makes sense. at the moment, if I am stationary next to a wall and jump it still applies the slide effect. thanks
Great! I have a question. I'm not sure anyone is still on here to answer, though. QUESTION: If the character is touching a wall, and simply wants to jump over it, the wall jump will inevitably kick in, thus forcing the player to stand a few pixels away from the wall (one would do the trick) before attempting again. So I'm thinking I'll make a different wall type for wall jumps to solve this, and will therefore have to select what walls can be wall-jumped and what walls cannot. But if you have any other ideas, I'd love to read about it. EDIT: Ohhh... this is happening, of course, because I have double jump as well. So normally for a higher wall, the character would double jump. But now I'm thinking of removing it, and making wall jump the only way to get higher. Double jump is disabled while touching the wall to enable wall jump at the moment. See what I've gotten myself into? The character's a cat. Cats don't double jump, but it's so satisfying.
11 months ago but in the unlikely chance your still trying, make your origin point middle center like the rest of your sprites, mess with collision masks, and the collision of the air sprite
Also question, how can i translate this into a dash jump. Im mostly using your platformer tutorial as my base as its my first time doing all this. Im having a hard time figuring out how to keep the dash speed when i jump.
I can only get the wall jump working on the left side. On the right, he just slides down with jump doing nothing. I've seen a few comments on this issue
Probably a bit late but I had the same issue and it was collision, since my jump sprite had a shorter collision box relative to the center point when landing this would jam the bottom of the standing sprite into the wall and stop if from moving sideways as it was stuck colliding with the wall. I just set the sollision mask of the player to be the same as the standing sprite, but the prper fix is probably making all your sprites the same size at the edges collision wise
I wrote everything exactly as shown in the video, but for some reason the movement doesn't work and jumping makes my sprite disappear. Anyone have any ideas what might be causing this?
Im having the same problem as a couple of other people here, the character can jump and everything else but is unable to walk, but i did find out that if you get yourself between a wall above you and a wall below you the character walks as he should but reverts to being unable to walk after landing once after a jump, i cant seem to find any problems or differences in the status calculating code, if anyone has any clues please help me out.
Thanks for another awesome tutorial, all videos have really helped me so much and I really appreciate the work you do. so my question on this topic, I feel like my player fall speed is really fast and Im trying to slow it down a bit, trying to give my player more an arch feel. For me, it just feels like the jump is too stiff, Im hoping that makes sense. I've adjusted my code in various places but haven't really nailed down where I can slow things down a bit. I modified the VSP_MAX value, but this affects the jump height and if i lower it, my player only jumps a few pixels. Can you provide some guidance a bit on how I can further control the speed of this jump and fall without affecting the jump height? Thanks!
I have a concern. I pretty much copied everything here, and the game runs. The issue is, as soon as my sprite hits my oGround block, my player sprite falls through it.
Hi, I know this is a super old video, but is there another video tutorial explaining the "moving with acceleration" code used in the players horizontal movement? I used it a few years ago and I can't find the original video for it, and i'm not sure if it originates from here. Many thanks!
you could set up an alarm[0] for the movement keys where the alarm starts on the first press, and if the second press of the same key happens before the timer/alarm runs out, perform the dash/enter dash state where you can mess with the sprite change, animation, dash speed, invulnerability, stamina, etc. You can mess with the duration of the alarm to your liking depending on how fast you want the player to press the keys to dash. And once the dash animation is done, exit out of that code/state back to the normal movement state/code and you can continue. //You can exit out of the state using a simple if statement within the dash state if animation_end() { state = "move"; } Setting up a stamina makes sure you can't just keep spamming dash to escape enemy attacks or cover huge distances in a very short time unless that's the clear intention. From here, it's all your design decisions taking priority. If you have no idea what I'm talking about, do check out Finite State Machines, they're amazingly useful. Shaun and Heartbeast both have excellent tutorials on it.
Hey Shaun, thanks for the video, for some reason my character can only jump and walking does not work, does anyone know how to fix that? Edit: Removing the hsp = 0 in horizontal movement seems to work but breaks wall jumping, i'm trying to find that code in your video but i havent been able to :/
@@gregsmillems4578 This is super late but I had the same issue and the problem was collision masks, my jumping sprite would change the bottom of the collision mask to be shorter than my standing sprite, when landing this would bump the standing collision into the wall object and lock it from walking sideways, as a quick fix I changed the object to use only the collision mask of the standing sprite.
That's cool and all but how did you assign variables in the Approach, part I tried the Dir var ,hsp value 0 and the friction, wut variables are in there ?????? im confused
There's a problem. If you're facing left and you're colliding with a wall to your right and jump you will wall jump but your player will be facing the wrong direction any fix?
Hi Shaun, whenever I try to do my walljump I can do it fluently but if i stay on the wall to slide down too much it'll automatically jump onto the other wall. This only happens with the wall behind me. Any help is appreciated. Thanks.
Quick question to Shaun or anyone else that is having an similar issue... well not really an issue, but I've gone through the tutorial and everything seems to work fine but whenever I jump against a wall I push off of it automatically. Ideally for a wall jump you want to jump towards a wall and then when you are sliding on the wall you press jump again to get to the other wall. The way the code is written you automatically jump off the wall as soon as you hit it, so you can conceivably just hold down your jump button and it will do the wall jumping for you all the way up to the top... anyone know what I might be missing in my code or what to modify? - I've triple checked the tutorial and can't find any difference. Cheers, thanks.
You need to add another type of delay; When the character touches/is touching the wall but is not touching the ground, set it to max; when you hit jump, set it to 0. Allow jumping whenever this delay is > 0.
Anyone got suggestion on how to control/adjust gravity? I am too stupid to figure it out myself. I just feel gravity is currently too forceful (got a very small res game) but when I change the gravity the 'fall' off a wall is not a smooth arc. Great tutorial though!
i have a really weird problem, all of this is working perfectly, but literally only on the right side. i cant wall jump on the left and i cant even see the sprite change to the wall jump one making me think it might be collision. if anyone has an idea as to whats wrong id appreciate the help :0
So, on my game, everything is working great except that it only give me the momentum backwards on walls to the left, and not walls to my right, does anyone have a solution?
I don't know if this is my problem but I tried reducing the ground friction and when I tried it I saw that the player speed when onground and dir=0 was beig decreased not smoothly- It changed to a fixed slower speed, then to a slower one and then the player was still. Shouldn't it be smooth?
hey shaun, how you doing. i just finish you tutorials and work just fine. the problem came when i tried to arrange the code into state machines with enums. i have a problem when i slide on the left walls. the mechanics work but the sprite dont work. what make me crazy its that the rigth walls works fine. Edited: Nvm I fixit it, I was asumming onWall was a boolean
Even with the following, I´m still getting weird x values for my player such as 546.15.. but after adding it I don´t get stuck when getting too close to walls so I guess it´s working as intended? Does anyone know? Sorry I´m just a lowly noob :) hsp += hsp_frac; vsp += vsp_frac; hsp_frac = frac(hsp); vsp_frac = frac(vsp); hsp -= hsp_frac; vsp -= vsp_frac;
アルバン.. it may be the scripts line, I’m an experienced coder and I would just double check the script before running your game. I’m also probably late to this comment as it’s later on but I hope this helps.
Thank u so much for your videos these have helped me sooo much but one question and actually rather a request if possible, how to make enemies follow the player for e.g a zombie game but not top down instead for a platformer (so they know how to go around rooms that havent been "open" if that makes any sense and path finding for platformers please) love ur content fan since ur 4th video 😁
In game maker 1 you can do Mp_potintal_step() And it will walk to a given rage to what ever object x and y you put in the () im not sure about gm2 but it might be the same
Hey Shaun... on line 65 where you're doing: onwall = place_meeting(x+1, y, oWall) - place_meeting(x-1, y, oWall); Wouldn't it be just as good, or even better, to do : onwall = place_meeting(x+1, y, oWall || place_meeting(x-1, y, oWall); ? That way: - if you're caught perfectly between walls at left and right, you could still wall jump. - if GML ever decides to implement boolean data type, so that true and false aren't 1 and 0 and can't be subtracted, the code would not break.
Unfortunately no. The subtraction makes a distinction between left and right (-1 and 1) and doing an Or would only return a "true" if one or both walls were touched. You'd have to do something else to calc both sides. But you are right about the hypothetical data type issue.
Hey man. Your "Approach" script is wrong. Why don't you check the information in your videos? This isn't the fist time, you know. Anyway... For those who have an issuer with the "Approach" script and the "undefined value" error, here is the right script: if argument0 < argument1 { argument0 += argument2; if argument0 > argument1 { return argument1; } } if argument0 > argument1 { argument0 -= argument2; if argument0 < argument1 { return argument1; } } return argument0;
@@lucasdestruction Hi. Did you try my script, that I left in this comment? Basically, you create a script, name it: Approach. Copy my code from this comment and paste it. Everything else from this video have to work.
@@Oliwarder Yeah already copy and pasted. No work for me :( Here's the code: function Approach() /// Approach(a, b, amount) // Moves "a" towards "b" by "amount" and returns the result // Nice bcause it will not overshoot "b", and works in both directions // Examples: // speed = Approach(speed, max_speed, acceleration); // hp = Approach(hp, 0, damage_amount); // hp = Approach(hp, max_hp, heal_amount); // x = Approach(x, target_x, move_speed); // y = Approach(y, target_y, move_speed); {
if argument0 < argument1 { argument0 += argument2; if argument0 > argument1 { return argument1; } } if argument0 > argument1 { argument0 -= argument2; if argument0 < argument1 { return argument1; } } return argument0; }
"Approach" is a script, not a built in gamemaker function. For those looking to emulate the exact acceleration code I used you can get the script here: pastebin.com/7gzJTLKj
thanks
can't get the script o/
@@littlericeball1872 /// Approach(a, b, amount)
// Moves "a" towards "b" by "amount" and returns the result
// Nice bcause it will not overshoot "b", and works in both directions
// Examples:
// speed = Approach(speed, max_speed, acceleration);
// hp = Approach(hp, 0, damage_amount);
// hp = Approach(hp, max_hp, heal_amount);
// x = Approach(x, target_x, move_speed);
// y = Approach(y, target_y, move_speed);
if (argument0 < argument1)
{
argument0 += argument2;
if (argument0 > argument1)
return argument1;
}
else
{
argument0 -= argument2;
if (argument0 < argument1)
return argument1;
}
return argument0;
thanks my hero
I suppose it's possible that I'm just being silly, but what exactly is the advantage to using this "Approach" script instead of just using a lerp function? They look like essentially the same thing to me -- am I overlooking something?
As a compliment to this video would you be able to cover ledge grabbing ?
did you ever figure it out? I've been trying for ages but cant seem to get it to work
Phew! I finished the tutorial and the sliding works perfectly with my game. Thank you so much, Shaun. And keep it up!!
This is really great! I renamed walljumpdelay to hsp_momentum and I'm using it for a lot of other moves too.
Hi all, getting some flickering between sprites and a very slow approach to the collision when I've applied this to my own project. Any thoughts on why this might be?
You and Heart beast should collab for the next Ludum Dare
yes!!
That'd be cool, but Ludum Dare doesn't allow teams.
thank you Shaun, now i can start make the game that i dreamed years and years to make!
Come on man, tell us how the game is going! You haven't ditched your dream, right?
Huh, I'm becoming curious myself. How is it going man?
My pc broke 2 months ago, but I still have the game file on my Pen Drive. maybe i will put it on itch.io when i fix my pc!
how's it going?
hows the game going?
For those of you who have problem about Player motion not running, try to add this code, because for me it worked :
hsp = (key_right - key_left) * hsp_walk;
put it in oPlayer, then in the "Step" section at the end before the code:
if (hsp != 0) sprite_index = OPlayer_BlueWalk; else sprite_index = OPlayer_BlueIdle;
How would you go about adding a skidding animation when changing direction with the current setup?
Nevermind, I came up with a decent solution
if hsp > 1 && key_left || hsp < -1 && key_right
{
sprite_index = sPlayer_Skid
}
else
{
if (hsp != 0) sprite_index = sPlayer_Run; else sprite_index = sPlayer;
}
maybe there's a cleaner way of doing it but whatever
If you have topic suggestions you can add them here: goo.gl/forms/sjOznhhFQgJo5TBD2
HOWEVER, topics are ultimately selected by patreon supporters ( www.patreon.com/shaunjs ) in polls. I only use these suggestions to help determine what sort of things should be in the polls.
Another amazing and very interresting video ! It 's very well explained, I'm french and I I understand very well. His videos are addictive, I see 20 video of shaun in 2 days :)
Hi, quite new to the GML language, how you you wall jump only from running and jumping as opposed to standing still next to a wall and then still sliding down the wall? if that makes sense. at the moment, if I am stationary next to a wall and jump it still applies the slide effect. thanks
Great!
I have a question. I'm not sure anyone is still on here to answer, though.
QUESTION: If the character is touching a wall, and simply wants to jump over it, the wall jump will inevitably kick in, thus forcing the player to stand a few pixels away from the wall (one would do the trick) before attempting again. So I'm thinking I'll make a different wall type for wall jumps to solve this, and will therefore have to select what walls can be wall-jumped and what walls cannot. But if you have any other ideas, I'd love to read about it.
EDIT: Ohhh... this is happening, of course, because I have double jump as well. So normally for a higher wall, the character would double jump. But now I'm thinking of removing it, and making wall jump the only way to get higher. Double jump is disabled while touching the wall to enable wall jump at the moment. See what I've gotten myself into? The character's a cat. Cats don't double jump, but it's so satisfying.
Anybody know how to add variable jump height?
I didn't use friction and my character just doesn't move against the wall
pls help meeeeee ;-;
11 months ago but in the unlikely chance your still trying, make your origin point middle center like the rest of your sprites, mess with collision masks, and the collision of the air sprite
Also question, how can i translate this into a dash jump. Im mostly using your platformer tutorial as my base as its my first time doing all this. Im having a hard time figuring out how to keep the dash speed when i jump.
I can only get the wall jump working on the left side. On the right, he just slides down with jump doing nothing. I've seen a few comments on this issue
Player is unable to move once they hit the ground, how do i fix this?
Probably a bit late but I had the same issue and it was collision, since my jump sprite had a shorter collision box relative to the center point when landing this would jam the bottom of the standing sprite into the wall and stop if from moving sideways as it was stuck colliding with the wall. I just set the sollision mask of the player to be the same as the standing sprite, but the prper fix is probably making all your sprites the same size at the edges collision wise
I wrote everything exactly as shown in the video, but for some reason the movement doesn't work and jumping makes my sprite disappear. Anyone have any ideas what might be causing this?
Im having the same problem as a couple of other people here, the character can jump and everything else but is unable to walk, but i did find out that if you get yourself between a wall above you and a wall below you the character walks as he should but reverts to being unable to walk after landing once after a jump, i cant seem to find any problems or differences in the status calculating code, if anyone has any clues please help me out.
Thanks for another awesome tutorial, all videos have really helped me so much and I really appreciate the work you do.
so my question on this topic, I feel like my player fall speed is really fast and Im trying to slow it down a bit, trying to give my player more an arch feel. For me, it just feels like the jump is too stiff, Im hoping that makes sense. I've adjusted my code in various places but haven't really nailed down where I can slow things down a bit.
I modified the VSP_MAX value, but this affects the jump height and if i lower it, my player only jumps a few pixels.
Can you provide some guidance a bit on how I can further control the speed of this jump and fall without affecting the jump height?
Thanks!
I have a concern. I pretty much copied everything here, and the game runs. The issue is, as soon as my sprite hits my oGround block, my player sprite falls through it.
I have this issue too
Hi, I know this is a super old video, but is there another video tutorial explaining the "moving with acceleration" code used in the players horizontal movement? I used it a few years ago and I can't find the original video for it, and i'm not sure if it originates from here.
Many thanks!
hey man ,i love your tutorials . will you make one about doing a double press dash too ? that would be awesome.
you could set up an alarm[0] for the movement keys where the alarm starts on the first press, and if the second press of the same key happens before the timer/alarm runs out, perform the dash/enter dash state where you can mess with the sprite change, animation, dash speed, invulnerability, stamina, etc. You can mess with the duration of the alarm to your liking depending on how fast you want the player to press the keys to dash.
And once the dash animation is done, exit out of that code/state back to the normal movement state/code and you can continue.
//You can exit out of the state using a simple if statement within the dash state
if animation_end()
{
state = "move";
}
Setting up a stamina makes sure you can't just keep spamming dash to escape enemy attacks or cover huge distances in a very short time unless that's the clear intention. From here, it's all your design decisions taking priority.
If you have no idea what I'm talking about, do check out Finite State Machines, they're amazingly useful. Shaun and Heartbeast both have excellent tutorials on it.
If someone can help with Approach it would help a lot, my player can jump but it cant move
Check the pinned comment, Approach is a script, and Shaun put a pastebin link to what the script should say.
Hey Shaun, thanks for the video, for some reason my character can only jump and walking does not work, does anyone know how to fix that? Edit: Removing the hsp = 0 in horizontal movement seems to work but breaks wall jumping, i'm trying to find that code in your video but i havent been able to :/
did you find a way? Im having trouble myself
@@gregsmillems4578 This is super late but I had the same issue and the problem was collision masks, my jumping sprite would change the bottom of the collision mask to be shorter than my standing sprite, when landing this would bump the standing collision into the wall object and lock it from walking sideways, as a quick fix I changed the object to use only the collision mask of the standing sprite.
That's cool and all but how did you assign variables in the Approach, part I tried the Dir var ,hsp value 0 and the friction, wut variables are in there ?????? im confused
There's a problem. If you're facing left and you're colliding with a wall to your right and jump you will wall jump but your player will be facing the wrong direction any fix?
Hi Shaun, whenever I try to do my walljump I can do it fluently but if i stay on the wall to slide down too much it'll automatically jump onto the other wall. This only happens with the wall behind me. Any help is appreciated. Thanks.
Quick question to Shaun or anyone else that is having an similar issue... well not really an issue, but I've gone through the tutorial and everything seems to work fine but whenever I jump against a wall I push off of it automatically. Ideally for a wall jump you want to jump towards a wall and then when you are sliding on the wall you press jump again to get to the other wall. The way the code is written you automatically jump off the wall as soon as you hit it, so you can conceivably just hold down your jump button and it will do the wall jumping for you all the way up to the top... anyone know what I might be missing in my code or what to modify? - I've triple checked the tutorial and can't find any difference. Cheers, thanks.
Update: nevermind, I had the jump key set to "keyboard_check" rather than "keyboard_check_pressed"
Anyone know how to jump onto the left wall from the right wall???? Its not letting me slide or wall jump at all!! PLEASE HELP!!
very nice tut! so i was wondering, how to provide the wall jump a "coyote time" since people prefer pressing the opposite direction to the wall!
You need to add another type of delay;
When the character touches/is touching the wall but is not touching the ground, set it to max; when you hit jump, set it to 0. Allow jumping whenever this delay is > 0.
Anyone got suggestion on how to control/adjust gravity? I am too stupid to figure it out myself. I just feel gravity is currently too forceful (got a very small res game) but when I change the gravity the 'fall' off a wall is not a smooth arc.
Great tutorial though!
i have a really weird problem, all of this is working perfectly, but literally only on the right side. i cant wall jump on the left and i cant even see the sprite change to the wall jump one making me think it might be collision. if anyone has an idea as to whats wrong id appreciate the help :0
My player randomly sticks to the wall when I just try to implement the animation change. Anyone else have this issue and know how to solve it?
Try changing the collision on your sprites
@@fuglfiringar6989 What do you mean? The collision box? I have changed it a few times, it doesn't fix anything :(
@@aricleighton sorry man im new to game maker to. Idk whats wrong :/
For some reason when I run the game, nothing responds. Is this happening to anyone else?
Olá tudo bem eu enviei um jogo pra Playstore e ele foi rejeitado fala para atualizar a libpng mais não sei como fazer isso pode me ajudar?
Translation: Hello I sent a game to Play Store but it got rejected, it's saying to update libpng but I don't know how to do that, can you help me?
The pastebin kind of confuses me.
What part of it am I using and what = what if I'm trying to make walking acceleration?
So, on my game, everything is working great except that it only give me the momentum backwards on walls to the left, and not walls to my right, does anyone have a solution?
Is there a reason I am scaling the wall simply by touching it?
I don't know if this is my problem but I tried reducing the ground friction and when I tried it I saw that the player speed when onground and dir=0 was beig decreased not smoothly- It changed to a fixed slower speed, then to a slower one and then the player was still. Shouldn't it be smooth?
It happens the same when you slide down a wall, first it goes at a speed and then at the max speed. All code is correct if i checked well.
hey shaun, how you doing. i just finish you tutorials and work just fine. the problem came when i tried to arrange the code into state machines with enums. i have a problem when i slide on the left walls. the mechanics work but the sprite dont work. what make me crazy its that the rigth walls works fine. Edited:
Nvm I fixit it, I was asumming onWall was a boolean
my character sprite slides perfectly on the left but it wont flip when i jump onto the right wall
should this code wrok on gm1?
pure class !
what about the approach function
oh wait nvm
what is standing in your draw event?
The dust particles I'm pretty sure
What is an alternative for "Approach" in GameMaker 1.4?
Approach is a script that works in any version! Get it here: pastebin.com/7gzJTLKj
Thanks! I was wondering about this myself. I'm using GMS2 and "Approach" wasn't working for me. Maybe add the script to the description?
I'm having this same issue. Anyone figure this out?
Nik Slabysh just copy the script Shaun posted into a script and call it approach
Shaun Spalding the "approach" variable isn't working here. Is it possable they changed the functionality of it?
Even with the following, I´m still getting weird x values for my player such as 546.15.. but after adding it I don´t get stuck when getting too close to walls so I guess it´s working as intended? Does anyone know? Sorry I´m just a lowly noob :)
hsp += hsp_frac;
vsp += vsp_frac;
hsp_frac = frac(hsp);
vsp_frac = frac(vsp);
hsp -= hsp_frac;
vsp -= vsp_frac;
Hey Shaun, love your vids! Helps me a lot!
But, will you be making GameMaker : Studio (Original) tutorials?
I've made lots of videos for 1.x that all still apply. Given most stuff is backwards compatible I tend to only cover 2.x going forwards.
Shaun Spalding Okay, Thanks Shaun!
why when I try to start the game it tells me that there is a mistake in line 15
my program looks like
/// Imputs
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check(vk_space);
// Calc horizontal movement
var dir = key_right - key_left;
hsp += dir * hsp_acc;
if (dir == 0)
{
var hsp_fric_final = hsp_fric_ground;
if (!onground) hsp_fric_final = hsp_fric_air;
hsp = Approach(hsp,0,hsp_fric_final);
}
[HERE] hsp = clamp(hsp,-hsp_walk,hsp_walk);
//Clac vertical movement
vsp += grv;
//Ground Jump
if (jumpbuffer > 0)
{
jumpbuffer--;
if (key_jump)
{
jumpbuffer = 0;
vsp = vsp_jump;
vsp_frac = 0;
}
}
vsp = clamp(vsp, -vsp_max,vsp_max)
//Dump fractions and get final integer speeds
hsp += hsp_frac;
vsp += vsp_frac;
hsp_frac =frac(hsp);
vsp_frac =frac(vsp);
hsp -= hsp_frac;
vsp -= vsp_frac;
//Horizontal Collision
if (place_meeting(x+hsp,y,Owall))
{
var onepixel = sign(vsp);
while (!place_meeting(x+onepixel,y,Owall)) x += onepixel;
hsp = 0;
hsp_frac = 0;
}
//Horizontal Move
x += hsp;
//Vertical Collision
if(place_meeting(x,y+vsp,Owall))
{
var onepixel = sign(vsp);
while (!place_meeting(x ,y+onepixel,Owall)) y += onepixel;
hsp = 0;
hsp_frac = 0;
}
//Verticale Move
y += vsp;
//Calc current status
onground = place_meeting(x,y+1 ,Owall);
onwall = place_meeting(x+1,y,Owall) - place_meeting(x-1,y,Owall)
if (onground) jumpbuffer = 6;
//Adjust sprite
image_speed = 1;
if (hsp != 0) image_xscale = sign(hsp);
if (!onground)
{
if(onwall !=0)
{
sprite_index = SPlayer_wall;
image_xscale = onwall;
}
else
{
dust = 0;
sprite_index = SPlayer_air;
image_speed = 0;
image_index = (vsp > 0);
}
}
else
{
if (hsp != 0) sprite_index = SPlayer_run; else sprite_index = SPlayer;
}
アルバン.. it may be the scripts line, I’m an experienced coder and I would just double check the script before running your game. I’m also probably late to this comment as it’s later on but I hope this helps.
Cool😍 that's what I want to learn
I imported the sprite code, where you animated the sprite and now I get stuck in the ground
Question: Does Game Maker Studio 2's complete edition support Android Export?
Yeah
"Complete" edition?
can you make a tutorial about how export android devices?
Robiie liao he has made one for 1.x that is still compatible
Game Hub the ultimate edition does
i cant even get on the wall, anyway someone can help me?
Thank you!!!
How much does it cost? And where can I buy it? Talking about Game Maker Studio 2
Yeah I still can't find it in my area :/
Asked my friends and the same result
www.yoyogames.com/
Yeah thanks! Just found out there were some problems with some of my extensions that weren't letting me into the website
Code?
very helpful!
onepixel...is this a local variable it says it needs to be declared and stays blue in my code? and also grv_final
single wall climbing do be mega man x styled.
Splendid! Maybe Wall Slide next?
That's covered in this! Unless I'm not understanding?
Thank u so much for your videos these have helped me sooo much but one question and actually rather a request if possible, how to make enemies follow the player for e.g a zombie game but not top down instead for a platformer (so they know how to go around rooms that havent been "open" if that makes any sense and path finding for platformers please) love ur content fan since ur 4th video 😁
(In other words since i found ur channel😂)
In game maker 1 you can do
Mp_potintal_step()
And it will walk to a given rage to what ever object x and y you put in the () im not sure about gm2 but it might be the same
i can't used "Approach"
I'm trying to complete a Pokemon game but I'm unable to do the ledge jump Shaun can you help with an RPG tutorial.
been waiting for this
Hey Shaun,
Firstly thanks you're doing a great job,
Keep going
I wanna ask what if I type this code in game maker studio 1???
I mean will it run???
Great!
but why the wall shaped like among us
Cos everything is if you look hard enough :p
min 0:46 that is Sussy
Amogus
Hey Shaun... on line 65 where you're doing:
onwall = place_meeting(x+1, y, oWall) - place_meeting(x-1, y, oWall);
Wouldn't it be just as good, or even better, to do :
onwall = place_meeting(x+1, y, oWall || place_meeting(x-1, y, oWall);
?
That way:
- if you're caught perfectly between walls at left and right, you could still wall jump.
- if GML ever decides to implement boolean data type, so that true and false aren't 1 and 0 and can't be subtracted, the code would not break.
Unfortunately no. The subtraction makes a distinction between left and right (-1 and 1) and doing an Or would only return a "true" if one or both walls were touched. You'd have to do something else to calc both sides.
But you are right about the hypothetical data type issue.
Really each should probably be checked separately then combined into a single var.
ok but how to make him claiming like in celeste
The dust particles aren't showing
who can show me here the full code.. thanks
raymundo melecio it’s better to learn yourself
Hey man. Your "Approach" script is wrong. Why don't you check the information in your videos? This isn't the fist time, you know.
Anyway...
For those who have an issuer with the "Approach" script and the "undefined value" error, here is the right script:
if argument0 < argument1
{
argument0 += argument2;
if argument0 > argument1
{
return argument1;
}
}
if argument0 > argument1
{
argument0 -= argument2;
if argument0 < argument1
{
return argument1;
}
}
return argument0;
I can't make it work! How did u do? Everytime i try to run the game the error "undefined value" hits, tryied everything already! Can u help?
@@lucasdestruction Hi. Did you try my script, that I left in this comment?
Basically, you create a script, name it: Approach. Copy my code from this comment and paste it. Everything else from this video have to work.
@@Oliwarder Yeah already copy and pasted. No work for me :(
Here's the code:
function Approach()
/// Approach(a, b, amount)
// Moves "a" towards "b" by "amount" and returns the result
// Nice bcause it will not overshoot "b", and works in both directions
// Examples:
// speed = Approach(speed, max_speed, acceleration);
// hp = Approach(hp, 0, damage_amount);
// hp = Approach(hp, max_hp, heal_amount);
// x = Approach(x, target_x, move_speed);
// y = Approach(y, target_y, move_speed);
{
if argument0 < argument1
{
argument0 += argument2;
if argument0 > argument1
{
return argument1;
}
}
if argument0 > argument1
{
argument0 -= argument2;
if argument0 < argument1
{
return argument1;
}
}
return argument0;
}
@@lucasdestruction Look at the first bracket in your code. I mean this one { Delete it.
Just left only my code in the script.
@@Oliwarder Still not working, here's what its look now:
function Approach ()
{
if argument0 < argument1
{
argument0 += argument2;
if argument0 > argument1
{
return argument1;
}
}
if argument0 > argument1
{
argument0 -= argument2;
if argument0 < argument1
{
return argument1;
}
}
return argument0;
}