How do I Apply 'For Each' to all sprites...

Get help using Construct 2

Post » Thu Sep 22, 2016 9:43 am

I'm having a problem and I can't figure it out. I have an event set up so that 'For Each Bunny' - 'every - random(1, 2) seconds' a bunny will jump.

The problem is, only one bunny out of the 4 on screen will jump. They're all the same sprites, all their stats are the same, nothing is different. Yet this event only seems to influence one of them!

Here are the events:

System - For Each Bunny
Every - random(1,2)seconds / Bunny Simulate Platform pressing jump.

That's all there is. Only one bunny will jump and I have no idea why.
If I do;

Every - random(1,2)seconds
System - For Each Bunny / Bunny Simulate Platform pressing jump

It will make all the bunnies jump at the same time and I don't want that. I want them to jump at random intervals, not at the same time.

Thanks in advance, hopefully I made sense.
B
28
S
11
G
1
Posts: 163
Reputation: 2,880

Post » Thu Sep 22, 2016 10:47 am

Image

use Timer behavior

Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu Sep 22, 2016 11:42 am

You're not picking anything. Just using 'Pick random Bunny instance > Bunny jump' will work. 'For each' isn't always needed and it doesn't mean 'Do action to each', you need to pick the instances it applies to with a condition.
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Post » Thu Sep 22, 2016 9:47 pm

korbaach wrote:Image

use Timer behavior

Image


Thank you so much, told me exactly what I needed! Wonderful demonstration too ^-^ Works perfectly.
B
28
S
11
G
1
Posts: 163
Reputation: 2,880

Post » Fri Sep 23, 2016 2:47 pm

our korbaach is very intelligent person
B
257
S
43
G
15
Posts: 1,993
Reputation: 41,537


Return to How do I....?

Who is online

Users browsing this forum: Klarner, Lancifer and 16 guests