How do I create individual objects for individual enemies

Get help using Construct 2

Post » Thu Apr 14, 2016 1:21 am

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
B
7
S
1
Posts: 4
Reputation: 383

Post » Thu Apr 14, 2016 1:33 am

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.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458


Return to How do I....?

Who is online

Users browsing this forum: ultrafop and 7 guests