HELP NEEDED: bug or a bad code?

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello!

    I'm trying to create individual health bars for a family of enemies.

    I've got them working all right, besides one occurring problem:

    The black background element of the health bar keeps appearing to the

    top left corner of the game, whenever there's no enemies on screen.

    i think I've tried everything (even covering it up with UI-element

    (witch caused health bars to act very buggy) , and I can't get it fixed.

    Here's a link to my game: http://www.frogonfly.fi/c2/games/100skulls/

    and here's what my code looks like:

    I wonder is this a bug, how can I fix this?

    Thanks in advance, any help is highly appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Usvatron!

    Since I haven't seen your capx, I'm not sure how you create/destroy the bars. Ideally you should destroy them when the Skull is destroyed. If they're in a container this is done automatically, but, if they're not, just add a Destroy action for both bar elements together with the Destroy action for the enemy.

    What is happening now is that the enemy is dead and your line 99 is setting the bar position to (Skull.X - 20, Skull.Y + 45), since both x and y are 0 (there's no skull), the bar is sent to (-20, 45). The front element is probably there too, but since its width is being set to 0, because Skull.health is also 0, you can't see it.

    Hope this helps. Cheers.

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