Special Jump help

RondoRocketRondoRocket Member Posts: 411
edited November -1 in Working with GS (Mac)
I am having a problem with a special type of jump I'm putting together. When the jump button is pressed I want the actor to jump for either a period of time, like 2 seconds, or until the button is released. This rule works fine, the problem I'm having is that I have to use OnRelease if the player decides to stop jumping before the timer expires. If the button OnRelease is applied to is swiped rather than pressed it executes the jump sequence automatically. It seems like a bug, but I actually think it has to do with being able to cancel out of pressing the button.

Not sure I explained this clearly enough or if anyone has a work around, but suggestions would be appreciated. It's been tormenting me for a while now.

Thanks!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Try this.

    In your button actor create a Boolean attribute called touchpressed

    Then in a rule
    When touch is pressed
    --Change Attribute self.touchpressed to true
    Otherwise
    --Change Attribute self.touchpressed to false

    Then instead of using when touch is pressed in all of your rules base it off of self.touchpressed being true or false.

    Touch releases once triggers seems to constantly run in my experience
  • RondoRocketRondoRocket Member Posts: 411
    Thanks tenrdrmer!

    That's exactly my problem with touch releases, they seem to constantly run. At first I thought it was a bug, but I think it's setup to allow for people to cancel out of their selection by sliding their finger off the button if they are in a menu screen. Adding a timer to a touch release seems to only make matters worse.

    I will try your suggestion when I get home!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    yea, what tenrdrmer said should work. for the jump rule I would put something like this:

    when touchPressed=true
    (timer)
    for 2 seconds
    change acceleration 90 degrees speed 120 (or whatever)

    as long as you leave "run to completion unchecked", this should work, if you hold it down, he will move for two seconds, if you release early, it should exit the function early.

    in theory anyways, i didn't actually test it :)
Sign In or Register to comment.