Sticking Buttons!

harlin36harlin36 Member Posts: 101
edited January 2012 in Working with GS (Mac)
Hi All,

I have left and right buttons in my game and every now and then my actor will move itself to the extreme left or right and stay there until I press the button again which releases it.

Does anyone know what might cause this?

Any help would be appreciated.

Cheers.

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    can you explan more clearly? can't really understand what you say

    Calvin
  • harlin36harlin36 Member Posts: 101
    Hi Calvin,

    If you think of like a space invaders game where you have left and right buttons which control the space ship at the bottom of the screen,well that is kinda like my game.
    The control buttons work perfectly fine making my character go left and right.But every now and then my character will shoot off to the side of the screen and stay there
    until I press the left or right button again which seems to unstick it and then I can control it again.

    Hope this makes sense.
  • calvin9403calvin9403 Member Posts: 3,186
    "But every now and then my character will shoot off to the side of the screen and stay there"

    can you explan this?
  • harlin36harlin36 Member Posts: 101
    I was hoping you could!!
  • RacetotheMoonRacetotheMoon Member Posts: 323
    edited January 2012
    I'm having this problem on Android devices, but not iOS devices.

    As a test, I would set up two objects in your scene. Each of these test objects should Display the Boolean Attribute you're using to send the actor left or right. Make sure they say TRUE and FALSE when they are supposed to. If not, take a look at your rules and make sure there's no overlap.

    What rule are you using, when touch is pressed? released? something else?
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Are you using an "otherwise" statement in your button for the rule that moves the actor?
  • harlin36harlin36 Member Posts: 101
    Hi race to the moon,
    The rules I'm using are when touch is pressed -true and when touch is released -false

    Cheers
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    edited January 2012
    Instead of using the "when touch is released" rule, try using an otherwise statement in the "when touch is pressed" rule.

    I had a similar issue when using a "when touch is released" rule with the rule not firing off all the time, but the "otherwise" statement fixed it…For me at least.
  • harlin36harlin36 Member Posts: 101
    Cheers Slick that appears to have done the trick!
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Cool. Glad you got it working!
  • RacetotheMoonRacetotheMoon Member Posts: 323
    Yay! Good work guys. :)
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    @SlickZero the rule in otherwise doesn't help for android publish does it?
    I have been struggling to release my app on android but the sticky keys is really annoying.

    Have tried so many ways of making the button rules but still the sticky keys will appear sometime in the game.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    I'm not sure how it will behave in an Android environment. I haven't done anything for Android yet, so I would be guessing if I said anything.

    And here's my first guess…It should work, keyword being "should" If it doesn't, maybe have both rules going. Have the "otherwise" statement, and also have the Rule "when touched is released" so that you have it covered from 2 different angles?

    Your best bet is to get it on an Android device, and test it. Or is that what you mean you are having a problem with? Is it not working on Android sometimes, or are you just worried it's going to happen?
  • Chris FitsimonsChris Fitsimons Member, PRO Posts: 147
    i was hoping i would not be the only person with this problem on android.

    rule on button.

    when touch is pressed
    game.left = true
    otherwise
    game.left = false

    play game and at some random point, it seems to be stuck in touch = pressed even if no buttons on the screen are pressed. you have to touch the button again for pressed = false.

    so i thought, ok, add
    when touch is released
    game.left = false

    no change, still same random problem.

    then I added both parts to a timer.... EVERY 0. made no difference.

    i have tested this on kindle fire and galaxy tab 10.1.
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    yes because of this issue i have held back releasing a no. of android versions of my iOS games. It doesn't seem to help at all changing the rules.
Sign In or Register to comment.