Event for global variable value change?

0 favourites
  • 2 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Im used to event driven frameworks like Actionscript and Flash.

    I am trying to figure out how to raise/handle a value change event.

    E.g.

    You have a global variable called chipBalance.

    The balance is updated in several places (e.g. start game deducts from it, winning adds to it).

    You only want to update the balance on the screen when the value changes. You certainly dont want to poll the value every tick (for lots of events, this will kill performance, and is poor solution). You also dont want to duplicate the code to update the balnace on the screen in every place where the blance can change - you need an event!

    I cant find it though. Anyone know how to do this without polling very tick?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What's so bad about updating every tick? It will use a negligable amount of CPU, and Construct 2's engine does not redraw the screen if nothing has changed (e.g. if you 'set text' and set the same text it already has). It certainly won't kill the performance.

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