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
25
S
10
G
1
Posts: 154
Reputation: 2,687

Post » Thu Sep 22, 2016 10:47 am

Image

use Timer behavior

Image
B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

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
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

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
25
S
10
G
1
Posts: 154
Reputation: 2,687

Post » Fri Sep 23, 2016 2:47 pm

our korbaach is very intelligent person
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753


Return to How do I....?

Who is online

Users browsing this forum: Armench and 16 guests