Problems to create sprites in random position with intervals

Get help using Construct 2

Post » Thu Mar 05, 2015 8:04 pm

I'm trying to create 4 sprites on the screen in random positions, using instances of another sprite as reference. Sometimes it works, but in others appears only 2 or 3 sprites. I have one more problem: I need that those sprites appear one at a time (interval of 0.5 sec) and I don't know how to do this using "for" loop and I don't want to change it. Any help? Thanks.
You do not have the required permissions to view the files attached to this post.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Thu Mar 05, 2015 8:23 pm

So you need 1 sprite to appear every 0.5 seconds and a maximum of 4 at the same time on the screen?
Frosty Elk AB
www.frostyelk.se
Have no fear, We come in peace!
B
13
S
3
G
1
Posts: 106
Reputation: 1,169

Post » Thu Mar 05, 2015 8:33 pm

frostyelk wrote:So you need 1 sprite to appear every 0.5 seconds and a maximum of 4 at the same time on the screen?


Hi @frostyelk

I need to create 4 sprites and one at a time with 0.5 intervals, using the localPoint instances as position reference. I intend to control the quantity through the "for" loop command. I attached a demonstration in the post.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Thu Mar 05, 2015 8:35 pm

Instead of a loop just compare the object count.
Image
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Thu Mar 05, 2015 8:39 pm

R0J0hound wrote:Instead of a loop just compare the object count.
Image


Hi @R0J0hound

Many thanks.

But now I've one new problem: I was using loop to associate the loopindex to IID. How can I do this without the "for" loop command?
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Thu Mar 05, 2015 8:57 pm

Instead of loopindex I used Sprite.Count-1 to set the animation frame. I could just as well have used sprite.iid though. Would that work? I don't see the need for loopindex.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Fri Mar 06, 2015 12:03 am

@R0J0hound

Sorry. I had not seen it. Thank you so much.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, David181, fens and 10 guests