Prevent any other activity while variable is set

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • In my event sheet I have 2 clickable objects. Sprite A and Sprite B

    When you click on one of them spriteC starts moving up the screen an ajax call is triggered and a global variable called isMoving gets set to 1.

    When the ajax call is completed the sprite changes direction until it gets back to its start position. At this point isMoving gets set back to 0.

    The movement action is the same when both spriteA or spriteB are clicked but the ajax call is different.

    My problem is that when I click sprite A and trigger spriteC's movement and ajax callA I can still click on spriteB which triggers spriteC's movement and ajax callB.

    I would like to make sure that:

    While isMoving == 1

    SpriteA and SpriteB are not Clickable

    Any pointers would be appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • + System: isMoving = 0
      + Mouse: on Left Click on SpriteA
        -> System: set isMoving to 1
        -> Ajax: request [spritA call] tag:"myCall"
      + Mouse: on Left Click on SpriteB
        -> System set isMoving to 1
        -> Ajax: request [spritB call] tag:"myCall"
    + System: isMoving = 1
      -> SpriteC: move
    + Ajax: on completed "myCall"
      -> System: set isMoving to 0
    // And to not get stuck
    + Ajax: on error "myCall"
      -> System: set isMoving to 0
  • Yann to the rescue. Thanks man, will try this as soon as I wake up tomorrow.

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