Instances problem

0 favourites
  • 5 posts
  • I just have a quick question about sprites and instances of them.

    I have an enemy Sprite and it follows a path, every 2 seconds another one spawns. In the container of the sprite I have a red and green bar that will show the health above each of the sprites. Every tick it moves the bar along with the sprite.

    The bar follows each sprite but the problem is when I do the calculation to make the width of the green bar smaller (set the width of the green bar when a bullet collides with the sprite), it makes all of the green bars smaller, not just that instance of it.

    Am I missing something? I thought since it was just that instance of the container it should be only changing the width of the one that was collided with correct?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are making the green bar smaller inside of an event where you picked that sprite instance it applies to just that container. If you are making the green bar smaller in an event that doesn't pick one of those sprite instances (or a particular instance of that green bar) it's going to apply it to all or them (or just the first one it finds, depending on the circumstance).

  • Are you using r118? There was a bug fix related to 'on collision' and container picking.

  • Ah interesting, im on r117, ill try that out!

  • That was it, awesome! Thanks

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