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

#1 2008-05-15 06:51:13

datsuper7
Scratcher
Registered: 2008-04-15
Posts: 13

Hiding variables

say you were making a game with heaps of different bosses to kill,how do you hide their health. I've tried lots of things but I don't know how.

Please help!

Offline

 

#2 2008-05-15 06:53:19

redsooty9
Scratcher
Registered: 2008-03-06
Posts: 69

Re: Hiding variables

I think I might know how to help you... you dont need to use vairables just make a sprite and then .... oh forget it.... sorry I cant help :S


Redsooty9

Offline

 

#3 2008-05-15 06:57:53

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Hiding variables

datsuper7 wrote:

say you were making a game with heaps of different bosses to kill,how do you hide their health. I've tried lots of things but I don't know how.

Please help!

I would only display one Enemy Health variable and use it over and over for whatever Boss you happen to be fighting at the moment.  This assumes that you are never going to be fighting more than one Boss at a time!

Another approach is not to show a health variable at all.  Instead, have the enemy change costumes to show more damage.  This way you can show health on any number of enemies at once.  The costumes could include a Health Bar floating above the enemy if you wanted to stick with a gauge or meter.

Last edited by Paddle2See (2008-05-15 07:00:14)


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2008-05-15 08:31:34

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Hiding variables

OR: You can click the link in my signature and click Moon Theif to see a custom score display using sprites, OR Paddle2see can show you there project about doing that


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-05-15 09:11:03

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: Hiding variables

Paddle2See wrote:

Another approach is not to show a health variable at all.  Instead, have the enemy change costumes to show more damage.

Example: http://scratch.mit.edu/projects/twist/2005


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#6 2008-05-20 10:09:04

fergi2610
Scratcher
Registered: 2008-05-10
Posts: 1

Re: Hiding variables

go to variables and one of you variable bricks shoud hav a check box. uncheck and.... tada!!! ther is no variable on the screen

Offline

 

#7 2008-05-20 17:20:21

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Hiding variables

fergi2610 wrote:

go to variables and one of you variable bricks shoud hav a check box. uncheck and.... tada!!! ther is no variable on the screen

I think he wants to hide/show them while playing the game. This would be very convenient if they had these hide/show blocks for variables, but alas, they don't exist.  You must cover them up with another sprite.

Offline

 

#8 2008-05-20 19:40:24

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Hiding variables

Yeah, I try to use anything but the generic red readout wherever I can. The_Guardian has implemented a variable stamper [url=http://scratch.mit.edu/projects/the_guardian/161167[here[/url]that looks pretty useful. Alternately, you could have a health bar that hovers above the enemy you are
engaged with. (That sounded weird). This would involve a script that would either involve a target that "jumps" from enemy to enemy or something like this:

For the stage:

When flag clicked:
Set enemyCount to 0
broadcast countEnemies and wait
broadcast startGame

----End of Stage Scripts----

For each enemy:

When I receive countEnemies:
Change enemyCount by 1
set myIndex# to enemyCount

When I receive startGame:
Forever:
Wait until <touching goodGuy?> and <inCombat=1>
set combatEnemy to myIndex#
set healthBarX to (x position)
set healthBarY to (y position+40)
set healthBarHealth to myHealth
broadcast changeHealthBar
wait until not touching goodGuy?

This is just code for the health bar sensing. It won't do anything else.
----End of enemy code----

For the main character (referred to as goodGuy):

When I receive changeHealthBar:
go to x: (healthBarX) y: (healthBarY)
switch to costume healthBar  (Here you would have to have a costume for each amount of health an enemy can have)

----End of health bar scripts----

Finally, be sure to set inCombat to 1 whenever you want the health bar to show. Hope this helps (It probably won't , maybe I'll make an example project.)

Last edited by fullmoon (2008-05-20 19:41:38)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer