Change image of button when finger is pressing down

TJMNUTTJMNUT Member Posts: 236
edited November -1 in Working with GS (Mac)
As the title explains, I want to make a game but I have run into an extremely small problem, but could make all the difference. I want when someones finger presses down on the button, I want it to change the image to a pushed-in button. I had it so in the button behaviors, when touch is pressed change image to the image. But when I added a change scene, as soon as the finger is down, it doesn't change the image, it goes right to the scene. I expected it to change the scene when the finger was up, how can I accomplish this effect I'm going for, please help.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    put the change scene in a timer and check run to completion.

    or you could do a rule when touch is released and self.image = buttondown.png change scene.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    tenrdrmer said:
    put the change scene in a timer and check run to completion.

    or you could do a rule when touch is released and self.image = buttondown.png change scene.

    no self image at the moment remember :(

    use tendrmers first suggestion itll work perfect for u
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    JohnPapiomitis said:
    no self image at the moment remeber :(

    use tendrmers first suggestion itll work perfect for u

    I thought you just couldn't change images using change attribute on self.image
  • TJMNUTTJMNUT Member Posts: 236
    I tried to do touch down/released but my only option with touch is pressed. But thanks!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Or use a Timer

    When touch is released
    change image
    timer: after 1 or 2 secs
    Change scene

    Or what might be nicer maybe:

    When touch is pressed
    Change image

    When touch is released
    Change image --(back to its previous state)
    Timer after 1 or 2 seconds
    Change Scene

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    gyroscope said:
    Or use a Timer

    When touch is released
    change image
    timer: after 1 or 2 secs
    Change scene

    Or what might be nicer maybe:

    When touch is pressed
    Change image

    When touch is released
    Change image --(back to its previous state)
    Timer after 1 or 2 seconds
    Change Scene

    I'm pretty sure that will cause an image change as soon as the scene loads.

    This is the rule you need.

    When touch is pressed
    --Change image to buttondown.png
    --Timer After 0.5 seconds Run to Completion
    ----Change Scene
    Otherwise
    --Change image to buttonup.png
  • TJMNUTTJMNUT Member Posts: 236
    How can I make it so when the finger is off the button it changes back to the original image
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    thats the otherwise in the rule I just posted
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    tenrdrmer said:
    I'm pretty sure that will cause an image change as soon as the scene loads.

    This is the rule you need.

    When touch is pressed
    --Change image to buttondown.png
    --Timer After 0.5 seconds Run to Completion
    ----Change Scene
    Otherwise
    --Change image to buttonup.png

    No, my suggestions works. My second suggestion: change image on touch pressed, then change back on release, then after a decided time go to next scene.

    Your suggestion is change image on touch pressed and if it's held down longer than .5 sec then go to next scene, otherwise change image back + stay where you are, i.e the button not appearing to work.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jadjad Member Posts: 135
    Are you saying you don't have the option for "touch is released", because that works, but you might want to do something with the timer instead, because if you do the "touch is released" and slide your finger off the button, it will stay down.
  • TJMNUTTJMNUT Member Posts: 236
    Alright I figured it out! Add a rule: when touch is pressed, change image to button down. Add a another rule outside of the previous rule: when touch is released change image to button up. Within that rule add a timer: after 0.2 seconds run to completion, change scene to (designated scene). I'm so happy I finally figured it out, hope this helps someone!
Sign In or Register to comment.