How do I repeat for each instance of a certain condition

Get help using Construct 2

Post » Tue Nov 24, 2015 3:04 am

So I have plants and when they're fed upon they lose food value until they disappear, the problem is I can have 5,10,20 a million animals eating them and they still only lose 1 food value per second. What I have looks like this

Every 1 second : Plant subtract 1 from foodvalue
Animal is overlapping plant : Animal add 10 to food
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Tue Nov 24, 2015 12:33 pm

system For each animal?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Nov 24, 2015 8:02 pm

I tried that but then it does it for every animal overlapping a plant even if it's a different one like if there's 3 plants and 5 animals on one, 3 on another and none on the third they all 7 from their food value every second (I'm using families for the animals and a single sprite for the plant if that would affect it at all)
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Tue Nov 24, 2015 8:23 pm

should work if your event is correct..
You should reference both the animal and the plant in your event..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Nov 25, 2015 2:31 am

Ok when I put for each animal before if it's overlapping the plant it worked. Thank you
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Wed Nov 25, 2015 10:30 am

solved.
B
29
S
9
G
3
Posts: 280
Reputation: 4,187

Post » Wed Nov 25, 2015 4:26 pm

Yeah :) although now I'm having a different issue. There are trees and bushes. Only bigger animals should be able to eat the trees so I have
(Every 1 second, for each tree, animal is overlapping tree, animal.height is greater than 50, animal is not full)
[Animal add 25 to food]

This works but if an animal large enough to eat a tree is eating one then if a small animal is overlapping the tree it also starts to eat it. I know sometimes the order of conditions can affect it, do I need to change that? Or am I just missing something
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Wed Nov 25, 2015 5:10 pm

Seems like you would want a for each animal, instead of a for each tree, but I might misunderstand the event..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests