How do I get instances to act independently? (and a brief struggle with line of sight)

0 favourites
  • 3 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I'm making a game at the moment, and I have multiple instances of the same object. I'm trying to utilize a State machine for an enemy, but at the moment, every instance of the object goes into the same state as every single other instance. any advice on how to get this working?

    I've tried stuff with Comparing X for each instance to determine whether it should be applicable to perform actions, as well as line of sight- but line of sight doesn't work per instance? as in, when I have more than one instance of the object, it will sometimes completely ignore any other lines of sight i should be intersecting from the duplicates.

    Any help would be appreciated.

  • NOTE: I've tried a variety of different ways to get this to work, i'm aware that this current code doesn't quite work and its just for an example of what i've tried thus far.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assuming you are talking about the Mask object, and that the Mask is not in a container already with Collision object, the Mask doesn't relate to the Collision object. In your mind it does because you pinned it but for Construct logic you are not picking a Mask.

    You can put them in a 'Container', Mask and Collision, which means when you create Collision a Mask will be automatically created and also then that Mask relates to that Collision in events, which I think is what you want here.

    Once in a container you can remove all the sub event logic which isn't necessary such as the for each and the pick nearest instance to self. For example, collision var=null : set Mask animation to idle is all you would need.

    Also careful responding to your own post as it removes it from 'Unanswered Topics' and people sometimes miss it thinking someone responded.

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