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

#1 2012-03-15 07:07:21

minecraftcrazy1998
Scratcher
Registered: 2012-03-07
Posts: 1

Need help with health

SolidBanana117

This is minecraftcrazy1998 who needs your help.  Could you help me with making health for my zombie game because when i  do it, it glitches.

Offline

 

#2 2012-03-16 20:12:50

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: Need help with health

I think you need to explain a little more of what your game is like. What you can do is when a zombie attacks you, you change te costume of your health bar sprite which would lower it. This script could go in the health bar.

When I receive [i just got hurt]
Next costume
Then make a script like this:
When gf clicked
Wait until <<costume # [1] of [health bar]> = [1]>
Stop all
I'm not sure if this would work. I don't know if you can make it so if costume 1 = 1.

Last edited by turkey3 (2012-03-16 20:15:06)

Offline

 

#3 2012-03-16 20:57:53

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: Need help with health

turkey3 wrote:

I think you need to explain a little more of what your game is like. What you can do is when a zombie attacks you, you change te costume of your health bar sprite which would lower it. This script could go in the health bar.

When I receive [i just got hurt v]
Next costume
Then make a script like this:
When gf clicked
Wait until <<[costume # v] of [health bar v]>=[1]>
Stop all
I'm not sure if this would work. I don't know if you can make it so if costume 1 = 1.

Fixed it a bit


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#4 2012-03-16 21:40:14

TheAmaterasu
New Scratcher
Registered: 2012-03-13
Posts: 42

Re: Need help with health

you could make a variable, sorta like: [health (5)]  then do like: when I receive: Ouchies I got a boo boo!!!!!! (AKA: OMG a zombies biting me!), change [ouchies I got a boo boo!] by (-1).

Offline

 

#5 2012-03-16 23:35:01

AgentRoop
Scratcher
Registered: 2012-02-11
Posts: 1000+

Re: Need help with health

If you want to make health and death happen when health=0, try these following scripts:


when gf clicked
set [health] to (5)
end
That's just to reset the zombie's life every time. then do:

when I receive [zombie hit]
change [health] by (-1)
end
this will make it so that the zombie will lose health whenever it gets hit. then do this:

when gf clicked
forever if <(health) = [0]>
  brodcast [zombie dead]
end
this wiull make the zombie die when it loses all health.

I hope this helps you.  smile


La La
I wrote an album.

Offline

 

Board footer