User Tag List

Results 1 to 5 of 5

Thread: Some problems with matching jumping strength to time jump-button is held

  1. #1
    Clicker Fusion 2.5

    Join Date
    Apr 2012
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Some problems with matching jumping strength to time jump-button is held

    Hello!
    So I have a system of gravity that says
    if Grav of Player is <
    10 add 0.45 to gravity
    If Grav is > 0
    set player y position to player y position + fallspeed
    if Grav is < 0
    set player y to player y position - fallspeed

    When pressing jump, Grav is set to -10 and so the player goes up.
    Now, I want the distance jumped to be determined by how long you hold the jump button.
    The maximum will be -10, after which it will go down by itself

    I tried doing this by saying
    Negate*Repeat while "jump" is being pressed down
    String-Action of player is "Jumping"
    add 0.45 to grav

    This has the effect of stopping the ascent and starting the falling down, but it goes much faster because two forces are pushing it down instead of one.
    I tried disabled the original gravity force by having a flag set on when the player is in jumpmode and not pressing jump, and then being set off when he touches the ground, but the flags werent getting turned off properly.

    I also tried to set gravity to 0 when you stop pushing the jump button while jumping, but this had the effect of a very jerky mid-air motion where it briefly stops before falling down.

    Any ideas on this?

  2. #2
    Clicker Multimedia Fusion 2iOS Export Module

    Join Date
    Apr 2012
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about having a variable, and set the gravity so it is always at this level. Then while jump button is pressed decrease this variable until it hits a certain number... at this point, turn on a flag that steadily increases the variable until it is back to normal, then flip the flag back.

    I'm sure there's a better way, but this might give you an idea. I'll have a think.

  3. #3
    Clicker Fusion 2.5

    Join Date
    Apr 2012
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello AnD4D!
    If I'm getting it right, the system you describe is pretty much what I have now, except it it never decreases in steps. What happens is pretty much that gravity is set to -10, thus creating a force of "anti-gravity" that pulls the object up, while the "down" force becomes active after gravity becomes greater than 0.

    I've tried having an event that does

    Repeat While key "jump" is pressed
    Grav is Greater than -10:
    Subtract 1 from gravity
    Which in theory, should mean that grav will be lowered until it reaches -10, at which point it would no longer be lowered and the counteracting gravity force will start affecting it.
    The problem with this is that if the gravity is set to -10 at once, the counteracting force will set upon it immediately and thus there is a balance.
    If I increase it in steps, the counteracting force will set upon it when it is -10 if i hold it all the way, and then the character will still go up while the counteracting force is trying to bring gravity from -10 to 10.

    Did I make this clear? Sorry if it felt a bit rambling

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure why you have gravity pulling the object up first... Wouldn't you just do a constant downward pull for gravity and then for jumping you'd apply upward force while you're holding down the jump button? The upward force would get weaker the higher the character jumps, which is how you'd set how high the character can go.

  5. #5
    Clicker Fusion 2.5

    Join Date
    Apr 2012
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry if I'm bad at explaining, but that is pretty much how I'm doing it. Gravity is constantly striving to be positive, which will move it down. When it is forcibly set to -10, it will keep going up until it is positive.

    Edit: Sorry about that, I solved it right after I posted.
    Turned out the solution was

    Negated*Repeat While Key "Jump" is being pressed
    Action of player is "Jumping"
    Grav is lower than 0

    add 0.45 to grav

    This meant that once the "falling down" part was activated, the extra pulling force was removed.

Similar Threads

  1. Play event only when mouse button is held down
    By delta9857 in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 30th November 2010, 06:30 AM
  2. Variable "Jump Strength" (Height) for platformer
    By Sebaceous in forum Multimedia Fusion 2 - Technical Support
    Replies: 13
    Last Post: 21st April 2009, 04:57 PM
  3. Setting mmf's basic platform jump strength
    By Oreo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd September 2008, 01:15 AM
  4. Change Jump Strength
    By Mayfly in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 20th August 2008, 01:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •