How do I make the Health Bar go right

I’m working on a boss fight with two bosses, one on the left and one on the right, And I wanna make it so the one on the left Health Bar go to the left side of the screen, And the one on the right go to the right side of the screen.

I have the left one working But the right one isn’t, I don’t know how to make it go to the right side.

This is the system I have for moving


Are you talking about scaling the width of the healthbar?

no. I just want it to move the image to the right Instead of the left

Ok then if that’s what you got working for the left one, then try reversing the math for the second one. Just put * where the / is etc.

That seems to be working, But it’s moving further than supposed to. Probably just Need to reduce its movement by a number And hope for the best. Thank you.

edit: i no idea what I’m doing. i Don’t know how to make it not move as far.

Ok maybe on your condition for that action, put if healthbar x is less than 700 x or whatever you want your maximum x to be.

When I want to move an object like that I’ll save the position as an object variable with a at the beginning of the scene. That way if I move it in the editor, I don’t have to change anything.

At beginning of scene | set DefaultX of Newspite5 =Newsprite5.X()

X position of Newsprite5 = Newsprite5.Variable(DefaultX) + 300 * (health/maxHealth)

(replace health and healthMax with your health expressions)

Dividing the health value by the max health will give you a number between 0 and 1. So, the sprite will move between 0 and whatever it’s multipled by. 300 in this example.

Edit: use plus for right and minus for left.

I don’t know what you mean by “health expressions” I’m using the health estension.

I can move it right. The problem is that it’s not moving consistently With each Hit.

I’ve tried moving the origin point, But it didn’t help.

New at this so sorry if The answer is actually something dumb And easy.

No apology needed. I usually test my suggestions but I was on my phone. My logic wasn’t right either.
I’m not sure how you’re doing the other one but here’s how I would do it. Sorry, if it’s not the answer you asked but it is a solution.

Here’s how I would do it using ogre1 and ogre2 (the # 300 represents the maximum width)

Example. Click “ogre” to apply damage.

Project file:
doug13579/Heath-Bar-Example: Heath Bar Example (

I already had a project which I used to test my logic. So, I thought I’d upload it.

Finally had a chance to test this out.

It keeps teleporting to the left side of the screen and I need it to be on the right, It appears to be working fine Other than being on the wrong side, And I don’t know how to get it to be on the collect side

Does the example I shared behave in the same way as you want?

Can you post a screenshot or two of your events?

The top one: Health Bar go to the left (off screen)

And the bottom one: is supposed to make it move To the right (off screen)

The image below shows no damage to boss.

And now after one hit

(I’m only allowed one image per reply)

Are you setting the defaultX value of the sprite variable when the scene starts? In my example, I set it for the left and the right but you only need it for the left.

Edit: by “left” I mean the one with “left” in it’s name. When the game starts now it’s starting in the place that you put it but after the first hit, it moves it and if DefaultX is 0 it will move to the side. If DefaultX is set to it’s start position then it moves from the start position minus the value of the other mathematical expressions.

I tried setting it to beginning of scene And tried right after the Health Bar spawns and Neither one is working

Your method is different than my example. That’s fine. You do you. You don’t seem to be adjusting the width. Are you hiding the bar in another way? In my example, I move and resize the tiled sprite on the left and just resize the one on the right.

I’m having trouble understanding your process. Are your bars being moved and resized or are you doing something differently?

The health bar is a image and I don’t want it to be resized, It moves off Screen And once it Leaves the Gray area The boss is dead. If I resize the image it wouldn’t look good.

This is how they are being spawned in

1 Like

My concept used width not location. So, the math would be different.

The formula I would use to move the object

After adding the object
The start position variable would be it’s current x() minus the maximum distance that you want it to move. Basically, the final destination.

To move the object, I would use
Set x of object = object.Variable(defaultX) + 300 x ( / )

(The syntax and capitalization might not be perfect but hopefully I explained my concept enough.)

The 300 represents the maximum distance that you want to move the object. Replace it wirh whatever value you need The other part is basically returning a value between 0 to 1.

At start 300 x (100/100) equals 300
At end 300 x (0/100) equals 0

If the object’s x() started at 400
Set defaultX of object = 400 - 300 (equals 100)

With full health
Object defaultX + 300 × ( 100/100)
(100 + 300 × ( 100/100) equals 400)

Zero health
Object defaultX + 300 x ( 0/100)
(100 + 300 x ( 0/100) equals 100)

Sorry, I had to edit this and it was so lengthy. I wanted to both explain my logic and work it out so I knew it would work. It originally wasn’t but I accidentally clicked send before then.

It’s moving left <== , I need it to move right ==>.

sorry, I’m small brained ‘^’