Wait bug or not ?

Discussion and feedback on Construct 2

Post » Thu Apr 04, 2013 8:17 pm

You will have to use a variable to do what you want, you just can't use loopindex with a wait.

the Wait will not "pause" the loop. The loop will continue to run normaly at max CPU speed and finish instantly.
2 seconds after, when your first "wait" countdown is finished, the loop already finished 2 seconds ago (instantly) and the loopindex will be null so you can't use it
Here is a screenshot of what i understood you wanted, i'm using a variable instead of the loopindex



the green sprite have 3 image point at different positionsMimiste2013-04-04 20:20:46
B
12
S
3
G
4
Posts: 63
Reputation: 3,410

Post » Fri Apr 05, 2013 1:02 pm

@Mimiste, BIG thanks to you. Im lucky that some one understood what I wanted. Im still not sure why it doesnt works with loopindex. Cause I tought it is the same like a local variable.
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Fri Apr 05, 2013 2:05 pm

I understood what you wanted. I was just putting forth the case for a better method... well better from a oop perspective at least. heh
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Apr 08, 2013 12:29 pm

Now I found there 1 real Bug.

If you spawn something in this loop and make directly after it something with it like "set angle". It does not change the created one, it change all instance.

-> Spawn Sprite2 on sprite (image point sprite.WaitVar)
-> Sprite2 set angle toward sprite.ImagePointX(sprite.WaitVar + 1)

does change all instances

-> Spawn Sprite2 (image point sprite.WaitVar
+ pick nearest Sprite 2 to sprite.ImagePointX(sprite.WaitVar)
-> Sprite2 set angle toward sprite.ImagePointX(sprite.WaitVar + 1)

does change only the right instanceDarklinki2013-04-08 12:35:24
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Mon Apr 08, 2013 12:40 pm

@newt

You're still having to wait for the Timer bahavior?

I'm doing my own Timer behavior with a simple code:
Global or local variable: TIMER (Number);
Every 1 sec add 1 to TIMER;

For looping, it work like a charm.
If you use it as a local variable:
While TIMER < 4;
Every 1 sec;
DO
Actions;

and when you're using it as global variable (the case of a space shooting game, for example)

Compare variable 10 < TIMER < 20;
Every 1 sec;
DO
Actions;
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,206
Reputation: 18,331

Post » Mon Apr 08, 2013 2:36 pm

For simplicities sake I would use the ease tween behavior.
Then if you don't think its that simple, its at least reusable.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: humanescape and 12 guests