one touch button ??

ron.valron.val Member Posts: 16
edited November -1 in Working with GS (Mac)
hey guys i need help. what i want to do is have my button disabled if its pressed for more than a seconds or so. the only way to use it again is if you take your finger off and then use it again which would make some other action happen such as move. cause right now i have it working to move but i dont want people to hold the button down to make it move. i need them to take their finger off and then press it again???

Comments

  • ron.valron.val Member Posts: 16
    bump any one???
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
  • PhoticsPhotics Member Posts: 4,172
    I don't know.

    If I had this problem, I might try a timer. For .25 seconds... do something.

    ...or, I'd chuck everything in a rule...

    If mouse button is down.
    and self.button-ready is true...
    then run behaviors.
    After .25 seconds, change self.button-ready to false.

    If mouse button is up, change self.button-ready to true.
  • ron.valron.val Member Posts: 16
    hmmmmm ill give that a try. Cause in my head this seem like a basic thing to do. its like when playing a console if you press the jump button and he jumps you can keep pressing the button he wont jump again until you press it again. so same here you touch it once he moves once you touch it again he moves again.

    thanks for the reply ill let you know if it works :)
  • ron.valron.val Member Posts: 16
    hey i tried it and it doesnt work for some reason any other suggestions ??
  • ron.valron.val Member Posts: 16
    the logic makes sense but its not working ??
  • ron.valron.val Member Posts: 16
    anyone??
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    ok so you have your 4 attribute'ss moveLeft moveUp moveRight moveDown

    Ill explain what to do for the move left button then you can do the rest

    In the move left button have a rule when touch is pressed
    -change attribute moveLeft to 1
    then under that behavior in that same rule put a timer after 1 second run to competion checked
    then in that timer put a change attribute behavior changing attribute move left to 0
    then in the otherwise section of the rule have a change attribute behavior changing moveLeft to 0

    then in your player have a rule when attribute moveLeft=1
    -move left

    Then repeat for the rest of the buttons except switching the attribute so it matches the button your doing. Move right button with move right attribute, ect.

    Then do the same in your player when attribute moveRight=1 move right and the same for the rest

    cheers
  • ron.valron.val Member Posts: 16
    THANKS SO MUCH MAN :) your awesome ive been trying to figure this out for the last couple of days
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Anytime, glad i could help
Sign In or Register to comment.