[Solved] I've narrowed down my jump problem

ars_moriendiars_moriendi Member Posts: 2
edited January 2015 in Working with GS (Mac)

Hello,

I'm having a weird jumping issue for my 2D platformer game.
I followed the instructions in the sci-fi platformer tutorial.
I think I have narrowed down the problem to somewhere in the section detailed below...

For the jump behavior section, I have:

when all conditions are valid actor receives event key space is down attribute (player) self.jumpCount > 0.0

and then i have self motion line Y velocity, self.jumping to true, and selfjumpCount -1 (to revert back to zero so it's a single jump ability)

Here's the thing. If I remove the 2nd line: the one that says when condition self.jumpCount > 0.0, then the player can jump perfectly, except that he has infinite jumps and can just keep jumping up into the heavens since nothing is reverting his jumpcount to zero.

This attribute is simply supposed to monitor that the player has one jump available because they are not currently jumping.

But if I keep that attribute in, the player does not jump at all

So I could be wrong but I seemed to have narrowed the problem down to this area, but nothing I try is fixing it.

Answers

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2015

    @ars_moriendi said:
    I know this is vague, but any suggestions?

    I'm not quite sure what you are after here, do you want people to make suggestions as to what in your code might be causing the issue ?

  • wcsd9739wcsd9739 Member Posts: 37

    Are you sure the jumpCount attribute is set to 1 at first? That's the only thing I can think of :P

    Unless you forgot to give it some kind of gravity (Accelerate at speed __ in direction 270)?

    Try posting a screenshot of your behaviors.

  • ars_moriendiars_moriendi Member Posts: 2

    YOU GUYS I FIXED IT. Not sure that anybody cares, but I'll explain anyway.

    Instead of the line of code suggested in the tutorial that said that you can only jump when the jumpcount is > 0, I changed it to you can only jump when jumping is false, meaning that you can't jump while in the air!

    It's so simple, I can't believe I didn't think of it sooner.

    Just seems strange that such an obvious solution was not at all what was suggested in the tutorial.

  • xhamad_xhamad_ Member Posts: 5

    can you send me the jumping template ??pls
    at this email : hamad_albani@icloud.com

Sign In or Register to comment.