0 Favourites

Same Sprite Multiple Containers

  • Hey,

    I have a bunch of enemy types that I want to share the same health and shield meter sprites.

    As I can't add the same sprite to each enemy's container I was wondering if there was a way I could achieve something similar without having to have a bunch of different health bar sprites? If I have to have a specific life bar sprite or shield sprite for every enemy my project it going to get a little unmanageable.

    Appreciate any help you guys can give, you already sorted my first problem in record time.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • shewhorn - Not sure if this is the best way to do it, but what I've been doing for something similar is to give my enemies a "Healthbar" instance variable, and giving my Healthbars the pin behaviour. Instead of using containers, I just pin the healthbar to the enemy and assign the UID to enemies "Healthbar" variable. Then it's just a matter of picking your Healthbar object by UID when you need to do anything with it.

    It obviously takes a little more manual work than containers in that you have to create them manually at the same time as your enemy, but it's really only an extra action or two...

  • Awesome, thanks!

    I now have a huge pile of things generic to each enemy that now just handle themselves without having a million different sprites about.

    For anyone else, basically I do:

    On enemyfamily create -> Spawn healthbar

                       Spawn shield

                       Spawn other things

                       Set healthbar ID to enemy.UID

    I then do a for each healthbar with

    enemyfamilypick instance with UID healthbar ID

    Works great and means that my event sheet is a lot smaller as is the list of objects in my project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,317
RetroDaddy's avatar
RetroDaddy
Unread hot topic
86 28,711
St4rDu57's avatar
St4rDu57
Unread hot topic
153 104,445
DravenX's avatar
DravenX