Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
sm animated healthbar

coa
Registered User
Quote
2022-06-04 11:57:23

Im trying to use sm animated healtbar for clones but it does not work.. can the script be modified to work with clones

thanks in advance

here is the link to the extension
https://neophyte.cf/ccb_behavior...


smnmhmdy
Registered User
Quote
2022-06-04 12:57:08

Its due to coppercube not changing the node name when using the built-in 'Clone a scene node', you can fix it by executing this code on the 'Action to do with clone' field:
ccbSetSceneNodeProperty(ccbGetCurrentNode(), "Name", "enemy_" + Math.round(Math.random() * 1000));



coa
Registered User
Quote
2022-06-04 14:13:26

thanks smnmhmdy for the fix .. i thought it had something to do with the names i tried changing them first with diffrent method but i had a bug in it. your method is much more clean.!


coa
Registered User
Quote
2022-06-04 14:34:54

would be super cool for a feature if it was possible to apply image on both front and back node maybe for future update


hadoken
Guest
Quote
2022-06-04 17:11:41

Since it is not sold but freely available in the forum, I allowed myself to modify smnmhmdy's "Dynamic, Customizable Health bar" behavior a bit, so that now besides simple colors you can use image textures as bars (BarTex) and bar backgrounds (BarBGTex) as well:

https://www.dropbox.com/s/sud27o...


coa
Registered User
Quote
2022-06-04 18:14:00

very useful extension if you want to make nice looking hp bars quick very nice if you want to make diffrent kinds.
and now with image support very nice! great job hadoken!

im using it in my game The Wizard!


coa
Registered User
Quote
2022-06-05 09:16:14




coa
Registered User
Quote
2022-06-18 10:24:26

hello.. i was trying to use the extension with textures for webgl but the textures do not load any idea why?


hadoken
Guest
Quote
2022-06-18 12:38:54

@coa

After examining the issue myself, seems like both ccbDrawTextureRectangle & cbDrawTextureRectangleWithAlpha do not correctly work in webgl target while ccbDrawColoredRectangle does. All I got were black rectangles in Firefox, maybe it's browser dependent.

So I guess our "animated health bar behavior with image textures" may only work for windows targets at the moment, sorry.

There is a workaround if you use 3D meshes like e.g. cubes or planes as health bar objects. These can be equipped with transparent material and textures as well which are displayed correctly in webgl. But you would need another script for that approach (which shouldn't be hard to come up with despite taking some amount of effort and time).


coa
Registered User
Quote
2022-06-18 13:40:22

thanks hadoken for examine the issue and for the information.
I just used the regular sm animated healthbar for the webgl version


dynamogames
Registered User
Quote
2023-10-02 11:11:53

Back to this thread, I'm making an health bar asides the player's health which reduces on player movement but I noticed that when I added an external variable to the "sm animated health bar", the health bar suddenly disappears when I run the game but does not disappear when I remove the external variable. I don't know what can be causing this issue, maybe I'm not getting something right.


just_in_case
Moderator
Quote
2023-10-02 12:24:59

hie @Dynamogames, I recently created a similar bar extension that you require for @Niven, if you want you can try that.

here is the link to the extension:- https://cdn.discordapp.com/attac...

Here is the unlisted usage tutorial video:-
https://youtu.be/_eZkBN97eaY


This is very basic implementation for the healthbars, @hadoken has a great extension for the power and health bar, I highly recommend to use that extension as it allows you to customize the bar heavily with different modes and options.

Edit:- Regarding the original question, for sm_animated bar, It is possible that you are not initiating the external variable. So the variable remains zero or undefined and the bar doesn't shows up. You need to make sure that when the game starts, you have defined the external variable with a value. It is much better to set variables in your before first drawing do something behavior.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internati?nal" (you are not logged in)


Text:

 

  

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


   






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