Individual Unit Health Bars

This forum is currently in read-only mode.
From the Asset Store
SCI-FI Units SFX contains 456 sounds With this pack, you can voice almost all the units in your sci-fi strategy game
  • I have been trying to wrap my brain around this one for an RTS style game.

    I have considered some different options and all really not making much sense to me so I figured

    I would throw my ideas at you wrong as they may be.

    Hopefully some better ideas come out and give me a good point to start at.

    Idea #1 (really not what I hope to do) Draw the green health bar above my unit sprite's but

    have 100 frames and then use code to determine what % of 100 of the units total hps are at

    any given time then simply have that display that frame of the animation. The reason this is

    such a terrible idea is because once I go from stationary sprites to sprites with a full movement

    of animation I would need such a huge amount of 100 frames per frame of animation that it makes

    my head hurt.

    Idea #2 Create a healthbar type of sprite and somehow have it follow my individual unit -- use the 100 frame animation for it based off of the percentage of total hps like my previous idea. This might be going about it at an incredibly non optimal way but it *would* work -- but my problem next would be having that sprite work for each individual unit? Or would changing the animation for it change it for all of the copies of the healthbar sprite. I could evolve the idea to create as many health bars as allowable units in the game so that they all have their individual health bar need in accordance to the unit that spawned by maybe using variables.

    I know someone is prob gonna post .. "bro wow, no... just simply do this and BAM done" and if someone does post that, great!

    Any suggestions would be very helpful, thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bro wow, no... just simply use two sprites in a container with the unit, moving them every frame to a position relative to that unit: bar background and bar progress, set the hotspot to the left side and set the width of the bar progress sprite to originalsize*(health/maxhealth)and BAM done

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