Problems with jumping

TwilightHunterTwilightHunter Member Posts: 146
edited November -1 in Working with GS (Mac)
Hey, I have a slight issue with my block's jumping. I'm fooling around with the pre-made side-scroller template in GameSalad and have run into a problem. My jumping is set to if "On The Ground" is True, then you may press space bar to jump, which changes "On The Ground" to false. Problem is, (And as cool as it is for some dude with a jet pack) when you run off a cliff without jumping, you can jump in mid-air because "On The Ground" is still true. Is it possible to put in something like... so long as the Player is not colliding with the Ground Actor, "On The Ground" is false? Any help would be great, thanks in advance ;P

Comments

  • mobileappconceptsmobileappconcepts Member Posts: 11
    When you initiate the jump you change the "On the ground" boolean false. And you setup a rule that states:

    When Actor collides with ground
    change attribute - > On the Ground -> True

    You hit the jump button
    Change the attribute -> On the ground -> false
    <Jump functions go here>

    and the cycle repeats itself as needed.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Or you could do what I do... sit there with your legs crossed awkwardly, hum really loudly with your eyes closed and hope your inner self can make jumping work properly inside GameSalad...
  • TwilightHunterTwilightHunter Member Posts: 146
    @Mobile... appconcepts? That's exactly what I have going on. But I still have the problem that when you run off the cliff instead of jumping, the jump function is never triggered, thus the "On The Ground" is never turned off. So you can perform a midair jump.
    @POLYGAMe
    That's what I've been doing for a while xD
  • grayson007grayson007 Member Posts: 3
    Their platformer example is very lacking and they should update them so they can actually see the limitations of their engine.

    I did come up with a solution to this problem though. Create an actor 1 pixel less than your actor's width and 1 pixel in height. Mine is 24 wide so I create one that is 23x1. Constrain this to the player's x & y position and then subtract half(adjust if needed) the player height for the y position so it is attached to the bottom of the player's collision box. Now you can do collision checks at the players feet. Since it isn't as wide it won't touch walls or platforms.
    So basically now the check would be If the player is Jumping and the Lower collision box is touching the ground then the player is "On The Ground".

    Hope this makes sense.
  • mobileappconceptsmobileappconcepts Member Posts: 11
    In your collide rule are you triggering off of one particular actor or a tag of actor(s) ?

    For instance if you look at the platformer example they tag all the physical objects into a tag, so in your collide rule you should be triggering the on ground against anything the player can land on. Hope this makes sense.
  • TwilightHunterTwilightHunter Member Posts: 146
    @Greyson007, I can sort of see what your talking about. Thanks, I'll give it a try later today ^^
  • TwilightHunterTwilightHunter Member Posts: 146
    Hey, I figured out how to fix it. In the player, I added a rule:
    If Attribute, (Self) Linear Velocity Y is equal to or less than -1, On The Ground is false.
    Now that that's fixed, can anyone tell me which attributes I need to change to make my Player fall faster?
Sign In or Register to comment.