How do I create individual objects for individual enemies

0 favourites
  • 2 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hey Folks! Noob question

    So I create an enemy instance , and the player can interact individually for be a instance, but here is the problem, if I create another object, like a rectangle for field of view of this enemy, how can I associate this object as individual for each enemy and individual reaction?

    I already try the for each option (maybe do it wrong) and I dont find a quick solution here (short time mine)

    I wanna associate this rectangle as part of each individual enemy instance on level, and their actions only work with the respective enemy

    Any suggestions are welcome, thx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Two options -

    Use containers if every enemy has a field of view rectangle. If they are in a container, there will always be a pair and they will always be linked in terms of picking and actions.

    https://www.scirra.com/manual/150/containers

    Second is to assign an instance variable with the UID of the object it is associated with. So if EnemyInstance spawns ViewRectangle, in the same event set ViewRectangle.InstanceVariable to EnemyInstance.UID.

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