GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Jumping help!!

Ok i have on screen controls and I have a button for jumping, my problem is unless that button is held in the jump and animation is cut way short!! I want to work when pressed not held down! Help please?!

Comments

  • tatiangtatiang Posts: 11,417Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 11

    If [button is pressed]
         Timer after 0 seconds [with Run to Completion CHECKED]
              Animate

    To explain, Run to Completion forces behaviors (in this case, Animate) to complete regardless of the status of the rule condition.

    Another way to do this:

    If [button is pressed]
         Change attribute game.animate to true

    If attribute game.animate is true
         Animate
     
    If self.Image = [last frame of animation]
         Change attribute game.animate to false

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • crazymooseappscrazymooseapps Posts: 26Member, PRO

    So would this code go under the button or under the player animation? Im assuming player animation?

  • crazymooseappscrazymooseapps Posts: 26Member, PRO

    But also it appears the height of the jump is tied to length of time button is held in, how to correct that?

  • tatiangtatiang Posts: 11,417Member, Sous Chef, PRO, Senior Sous-Chef

    @crazymooseapps said:
    So would this code go under the button or under the player animation? Im assuming player animation?

    If your button actor and player actor are separate, then make a game attribute of type boolean called game.animate and try this:

    button actor
    If [button is pressed]
    Change attribute game.animate to true

    player actor
    If attribute game.animate is true
    Animate

    If self.Image = [last frame of animation]
    Change attribute game.animate to false

    I'm not sure about the jump height. It depends how you have your rules set up.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • crazymooseappscrazymooseapps Posts: 26Member, PRO

    I appreciate the help! Worked like a charm! I will fogure out the height by messing around lol

Sign In or Register to comment.