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

Talk about making games.

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

Postby Kooldudese » Wed Mar 19, 2008 1:13 am

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:
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby stevenp » Wed Mar 19, 2008 1:38 am

ooh just put


if (healthnumber.textNumber < 0)
{
healthnumber.textNumber=0;
}
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

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

Postby Kooldudese » Sun Apr 27, 2008 12:08 pm

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!
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby DST » Sun Apr 27, 2008 3:01 pm

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.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

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

Postby Fuzzy » Sun Apr 27, 2008 4:42 pm

skip that if! its silly to do all that work.

hp = max(0, hp);
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

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

Postby Kooldudese » Sat May 03, 2008 11:32 am

mabye i should post a demo, im confused why i cant get this to work, i think it should work... ill post soon
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby Kooldudese » Sat May 03, 2008 11:51 am

... Here it is, help me plz fix the problem, point for person that helps me
Attachments
Demo(Help me fix my problem plz).zip
(i deleted the rest of the game, and left just the hp bar part, that way its simpler to tell whats the problem, and i dont want people to see how my game is built anyway, i worked on it for 2 years already, =P)
(1.48 MiB) Downloaded 118 times
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby Fuzzy » Sat May 03, 2008 12:45 pm

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.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

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

Postby Kooldudese » Sun May 04, 2008 12:53 am

i still need someone to help me fix this... Help?
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby Kooldudese » Tue May 06, 2008 2:03 am

Help
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby Bee-Ant » Tue May 06, 2008 8:59 am

Here's...
Btw, you shouldnt include the sprites... :roll:
Attachments
DemoForKooldudese.zip
(1.47 MiB) Downloaded 114 times
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

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

Postby Kooldudese » Mon May 12, 2008 2:40 am

yeah,oh well, its just the sprites :roll: btw thx, bee-ant
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

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

Postby Bee-Ant » Thu May 15, 2008 3:50 am

Youre welcome... :D
I think your problem is you should put that code in Draw Actor not in Create Actor :roll:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron