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

#1 2010-08-02 18:25:00

brinkbrink
Scratcher
Registered: 2010-07-14
Posts: 1000+

Help with Health Bars

I am having trouble with losing health when touched by my enemy in my project.  Can I please have some help?


New sig coming soon.

Offline

 

#2 2010-08-02 18:50:54

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Help with Health Bars

That's a pretty vague question, as there are a lot of different ways to do that. It'd also be helpful to explain what you've already tried. Can you explain a little more?

Last edited by Harakou (2010-08-02 18:51:07)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2010-08-02 19:54:43

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Help with Health Bars

Please upload your project and come back and post a link to it  smile


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#4 2010-08-02 20:15:32

brinkbrink
Scratcher
Registered: 2010-07-14
Posts: 1000+

Re: Help with Health Bars

Ok, I uploaded the project but am not sure how to create a link to it. Sorry I am new to Scratch.


New sig coming soon.

Offline

 

#5 2010-08-02 20:56:49

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Help with Health Bars

So when Gobo touches the robot, he goes back to his starting position and loses a bar of health? If that's the case, then your problem is that Gobo broadcasts the health change, but the health bar doesn't have a script to change it. Try this in the health bar's scripts:

Code:

When I receive Health
Next Costume
If costume # = 4
   Game over scripts
EndIf

http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#6 2010-08-02 20:58:18

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Help with Health Bars

No problem! You can just copy and paste the link from the top of your browser window or click on the blue BBCode link to do all kinds of cool stuff. I'm not gonna get all into that though someone else probably will.

1. take out both Move 10 steps blocks
2. in the Forever if touching sprite2 add a "set velocity y to 0" block after the Hide block
3. for the health bar's script..
When I receive health
next costume


I would also recommend against using too many When green flag clicked blocks, especially in the same sprite's script.  For example, the "Forever if touching sprite 2" blocks could be included in a regular If loop inside the main script.

Step 2. will eliminate some of the "falling through the floor" To fix the rest, stop Gumbo from going so far off the left and right sides.

Looking cool so far! And I love the smooth movement and jumping action, especially once you remove those unneeded Move 10 steps blocks.

Last edited by Locomule (2010-08-02 21:00:52)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#7 2010-08-02 21:00:32

brinkbrink
Scratcher
Registered: 2010-07-14
Posts: 1000+

Re: Help with Health Bars

Ok  That works I will finish my game and upload it soon    Thanks for all the help!


New sig coming soon.

Offline

 

#8 2010-08-02 21:01:17

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Help with Health Bars

Cool!


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#9 2010-08-02 21:02:46

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Help with Health Bars

brinkbrink wrote:

Ok  That works I will finish my game and upload it soon    Thanks for all the help!

No problem.  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2010-08-02 21:13:22

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Help with Health Bars

Harakou wrote:

So when Gobo touches the robot, he goes back to his starting position and loses a bar of health? If that's the case, then your problem is that Gobo broadcasts the health change, but the health bar doesn't have a script to change it. Try this in the health bar's scripts:

Code:

When I receive Health
Next Costume
If costume # = 4
   Game over scripts
EndIf

Dang, you beat me too it!  tongue


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

Board footer