Page 1 of 1

self creating healthbar actor variables? (so confusing)

PostPosted: Wed Jan 30, 2008 4:19 pm
by stevenp
i know how to make a health bar, and give it to an enemy, but how would i use this if i were to clone, or multiply the enemy?

the problem is, every so often in my game eternal legacy, lich summons eye balls, and i want to give them health bars, but theres more then 1, so thats where im confused,

and they need to have it INDEPENDANT from eachother, what i mean is

if i have 1 variable, eye_var

eye_var=16;
{
// if collision with fireball do damage
}

ok... so now what if there are 10 eyeballs on the screen, shooting it would decrease ALL of their health by the amount i set...
thats not good

Re: cloning healthbars? or variables? (so confused)

PostPosted: Wed Jan 30, 2008 8:41 pm
by DilloDude
This is where you need to make an 'actor variable'. On the create variables panel, change the box from 'global' to 'actor'. An actor variable is a variable in the Actor struct - each actor has an individual one - just like x, y and all the other things that you use. They are accessed in the same way: on the event actor, just use 'variable', for another actor, use 'actor.variable'.

Re: cloning healthbars? or variables? (so confused)

PostPosted: Thu Jan 31, 2008 2:37 am
by stevenp
i tried that already, but i didnt know about this perticualr addition

collide.eye_var-=2;

i have been using the code WITHOUT collide.

so its been var-=2; instead of collide.var-=2;

so now it workes :D ty