How do I track a numerical variable changing?

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I am trying to track a global variable being added or subtracted.

    For example: I have a sprite moving "up" or "down" on the Y axis with the Y coordinate of the sprite being assigned as a global variable.

    I want to set an action upon the fact that the Sprite.Y axis is either decreasing or increasing.

    How do I make that a condition?

  • Use your global variable as an indicator of the previous position.

    Before you update the y coordinate of the sprite in the global variable, compare the current y value of the sprite with the value stored in the variable, to see if it is greater or less than the previous value stored in the variable. Then update the global variable with the current value.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use your global variable as an indicator of the previous position.

    Before you update the y coordinate of the sprite in the global variable, compare the current y value of the sprite with the value stored in the variable, to see if it is greater or less than the previous value stored in the variable. Then update the global variable with the current value.

    Thank you this makes sense.

  • or you make the event be every x seconds the variable picks up the sprite value, or when you give the command up or down, it adds the variable or subtracts

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