Help with JUMP!

eliehangeliehang Member, PRO Posts: 105
edited November -1 in Working with GS (Mac)
So I've been testing and researching on how to make a slightly perfect jump. I looked into the basic platform test and also the wiki, but there's some things I don't understand. such as boolean attributes or where self.Inity -- self.position -- self.ZeroTime come from? Has anyone successfully made a good jump yet?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I did something pretty simple.

    I've got gravity set at 300.

    left and rigth movements are normal, but when you hit space, the player accelerates upward at 600 for 1 second. that simulates a jump. after 1 second, the player is dragged back down by gravity.

    there are probably better ways to do it, but it works for me.
  • butterbeanbutterbean Member Posts: 4,315
    Eliehang,

    Looking at the platformer template gives you a great head start to using jump

    If you do have gravity in a scene, then using accelerate to jump is good, that way, as mulcahy said, gravity brings you back down

    I believe the platformer template has some boolean attribute in there too, like selfontheground but double check that
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I had an awful time getting my character to jump consistently. I followed the wiki and sometimes it worked other times it didn't. Apparently GS was not recognizing the collision between my jumper and the invisible floor I had created. Here's what I have come up with and it works every time.

    Create invisible actors to use as a floor.
    Create a boolean actor called jump (or whatever)
    in your jumper create some rules:

    1) When jumper collides with floor change jump attribute to true

    2)When space is down AND jump=true
    jump behaviors - see wiki (basically accelerate 90 with a timer)
    change jump to false (this keeps you from being able to press the jump key over and over again to fly)

    That way when you land jump attribute will change to true and you will be able to jump again.
Sign In or Register to comment.