How do I repeat for each instance of a certain condition

0 favourites
  • 8 posts
  • 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

  • system For each animal?

  • 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)

  • should work if your event is correct..

    You should reference both the animal and the plant in your event..

  • Ok when I put for each animal before if it's overlapping the plant it worked. Thank you

  • solved.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Seems like you would want a for each animal, instead of a for each tree, but I might misunderstand the event..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)