How to make the life bar follow the player?

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I think using "EverTick" is not a good idea. Is there any other way for the health bar to follow the player? I used it this way

  • I'm thinking the pin behavior. On created pin the hp_background to shooter and then pin hp to hp_background.

  • The easiest way is to attach it with hierarchy - either manually in layout editor, or using "Player Add child" action.

  • Performance wise, pinning is more or less the same as moving or updating the position every tick, don't worry about it.

    While it is commendable to try to avoid every tick events whenever possible, it is indeed often necessary and suitable for certain purposes, such as displaying/updating the position of a moving object smoothly.

    If you wanted to waste time optimizing, you could add an additional condition and variables to keep track of past x and y position to compare with to check if the position of the player actually changed before running the action to update the location of the health bar. But that would be silly. (Don't do that.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The easiest way is to attach it with hierarchy - either manually in layout editor, or using "Player Add child" action.

    Even better! One step less and hierarchy allows for more flexibility when working with behaviors.

    +Add action in events > Shooter > Hierarchy > Add child > Choose hp_background

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