How do I make instances in a family act independently?

Just started using Construct 2? Post your questions here

Post » Mon Apr 06, 2015 5:20 am

So I've got a family set up for objects with a certain AI. I only have one object in the family right now. All instances do the same thing at the exact same time, which is incorrect. I thought I could fix it by putting all of the events on the sheet under a "For each" event, but now all of instances only act when the first instance acts. I'm guessing there's a simple solution for this, and I'm just missing it. Can I get some advice?
Image
B
7
Posts: 5
Reputation: 1,567

Post » Mon Apr 06, 2015 6:56 am

Actually it's the last instance in the for loop that sets the actions.
What you need to do is not globally activate the groups (because then it will be the same for every family member in the end, since the last of the loops just decides what's active and what not). Simple advise: use an instance variable for that family, maybe call it "mode" and assign to it "look" "chase" "attack".

Then in your chase events first pick family by comparison family.mode = "look", or whatever action you wanna do. This way only family members will be affected, that are in the correct mode.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
20
S
9
G
1
Posts: 786
Reputation: 3,729


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests