This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-11 23:39:41

hyde30997
New Scratcher
Registered: 2012-04-11
Posts: 2

Overheal

Hello there!

Sorry if this is kinda of a noobish question, but in my game, it's possible to go above the max health. What I want is that the health will slowly lower (~1 HP per half-second) back to the default max. Think of Overheal in TF2. I've tried several times, but each time, my character just stops until it reached the default max health. Help?

Offline

 

#2 2012-04-11 23:42:03

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Overheal

It sounds like you have

repeat until <(HP) = [max hp]>
change [HP v] by (-1)
wait (0.5) secs
in your moving script.
Try moving it to its own script.  smile

Last edited by scimonster (2012-04-11 23:42:28)

Offline

 

#3 2012-04-11 23:46:26

hyde30997
New Scratcher
Registered: 2012-04-11
Posts: 2

Re: Overheal

Yup, that's what the problem was. Derp. Anyway, thanks!

Offline

 

#4 2012-04-11 23:49:13

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Offline

 

#5 2012-04-12 00:11:13

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: Overheal

Add this script:

when gf clicked
forever
wait until < (hp) > (max hp) >
set [hp v] to (max hp) 

Last edited by LiquidMetal (2012-04-12 00:12:15)

Offline

 

#6 2012-04-12 09:16:15

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Overheal

scimonster wrote:

It sounds like you have

repeat until <(HP) = [max hp]>
change [HP v] by (-1)
wait (0.5) secs
in your moving script.
Try moving it to its own script.  smile

repeat until <not<(health) > [max hp]>>
change [HP v] by (-1)
wait (0.5) secs
end
Is a little better, as you can't skip over the max health and continue to lose health.  Of course, both require you to call upon them whenever health goes above the maximum.  An alternative could be this:

forever if <(health) > [max health]>
change [health v] by (-1)
wait (0.5) secs


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer