How do I have multiple of the same object, follow multiple objects around?

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • For my game, I have flashlights following the enemies around. The problem is that every once and a while, one of the flashlights that an enemy has, disappears for a second then reappears.

  • you have more than one instance of enemy, so when you set the flash light to enemy.x there is no guaranty that it will set it to the enemy you want it to. You also have more than one light which further complicates things.

    you need to make sure you are only dealing with the correct instances. One way to do this is to make enemy a container and put the light in there, and then use for each enemy.

  • So there is no better way to make multiple flashlights follow multiple enemies other than creating multiple enemies and multiple flashlights?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, you can have multiple instances of each sprite and assign them to each other, but you'll need to use a "for each" loop so the game can pick the correct instances to assign;

    The container allows to creates the flashlight at the same time the enemy is created, then it is easier to pick the enemy sprite in the event sheet; downside of container is if the flashlight is destroyed, the enemy will be as well, there's ways to do this without container as well, I'll craft an example when I have some time

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