How to count swipes only when at least 1 sprite moves?

1 favourites
  • 5 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • Hi

    I have a global variable "Moves" and add 1 to it every time user swipes.

    Also, I have sprites that appear in random positions after each swipe.

    But I can't figure out how to add 1 to "Moves" only when at least 1 of those sprites changes its position. For example, after swipe 2 of 12 sprites moved so we add 1 to "Moves".

    Required: If after swipe 0 sprites move we don't add 1 to "Moves".

    I don't know how to find out the previous positions of X and Y before swiping to compare them with the current.

    Any ideas?

    Thank you.

    Tagged:

  • Using the logic that moves the sprites then at that point you could set a variable to say it 'hasMoved'. Then when you swipe, you check against a global variable, the GV being number of sprites that have variable 'hasMoved' set - for each sprites.hasMoved=true, set GV to sprites.pickedcount.

  • Using the logic that moves the sprites then at that point you could set a variable to say it 'hasMoved'. Then when you swipe, you check against a global variable, the GV being number of sprites that have variable 'hasMoved' set - for each sprites.hasMoved=true, set GV to sprites.pickedcount.

    I think you misunderstood what I want to receive in "Moves".

    Your logic will give me a number of sprites that have moved.

    I want to show in "Moves" qty of swipes. Currently, I've already received that number but it also adds 1 to "Moves" even if none of the sprites has moved. So I need any condition which will minus 1 (or will add 0) from "Moves" when 0 sprites have moved.

  • My logic will give you a number of sprites that have moved.

    You want a condition that checks if any sprite has moved.

    So the condition is to check if the variable is greater than 0.

    Does that make sense?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My logic will give you a number of sprites that have moved.

    You want a condition that checks if any sprite has moved.

    So the condition is to check if the variable is greater than 0.

    Does that make sense?

    Figured out how to make what I want with 2 global variables and family variable.

    Anyway, thank you.

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