'State Machine' and Families

Get help using Construct 2

Post » Fri Jan 08, 2016 6:55 pm

Hi,
my enemies consist of a 'base' and a 'turret', each sorted into respective families.
Both go through a set of states to define their behaviours. Base and turret are grouped through containers and pinned together.

My bases work quite well, but ironicly the simpler turrets cause trouble.
They should all be firing individually at their own pace, creating different types of projectiles.
But atm projectiles are spawned either from only a single turret instance or all instances at once.

For state transitions a variable in the enemy types defines which state to go to upon exiting a given state.

This is the main state loop of the turrets:
Image

This is one of the weapon types:
Image

I'm having trouble understanding what referencing functions need, I tried lots of variants but i get either only a single turret instance to shot or all instances firing at once.
Can anyone point me to the glaring mistake(s) I'm making?
B
12
S
4
Posts: 202
Reputation: 1,542

Post » Fri Jan 08, 2016 8:31 pm

Seems like you need "for each"
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 » Fri Jan 08, 2016 9:11 pm

@LittleStain Well, read your comment, thought, "Duh, of course, I tried that. Didn't help." But tried again. Suddenly it works ...
must have had other issues when trying earlier. Thanks

Wondering now:
My Enemy Bases dont use For Each and work fine, detecting the player, approaching, attacking, retreat to cover.
Its probably because to do with that the bases work largely indepedantly and dont need to refrence the other family.
What difference does the for loop make to picking across families?
B
12
S
4
Posts: 202
Reputation: 1,542

Post » Fri Jan 08, 2016 9:58 pm

quick gif to share the state of affairs
Image
B
12
S
4
Posts: 202
Reputation: 1,542


Return to How do I....?

Who is online

Users browsing this forum: Evanetot, tetuan, ultrafop, Yahoo [Bot] and 4 guests