ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Health bar
person icon
Noobski
Guest
Quote
2024-02-11 18:44:10

I have a cube mesh that I scaled down and made a child node of my player. I added a texture to it and now it’s a transparent health bar over my players head. Problem is I can’t get any script I draw up to work how I want it to or work at all. The player nodes name is “player” so I know his health car should be player.health. Can someone draw up a script or scripted action or behavior, that would attach to the cube mesh acting as my Hpbar to track the players health and to shorten width and inscrease it as the players hp goes up and down? If you could or even give me detailed information on how it would greatly help me.

person icon
okeoke
Registered User
Quote
2024-02-11 21:37:18

You can update scale property on one of the axis to achieve that.
You know max hp value, you can get current value using "player.health". Divide current value by max value and multiply it by the original scale. Apply scale on one of the axis, fx x. Scale on other 2 stay constant.

person icon
Noobski
Guest
Quote
2024-02-11 22:17:11

Thank you very much! You the Goat!


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |