Jump/float function

K

KNM

Guest
Hello, I've been using gamemaker for a while now. So far, I've learned several functions and have been able to made the player to jump, but how do I make the function more differently than simply just jumping? I'm thinking more of adding a floatish function that acts like the jump button for the game, something more like Balloon Fight. I want the player's 'jump' not to be limited and to be able to keep tapping the button multiple times until it falls, I'm thinking of the player having a balloon after all, so basically the function is floating overall. I have seen multiple tutorials about the jump function and how you can make the jump height vary, but so far, I have no idea on how to create the exact same coding I'm looking for.

Thanks in advance.
 

pixeltroid

Member
Im no expert but I think you could reduce the player gravity so he falls slowly and then make it so that tapping a button increases his y position by a bit so he rises up again before coming back down.
I once managed to achieve exactly what you are trying to do but it was unintentional....from my perspective, it was an error in my game. So I had to get rid of the code. lol.
 
  • Like
Reactions: KNM

Bentley

Member
Hello, I've been using gamemaker for a while now. So far, I've learned several functions and have been able to made the player to jump, but how do I make the function more differently than simply just jumping? I'm thinking more of adding a floatish function that acts like the jump button for the game, something more like Balloon Fight. I want the player's 'jump' not to be limited and to be able to keep tapping the button multiple times until it falls, I'm thinking of the player having a balloon after all, so basically the function is floating overall. I have seen multiple tutorials about the jump function and how you can make the jump height vary, but so far, I have no idea on how to create the exact same coding I'm looking for.

Thanks in advance.
I would think it'd be something like this:
Code:
// Rise
if (keyboard_check_pressed(vk_up)) // Or w/e key floats
{
    vspd = -float_speed;     
}

// Gravity
vspd = min(vspd + grav, fall_speed);
 
  • Like
Reactions: KNM
K

KNM

Guest
Im no expert but I think you could reduce the player gravity so he falls slowly and then make it so that tapping a button increases his y position by a bit so he rises up again before coming back down.
I once managed to achieve exactly what you are trying to do but it was unintentional....from my perspective, it was an error in my game. So I had to get rid of the code. lol.
I would think it'd be something like this:
Code:
// Rise
if (keyboard_check_pressed(vk_up)) // Or w/e key floats
{
    vspd = -float_speed;    
}

// Gravity
vspd = min(vspd + grav, fall_speed);
I see, thanks a lot for the suggestions, sorry for the late reply.
 
Top