'State Machine' and Families

0 favourites
  • 4 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • 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:

    This is one of the weapon types:

    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?

  • Seems like you need "for each"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • quick gif to share the state of affairs

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