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
30
S
12
G
1
Posts: 167
Reputation: 3,038

Post » Thu Sep 22, 2016 10:47 am

Image

use Timer behavior

Image
B
67
S
24
G
7
Posts: 1,519
Reputation: 11,104

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
52
S
21
G
94
Posts: 2,421
Reputation: 55,530

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
30
S
12
G
1
Posts: 167
Reputation: 3,038

Post » Fri Sep 23, 2016 2:47 pm

our korbaach is very intelligent person
B
267
S
51
G
16
Posts: 2,039
Reputation: 43,944


Return to How do I....?

Who is online

Users browsing this forum: SERGIOManOwaR and 5 guests