a matter of time.

For questions about using Classic.

Post » Tue Jan 20, 2009 5:42 pm

I have a number of instances, each has a variable called timer.

I want this variable to count down every second for each instance, so i tried,

for each object
+timer > 0
+every 1000ms > subtract 1 from timer value

But what this does is goes through the instances one at a time, rather than doing them all together.

If i remove the 'for each' condition, it now works but each instance is synchronized rather than counting down indpendantly of one another.

Is it a bug, or am i doing something wrong?

Thanks.
B
37
S
19
G
18
Posts: 613
Reputation: 10,231

Post » Tue Jan 20, 2009 8:10 pm

[quote="Ethan":2b2u8lw0]But what this does is goes through the instances one at a time, rather than doing them all together.[/quote:2b2u8lw0]
What do you mean? What's wrong with that and what would you rather happen?

You could try always subtracting TimeDelta from the private variable. You can round off the number when displaying it if you don't want the decimal point.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Jan 21, 2009 5:55 pm

[quote="Ashley":1bx2gere][quote="Ethan":1bx2gere]But what this does is goes through the instances one at a time, rather than doing them all together.[/quote:1bx2gere]
What do you mean? What's wrong with that and what would you rather happen?
[/quote:1bx2gere]


They don't count down all at the same time, as i think they should. Instead it's like the instances are in a queue, when one instance reaches 0 another instances starts counting down, i want it to happen at the same time.

Like i said removing the 'for if ' condition solves the problem but creates another, which is time is not independant for each instance. If one instance is counting down and another instance is triggered to start counting down a few moments later, the time is synchronized rather than acting independantly.

Hope you get what i mean.

Thanks.
B
37
S
19
G
18
Posts: 613
Reputation: 10,231

Post » Wed Jan 21, 2009 6:02 pm

Yeah, TimeDelta does this fine.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Jan 21, 2009 6:18 pm

I can't open the file, it gives an error, 'expecting class Canimation but recieved Clayout'.

You're probably using a newer version?

Thanks.
B
37
S
19
G
18
Posts: 613
Reputation: 10,231

Post » Wed Jan 21, 2009 6:44 pm

Bah, I keep forgetting. I made it with 0.98.6 which isn't out yet :P

It should be out tomorrow or the day after though, so you can try again then... besides, it's basically:

+ Always
-> Subtract TimeDelta from variable 'time'

Round it off to display it and you have a uniquely decreasing counter :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Jan 21, 2009 7:10 pm

yes that works perfectly thanks.
B
37
S
19
G
18
Posts: 613
Reputation: 10,231

Post » Thu Jan 22, 2009 2:15 pm

[quote="Ashley":1217ib8i]Bah, I keep forgetting. I made it with 0.98.6 which isn't out yet :P

It should be out tomorrow or the day after though, so you can try again then... besides, it's basically:[/quote:1217ib8i]

WHY??? WHY MUST YOU TORTURE ME WITH UPDATING THE CLASSROOM AGAIN BEFORE THE CLASS HAS EVEN STARTED??? lol j/k cant wait to see the new version :P
B
5
S
2
G
4
Posts: 632
Reputation: 2,829


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest