hi guys!!! long time i don’t come here! i need help. go look here and download the file. http://mysite.iptic.com/gargola/robotblast.zip ok…look at the health bar there(it’s an overlay scene)…when an enemy bullet collides with the ship,the health bar goes down a bit.i got that part done…now i need that when the ship collects “hearts”(look in the game) the health bar goes back up again.as it’s done with a script,you may need to look at the script and the logic bricks to see how it’s done and to see the health bar limit(i think it is 106).any help appreciated.Thanx in advance
?..no help for the old gargola?LOL please anybody help…since that’s not my script and i’m not good with python,i need someone to help me. thanx.
-In the script there are two props The first one is named length and means how long the health bar must be.The second one is the prop named “add”.It means the value to be added(or subtracted)to the bar.So if in the first case as I see in your game you add a value equal -0.10 in the second one you must add a value equal to 0.10.You manage the health bar by sending a message that activates the script.Write another identical health script with one ecxeption:change the line:
vert[1]=vert[1]+own.add
in:
vert[1]=vert[1]-own.add
-Then attach this script to the messagge you send when collect hearts.Anyway the script misses another thing ,the limit of the health bar(0 for the length in the first script and its length in the second one)It can be managed with the logick bricks too,but python is better.For ex.if immediately after the for… cicle you add this lines:
if own.length <= 0:
own.add =0
-for the first script,and
if own.length <= 106:
own.add =0
you can solve the problem.
Hope it helps.Ben
Thanx man! very very appreciated!
hey guys! i did everything,but i still got problems with the script.the health bar doesn’t goes up again when i collect the “hearts”.??? what’s wrong now? please check it out http://mysite.iptic.com/gargola/robotblast.zip i don’t know what’s wrong now.please help!
uh uh! this is going down…i better push it up! LOL still need the help!
Hehe, I found the problem. On line 13 of “health plus”
you have:
if own.length= <0:
This should be:
if own.length<=0:
It is “less than or equal to” not “equal to or less than”.
Good luck:)
I think it’s time for a better code editor for python scripts…
that little mistake just shows that i don’t know a heck about coding and about python LOL anyway…i agree with you S_W. thanx for your help dude i appreciate it!