Instances of enemies act all at once as if not instances

0 favourites
  • 3 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hi,

    getting bit crazy here- I´ve created FSM for this instanced enemy (shrimp). The principle is that there is one instanced string variable that stores the information of which state the shrimp is. This state is called as a function (using mapping of fuctions) every tick.

    It works rather well for one enemy but the moment I add more of them, they all act as once- if one goes to idle, every other goes to idle. If one decides to walk, everyone decide to walk.

    If anyone can please look at the file (the event sheet is Shrimp2) and point me out what I am missing, i would very much appreciate it.

    Thank you!

  • The problem is that you are not picking shrimp instances inside the functions. For example, in "state_walking" function you need to pick shrimps with currentState="state_walking".

    Also, in event #2 you need to add For each Shrimp. Otherwise this event will trigger only one function - mapped to Shrimp.shrimp_CurrentState of the first shrimp instance.


    I am not sure why you need to use mapped functions here. I think you misunderstood what function mapping is, it doesn't map functions to instances with specific values in instance variables. It merely allows to call functions by their string names.

    So you can do the same by simply picking shrimps with each state on every tick:

    On Every tick
     Shrimp state = idle -> ....
     Shrimp state = walking -> ....
     Shrimp state = dead -> ....
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop2000, I will try it out :-)

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