Cloned life bars

Talk about making games.

Cloned life bars

Postby jonathang » Sat Jan 09, 2016 7:06 pm

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?
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
jonathang
 
Posts: 694
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 37 Give a positive score

Re: Cloned life bars

Postby Zivouhr » Sun Jan 10, 2016 8:54 pm

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)
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 545
Joined: Sat May 17, 2014 2:12 pm
Score: 58 Give a positive score

Re: Cloned life bars

Postby lcl » Sun Jan 10, 2016 9:39 pm

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.
SABRE (semi-3D engine) official development topic: viewtopic.php?f=6&t=12644
A game project that utilizes SABRE: viewtopic.php?f=4&t=13297
User avatar
lcl
 
Posts: 2238
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 265 Give a positive score

Re: Cloned life bars

Postby jonathang » Mon Jan 11, 2016 6:19 am

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 ;)
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
jonathang
 
Posts: 694
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 37 Give a positive score

Re: Cloned life bars

Postby lcl » Mon Jan 11, 2016 2:42 pm

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.
SABRE (semi-3D engine) official development topic: viewtopic.php?f=6&t=12644
A game project that utilizes SABRE: viewtopic.php?f=4&t=13297
User avatar
lcl
 
Posts: 2238
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 265 Give a positive score

Re: Cloned life bars

Postby Zivouhr » Thu Jan 14, 2016 1:44 am

Good tips Lcl. Thanks. 8)
Jonathang, looking forward to seeing more of your game when it's ready. 8)
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 545
Joined: Sat May 17, 2014 2:12 pm
Score: 58 Give a positive score

Re: Cloned life bars

Postby jonathang » Mon Jan 18, 2016 6:36 am

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:
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
jonathang
 
Posts: 694
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 37 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest