Page 1 of 1

Cloned life bars

PostPosted: Sat Jan 09, 2016 7:06 pm
by DeltaLeeds
Hey everyone, how do you make clones of an actor that creates a life bar that shows the clone's own individual HP / MaxHP? I tried with DarkParadox's HP bar (rpgbar) script...

Code: Select all
if(creator.HP>0)
{
    HPDraw(creator.HP,creator.MAXHP, 'b');
}
else
{
    DestroyActor("Event Actor");
}



Apparently this code does it right, but the "creator" is apparently identified is the most recent clone of the actor made, not individual clones so the bars are all identical... How do we fix this?

Re: Cloned life bars

PostPosted: Sun Jan 10, 2016 8:54 pm
by Zivouhr
Hmm, not sure yet.
I may be way off, but if I had this challenge, I'd test out different types of Variable options first if HP is a variable, if I was sure the code would work.

Variable options in Variable Editor for your variable:

Actor Real (for affecting individuals specifically)
Actor Integer
Global Integer (default variable setting for general actions that affect all)
etc.


Otherwise, instead of creator, I'd insert maybe clone.HP if that's possible. I'll have to think about this one. I avoided having Hit point bars on my zombies and bosses since I wanted less clutter. I know Streets of Rage 2 manages it usually in the top HUD bar, but it's not necessary to defeating the enemy, but a nice indicator of progress, especially against bosses.

Instead of Health Bars, also consider changing the color of the enemy, so when it reaches certain Health points, it changes color, from maybe neutral, to red. And then the final hit it expires. Just ideas, good luck! 8)

Re: Cloned life bars

PostPosted: Sun Jan 10, 2016 9:39 pm
by lcl
You can't clone a canvas actor and draw different things on each clone. When cloning a canvas actor, all clones will share the same drawings.

But why would you need a new canvas for each enemy? Why not just have one canvas that is the size of the screen, and then draw the bars there? With xscreen and yscreen it would be very easy to position the bars according to where the enemies are on screen.

Re: Cloned life bars

PostPosted: Mon Jan 11, 2016 6:19 am
by DeltaLeeds
Zivouhr wrote:I avoided having Hit point bars on my zombies and bosses since I wanted less clutter. I know Streets of Rage 2 manages it usually in the top HUD bar, but it's not necessary to defeating the enemy, but a nice indicator of progress, especially against bosses.

Instead of Health Bars, also consider changing the color of the enemy, so when it reaches certain Health points, it changes color, from maybe neutral, to red. And then the final hit it expires. Just ideas, good luck! 8)


Ah, the lack of health barsin your game is nice, and maybe it's your style, but I like having health bars in my game, thanks for the input, but yeah I prefer having health bar. While some of the enemies already have that color changing thing when their health is low, I'd still like a health bar... xD

lcl wrote:You can't clone a canvas actor and draw different things on each clone. When cloning a canvas actor, all clones will share the same drawings..


Ah, that explains everything! So it's not possible to have different drawings for each canvas, now I know when it's futile to try a lot of health bars as you said lcl and I'll try just 1 canvas that shows the health of the enemy we're attacking.

Thanks for the input and tips both of you, +1 for each of you ;)

Re: Cloned life bars

PostPosted: Mon Jan 11, 2016 2:42 pm
by lcl
jonathang wrote:
lcl wrote:You can't clone a canvas actor and draw different things on each clone. When cloning a canvas actor, all clones will share the same drawings..


Ah, that explains everything! So it's not possible to have different drawings for each canvas, now I know when it's futile to try a lot of health bars as you said lcl and I'll try just 1 canvas that shows the health of the enemy we're attacking.

You still can have an individual healthbar for all of the enemies, you just have to draw all bars on that same canvas.

Re: Cloned life bars

PostPosted: Thu Jan 14, 2016 1:44 am
by Zivouhr
Good tips Lcl. Thanks. 8)
Jonathang, looking forward to seeing more of your game when it's ready. 8)

Re: Cloned life bars

PostPosted: Mon Jan 18, 2016 6:36 am
by DeltaLeeds
SORRY FOR THE LATE REPLY LCL and Ziv!!! I got quite busy these days!!! :oops:

lcl wrote:
jonathang wrote:
lcl wrote:You can't clone a canvas actor and draw different things on each clone. When cloning a canvas actor, all clones will share the same drawings..


Ah, that explains everything! So it's not possible to have different drawings for each canvas, now I know when it's futile to try a lot of health bars as you said lcl and I'll try just 1 canvas that shows the health of the enemy we're attacking.

You still can have an individual healthbar for all of the enemies, you just have to draw all bars on that same canvas.


Thanks lcl, I'll try that. ;)

Zivouhr wrote:Good tips Lcl. Thanks. 8)
Jonathang, looking forward to seeing more of your game when it's ready. 8)


Haha, this is still experimental so far, not a game yet. Maybe it'll be one? Hopefully so. :lol: