Event for global variable value change?

Get help using Construct 2

Post » Sat Aug 18, 2012 3:58 pm

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?
B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Sat Aug 18, 2012 4:19 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,508


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests