Reset state of button after 2th click

  • I got big problem when I want to reset value of Global variable and Button text.

    My purpose:

    1. In initial time, my Button have text = "Start" and Global variable isMoving == 1.

    2. After first click my Button must have text = "Stop" and Global variable isMoving is reset to isMoving == 0.

    3. After second click my Button must have text = "Start" again and Global variable isMoving must be equal 1.

    But actually, when program is launched, my Button text == "Start" after few clicks..?? and I guess my Global variable isMoving == 0.... <img src="smileys/smiley3.gif" border="0" align="middle" />

    Could some one help me pls. Because very specific purpose I could use only one button.

    My program like below

    Global number isMoving =1

    Button     |     On clicked

              (if)     System|isMoving = 0 -->Button|Set text to "Stop"

                        -     -->System|Set isMoving to 1

              (else)     System|isMoving = 1 --> Button|Set text to "Start"

                             -->System|Set isMoving to 0

  • Ive had this happen to me. I usually put a 0.1 or 0.5 second delay after the click is executed. Whats happening is if you click its checking to see if the variable is 1. Once you click it changes into 1 instantly and doesn't know you want it to toggle. Its instant. Try putting in a delay in there.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Dear AarongamerX

    Thank so much for your quick reply

    I change my program like that, but same result..??

    Where I must put System.DelayTime ???

    Global number isMoving =1

    Button|On clicked -->System|wait 0.5 seconds

              [SubEvent](if)     System|isMoving = 0 -->Button|Set text to "Stop"

                        -     -->System|Set isMoving to 1

              [SubEvent](else)     System|isMoving = 1 --> Button|Set text to "Start"

                             -->System|Set isMoving to 0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)