[SOLVED] How do I detect a change in a variable?

Get help using Construct 2

Post » Mon Jul 14, 2014 11:26 am

Question: I was wondering what would be a good and clean way of detecting a change.

Situation:
Game has 5 rounds.
When a certain action is achieved, an action adds 1 to the variable "roundnumber".

Goal:
Start an event when roundnumber changes.

Own thoughts:
The game already has an action where the round number gets a +1-action, so I could use this event.

Or:
every tick: check if roundnumber =/= currentround (= variable as well)
If true: set currentround to roundnumber (start any event, as this is a trigger to a change of rounds)

Question:
But is there another way?
How would real programmers do it? :)
Last edited by mumu64 on Tue Jul 15, 2014 8:34 am, edited 1 time in total.
B
27
S
6
G
7
Posts: 678
Reputation: 5,651

Post » Mon Jul 14, 2014 12:10 pm

Use functions:
And don't use every tick not for something like this.

here is really simple capx. Of course when you add 1 to variable "roundnumber" then you run the function.
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon Jul 14, 2014 11:19 pm

Thanks!
B
27
S
6
G
7
Posts: 678
Reputation: 5,651


Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, Mayfly, tarek2 and 12 guests