0 votes

I'm trying to make a Seiken Densetsu 3 style power bar, which is basically two power bars on both sides of the character's portrait in the ui, but I'm having trouble making one of the power bars fill in (I'm using a texture rect) in the correct direction.

In Seiken Densetsu 3, when the player successfully connects an attack with the enemy, the power bar on the right of the character portrait expands to the right, and simultaneously, the power bar on the left of the character portrait expands to the left (the two power bars are basically mirrors of each other.)

I've tried setting the grow direction of the left power bar both in the inspector and in code, but no matter what I do, the left power bar keeps filling in to the right.

Here's a picture of Seiken Densetsu 3's ui. The power bars are the dark vertical strips next to the character portrait, which is in the middle. This is what I'm trying to make:


This is what's going wrong when I try to execute the same thing:


Any advice on what to do?

Godot version v3.2.2
in Engine by (16 points)

1 Answer

+1 vote

Set scale.x to -1.
Edit: Also, you'll have to change the position of the texturerect too. Or you can use a shader to duplicate the right bar.

Edit edit: I mean, duplicate the right bar and set the duplicate's scale to -1.

by (7,000 points)

I set scale.x to -1 like you said, and changed the position of the texturerect. It worked! Thank you for the help!

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.