The Art of Jumping. Please teach me the ways.

LearnTheGameLearnTheGame Member Posts: 7
edited November -1 in Working with GS (Mac)
Hello GameSalad community. First off, I'm new here, but the whole idea behind GS is so exciting. Anyway, I'll cut to the chase.

I have some questions about jumping for a platformer game. I looked through the wiki and some templates and found a few useful instructions, and I applied the demonstrated jumping code and with a few tiny tweaks it worked for my game for a while. Then, sometime later, I opened my project and the actor's jumping behaviors weren't the same. I'll try to describe what I did to make it work the first time, and then after I'll describe what changed. I can't figure out what caused the change.

First I created a game.attribute integer called Jump
I created jumping rule for my actor when receive key space bar, and attribute game.jump <2
change attribute to self.motion.linear.velocityY to 650
change attribute game.jump to game.jump+1 (this was to allow a double jump)

Then I created a rule to stop my actor from jumping when touching the ground if the space bar was held down. (I wanted the actor to only be able to jump again if the space bar was first released)

Rule: When actor overlaps or collides with Solid Platform
Constrain attribute game.jump to -1 (To stop the actor from continuing to jump when space bar was held down)

At first when I previewed this code it worked very well. My actor had a double jump and if the space bar was held down the actor wouldn't automatically jump again when he touched the ground. I saved and re-opened and it still worked. Sometime later I think some days after, without any known changes to the project, the actor would now triple jump and when space bar was held down it would cause unwanted extra ground jumps. I was very disappointed and discouraged. I was so glad that I had a foundation for platformer gameplay and then suddenly my actor doesn't do what I told it to anymore.

Can someone give me some help? Any advice would be appreciated. You think its a glitch/bug, some kind of update thing? Or, with the info I gave you, might it be that the coding is inherently flawed for what I'm trying to achieve? Thanks alot guys, I know this was long. My future jumping questions will be condensed I promise.

Comments

  • osucowboy18osucowboy18 Member Posts: 1,307
    This could just be one of the bugs in 0.9.3. You may just have to wait for the update.

    - Alex
    _________________________________________________________________________________

    PDL Productions

    Vertical/Horizontal Level Select Template
    Mac Mini For SALE!!!
  • dumdumdude42dumdumdude42 Member Posts: 10
    I can't tell you the answer, but I can tell you that I've seen things like this all over the forums, so at least you're not alone. =)
  • mangaroomangaroo Member Posts: 419
    Are you certain there were no changes to the project? Try opening an older version if you have one and seeing if it is also triple jumping while you wait for an update.
  • ClaymotionGamesClaymotionGames Member Posts: 5
    Try debugging the attributes with a display text behaviour, that should help you see whats causing the problem.
  • sdsmith64sdsmith64 Member Posts: 221
    why is jumping so hard to do in Gamesalad? It should be a premade behavior that you just drop on to your actor. I've gone to the wiki and looked at the jump part and it does not work for me. I hope Gamesalad will have a Jump behavior in the coming releases.
  • HachikoHachiko Member Posts: 330
    It depends on how you want to check if jump is possible. If you're ok with just jumping whenever the player touch the ground, no matter if he touch a side of it, or under it, then just have a boolean that says if jump is possible or not. Then, when player touches ground, set that bool to true. In the player, if bool is true and touch is pressed (or a specific button is pressed, that triggers another bool that check if the player wants to jump), change the linear Velocity Y to a value of your choice (that's the strength of the jump), and put the jump is possible bool to false. Gravity or an accellerate down behaviour will slow the player down and get it back to the ground :)
    For double jump applied to what I described above, do not change the jump is possible value to false, instead, change the player touched screen bool to false. Then, you can check if motion linear Y isn't = 0, but a more safe way would be to have yet another bool, which you use to know if the player is jumping.
    So, when player jumps, set motion linear Y to a value of choice, set the bool "jump pressed" to false, and set the new created bool "player is jumping" to true.
    Now, in another rule, if player is jumping true and jump pressed true, than change motion linear Y (again, for the strength of another jump), and change player is jumping to false.
    Hope everything is understandable xD English is not my main language so I end up with walls of text everytime I try to explain something, lol
Sign In or Register to comment.