How can I fix this?
It's a game a lot like storm the house, but I can't get the guy to die on click using health variables. What's wrong?
Here's the script (I tried to do the whole scratchblocks things but me and it doesn't get along):
when gf clicked
switch to costume <costume1>
hide variable <health>
set <health> to <10>
when sprite1 clicked
change health by <pick random <-5> to <-10>
when gf clicked
if <<health>=<0>>
switch to costume<costume3>
wait <0.5> secs
switch to costume<costume4>
wait <0.5> secs
switch to costume<costume5>
wait <0.5> secs
switch to costume<costume6>
thanks!
Offline
when gf clicked switch to costume <costume1> hide variable <health> set <health> to <10> when sprite1 clicked change health by <pick random <-5> to <-10> when gf clicked if <<health>=<0>> switch to costume<costume3> wait <0.5> secs switch to costume<costume4> wait <0.5> secs switch to costume<costume5> wait <0.5> secs switch to costume<costume6>(Just doing this so I can see it a little better.)
Offline
it should be forever if health = 0 not just if health =0
Offline
What you need is a "forever if"... And I would recommend that you put a "stop script" at the bottom of the forever if, if you aren't going to use the script anymore. But if you are using it again, don't.
when gf clicked forever if <(health)=[0]> switch to costume[costume3] wait [0.5] secs switch to costume[costume4] wait [0.5] secs switch to costume[costume5] wait [0.5] secs switch to costume[costume6] stop script
Last edited by CheeseMunchy (2012-12-18 13:36:02)
Offline
actually I've fixed it now thanks! But I'll get back to you if I encounter any more problems...
Offline
Laugh if you want, I have a new problem.
How would I make it so that if a character was moving, then got killed, it wouldn't keep moving to the house?
Offline
Also, I need this for pause and day complete features, so please respond!
Offline