moving enemies with HP over head

This forum is currently in read-only mode.
From the Asset Store
8 vector illustrations of the classic alien head/ face in green color and its outline version.
  • How do i add text that shows the enemy's remaining hit points over their head while they are moving(left and right).

  • Group them with enemies as containers, then the event:

    For each enemy > place the bar over their heads (X=0, Y=-32 or something).

  • Actually, a better way to do it is to not use containers. Use one text object, and create an instance for each enemy, and give the text object a private variable where you set the UID of the enemy its supposed to hover above. Then for each enemy, check if the text object's variable equals the enemy's UID and place the text object above it.

    This is better than containers because this way you don't have to have a separate text object for each enemy - you only need to have a different instance of one text object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How is that a "better" way than having them all in a nice neat group and avoiding even messing with UID?

  • This way it will do all the work grouping and creating text objects for each enemy automatically, and you don't have to set up containers for each one. Also, this way it reduces the number of text objects you need, and construct has a memory leak involving the number of objects in a layout (basically the more objects you have a layout, the faster it crashes when opening the expression editor - not generally an issue but when you have a lot of objects it becomes a hassle), so keeping the number of objects down will keep construct from crashing for extra time.

  • Thanks.

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