Page 1 of 1

Bah, i forgot how to do it again...

PostPosted: Wed Mar 19, 2008 1:13 am
by Kooldudese
Uhh, this is quite an easy question to solve i know, but i forgot :(
Ok, i was wondering how to make it so that when the hp goes down in numbers, how to make sure that the numbers dont go to the negative numbers...

:oops:

Re: Bah, i forgot how to do it again...

PostPosted: Wed Mar 19, 2008 1:38 am
by stevenp
ooh just put


if (healthnumber.textNumber < 0)
{
healthnumber.textNumber=0;
}

Re: Bah, i forgot how to do it again...

PostPosted: Sun Apr 27, 2008 12:08 pm
by Kooldudese
i dont understand why it wont work... but the script wont work, first let me explain how i made the hp bar because it isnt the normal hp bar, what it has is two actors that are relative to each other, one actor is an canvas actor, it is the actor that shows the hp bar visually, and the other actor is the text actor which is relative to the canvas actor, it shows how much hp there really is in text. I have two variables one is health1p the other is health2p, and these two variables helps the canvas actor (the hp bar) figure out how to draw the hp when it lowers (or possibly when it grows) but in anycase, this variable is not directly relative to the text actor, but its relative to the canvas actor(the hp bar), if you can figure out why any of this could interfear with the script:

if (hp1text.textNumber < 0)
{
hp1text.textNumber=0;
}

//the "hp1text" is the text actor, and not the canvas actor.

thx for all the help in advance!

Re: Bah, i forgot how to do it again...

PostPosted: Sun Apr 27, 2008 3:01 pm
by DST
I'm not sure why you're using textNumber as a variable.
You say the actors have health variables already..;
the meters are just reflections of that.
textNumber = actorx.health;
In this case health is an actor variable and so all players can use it, just refer to the actor's name to define which health you are using.
And the actions defining the min/max health would be in p1 and p2's script....
if (health < 0){health=0;}

Referring to the textnumber after that is just adding one more unecessary link in the chain.

Re: Bah, i forgot how to do it again...

PostPosted: Sun Apr 27, 2008 4:42 pm
by Fuzzy
skip that if! its silly to do all that work.

hp = max(0, hp);

Re: Bah, i forgot how to do it again...

PostPosted: Sat May 03, 2008 11:32 am
by Kooldudese
mabye i should post a demo, im confused why i cant get this to work, i think it should work... ill post soon

Re: Bah, i forgot how to do it again...

PostPosted: Sat May 03, 2008 11:51 am
by Kooldudese
... Here it is, help me plz fix the problem, point for person that helps me

Re: Bah, i forgot how to do it again...

PostPosted: Sat May 03, 2008 12:45 pm
by Fuzzy
Also, STOP using textnumber as a math variable. It can display numbers, but its buggy to do math with. It is best used for display only.

Re: Bah, i forgot how to do it again...

PostPosted: Sun May 04, 2008 12:53 am
by Kooldudese
i still need someone to help me fix this... Help?

Re: Bah, i forgot how to do it again...

PostPosted: Tue May 06, 2008 2:03 am
by Kooldudese
Help

Re: Bah, i forgot how to do it again...

PostPosted: Tue May 06, 2008 8:59 am
by Bee-Ant
Here's...
Btw, you shouldnt include the sprites... :roll:

Re: Bah, i forgot how to do it again...

PostPosted: Mon May 12, 2008 2:40 am
by Kooldudese
yeah,oh well, its just the sprites :roll: btw thx, bee-ant

Re: Bah, i forgot how to do it again...

PostPosted: Thu May 15, 2008 3:50 am
by Bee-Ant
Youre welcome... :D
I think your problem is you should put that code in Draw Actor not in Create Actor :roll: