+2 votes

I'm trying to draw a health bar over enemies, but it isn't working and the health bar is drawn at the corner (because the health bars are children of a CanvasLayer).

I can't place them as children of the enemies because they have rotation and it won't work. How can I fix that?

in Engine by (661 points)

Are the enemies physics objects that are being automatically rotated, or are you rotating them manually?

Just an idea, how about using a parent node per enemy where child1 is the "actual" enemy (rotated) and child2 is the health bar.

I'm not much into 2d so I don't know if that poses any problems here.

1 Answer

+2 votes
Best answer

Stick a Label/TextureProgress/whatever Control node in a Node2D on your player, and put this script on it:

extends Node2D

func _process(delta):
    global_rotation = 0
by (20,485 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.