Simple Jump

PsychoticStudiosPsychoticStudios Member Posts: 101
edited November -1 in Working with GS (Mac)
I am making a mario style sidescroller and I have made a button for the player to jump but he just keeps going up until let go of the button. I just want the player to have limited jump time so he goes up for a second and comes down ( smoothly if possible).

Comments

  • jb15jb15 Member Posts: 602
    You want to use the change attribute > self.motion.linear.y to say about 200. Then have an accelerate down (270) behavior for gravity.

    If you have more questions, ask. My templates below might be of help to you.

    ___________________________________________________________________________________
    One Touch Ninja Platformer Template
    Red Bouncing Ball Template
  • PsychoticStudiosPsychoticStudios Member Posts: 101
    If I hold down my finger he still just goes up but slower
  • tomeglenntomeglenn Member Posts: 6
    Checkout the Platformer Template.

    Basically, you need an attribute on your actor, let's call it "Grounded".
    Whenever your actor collides with a ground object and his Self.Motion.Linear.Y = 0, he has landed so set Grounded to true.

    Then when you press your jump key, if Grounded = true, and his Self.Motion.Linear.Y is still 0, you can jump - so set Self.Motion.Linear.Y to something like 200 to 400 and set Grounded to false.

    Then either have a constant downward accelerate as jb15 suggests, or set the Gravity attribute of the Scene.
  • PsychoticStudiosPsychoticStudios Member Posts: 101
    It still isn't working. I used the mario controls video to create the left and right controls if that would effect my failure.
Sign In or Register to comment.