Help with jumping

cBrookscBrooks Member, PRO Posts: 40
edited April 2013 in Working with GS (Mac)
Hey guys, I have yet another problem. I know how to make my actor jump but I have encountered a problem. My jump mechanism works like this: I have a boolean attribute called 'OnTheGround' which determines when I am on the ground. (I created a rule that 'when overlaps or collides' with floor actor change OnTheGround to true otherwise set it to false. It works fine and I use it in my jump command (Rule: 'When OnTheGround=true' and 'when space key is pressed' 'accelerate 90 degrees (up) at speed of 5000. For the gravity I have a separate behaviour that constantly accelerates the actor downwards (acts like gravity). For the floor actor I have set bounciness to 0 as well as my main actor and a collide behaviour in my main actor 'bounce when colliding with floor'. It works fine on flat floor but when I try to make stairs out of the floor actor when I try and jump with the floor actor touching my SIDE I jump about 50 times higher and I can hold down the jump button to keep jumping. This doesn't happen normally when the floor actor is touching my BOTTOM. Its all confusing. Any help would be appreciated.

Cheers

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Best way imo is to have an acceleration down on all the time for the hero actor and then use change motion linear Y to 200 (change 200 to suit) to jump.

    You could use code like jump through so the hero will only collide when he's on top of the actor but this requires coding in the platform actors or unlocking the hero...

    Make a game.attribute (real) and call it HeroY then in your hero actor constrain game.HeroY to self.position.Y

    The in your stairs platforms (make sure movable is off) do a rule if Game.HeroY > self.Position.Y + self.Size.Height /2 collide with hero.

    You might need some invisible blockers also depending on how high your stairs are.

    You can find loads of platform elements in our V1, V2 and upcoming V3 platform templates over at DBA.

    Regards,

    Darren.
Sign In or Register to comment.