How do I Pick one sprite

0 favourites
  • 5 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • so if I have two sprites with a health variable and a healthbar and one of them dies how can I make the healthbar of the one that died disappear without also deleting the healthbar of the sprite that's still alive?

  • You could put the health bar in the container of the sprite - this way it would get destroyed if the object, that's containing it gets destroyed.

    Other than that it can also simply solved by linking the health bar to the sprite by simply using instance variables and simply selecting accordingly.

  • Well I'm using a progress bar for it and I tried

    Sprite.health is less than or equal to 0: Sprite destroy

    : Health bar destroy

    but that destroys all the health bars

    I also tried setting the health of the bar to the health of the sprite and destroy the bar when it's health is zero but that doesn't work either

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • maybe it isn't working if you destroy the sprite before destroying the progressbar(it won't be able to reference the sprite's health thus it won't be set to 0).

    You also have to make sure you are picking the correct instance.

  • Hmmm I'll try rearranging the order that they're destroyed and see if that works

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