self creating healthbar actor variables? (so confusing)

Talk about making games.

self creating healthbar actor variables? (so confusing)

Postby stevenp » Wed Jan 30, 2008 4:19 pm

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
Last edited by stevenp on Tue Feb 05, 2008 9:21 pm, edited 2 times in total.
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

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

Postby DilloDude » Wed Jan 30, 2008 8:41 pm

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'.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

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

Postby stevenp » Thu Jan 31, 2008 2:37 am

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
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron