|
-
Mar 18th, 2000, 05:51 AM
#1
Thread Starter
Junior Member
I made a game that has a health thing that if something bad happens then percentage is deducted but when when something good happens then percentage is added. But the problem is that the pecentage is going over 100 and I want it to stay 100 or under how do I do that. The health variable is named inthealth <-- its an Integer
-
Mar 18th, 2000, 06:06 AM
#2
transcendental analytic
You can change the inthealt var to a property get/let var:
Dim inthealthProp ' and let this be the real one
Property get inthealth ()
inthealth=inthealthProp
end property
Property let inhealth(newval)
inthealthProp=newval
if inthealthProp>100 then inthealthProp=100
end property
Hope this helps
-
Mar 18th, 2000, 06:40 AM
#3
Hyperactive Member
Will this work for you?
Hi,
If you're adding points for good_health and bad_health then the formula:
((good_health - bad_health) / good_health) * 100
will never be above 100% unless bad_health goes negative, at which time I would guess you're dead.
Al.
-
Mar 19th, 2000, 10:28 AM
#4
Lively Member
when adding the health earned to the intHealth, just use the
line below or something like this:
intHealth = IIF(intHealth + plusHealth > 100, 100, intHealth + plusHealth)
hope this helps...
-
Mar 19th, 2000, 10:54 AM
#5
Lively Member
if iCurrentHealthPoints > iMaxHealthPoints then
iCurrentHealthPoints = iMaxHealthPoints
End if
iHealth = (iCurrentHealthPoints / iMaxHealthPoints) * 100
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|