How do I Correctly adjust the destruction of a sprite

0 favourites
  • 3 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I have 1 sprite copied 5 times, i use them as my health HUD, i want that their number are the same as the player health.

    I want them to be destroyed from right to left.

    The problem is that sometimes lets say the 4th leaf is destroyed but the 5th is still there

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know the answer you seek, but I'll also be interested in learning (which is why I'm posting here).

    With my highly limited knowledge, my guess is that your approach is wrong with regard to your one sprite copied five times. I'm thinking you'll need the following:

    a sprite with 5 leaves

    a sprite with 4 leaves

    a sprite with 3 leaves

    a sprite with 2 leaves

    a sprite with 1 leaf

    a variable for the health number

    and when the health number variable is 5 it'll show your 5 leaf sprite,

    then when the health number variable is 4, it'll show your 4 leaf sprite,

    etc...

    Anyway, I want to see the answer too.

  • Is the UID of the last leaf definitely 18? Yes normally this would just be done as animation, but since you are doing it this way you could link an instance variable on the leaf to health in one event, if leaf.num > health then destroy/hide. So your leaves have num 1,2,3,4,5. When health is 5, they all show, when health is 0, they are all hidden etc.

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