I think this belongs in Help With Scripts- I'll request it to be moved for you!
Offline
Make a variable called "health" for each player.
(health)The simplest way to make a health bar is to use many costumes.
switch to costume (health)Hope it helped!
Last edited by thebriculator (2012-11-02 17:22:28)
Offline
maurootjr wrote:
I dont or its possible in scratch
Of course its possible in scratch!
Also you could make the enemies one colour that nothing else is then when it is touched it will switch to a costume of your character getting hit or somthing and then health will go down like this :
forever if touching colour <#000000> switch to costume [knocked out] think [ahhhhhh] change variable [health] (-1) end(where the the #000000 is you will actually put the small square of what pen color the enemy is)
show timer forever if timer = (500) change variable [health] (+10) reset timer end
Offline
Blazingwave wrote:
maurootjr wrote:
I dont or its possible in scratch
Of course its possible in scratch!
Also you could make the enemies one colour that nothing else is then when it is touched it will switch to a costume of your character getting hit or somthing and then health will go down like this :forever if touching colour <#000000> switch to costume [knocked out] think [ahhhhhh] change variable [health] (-1) end(where the the #000000 is you will actually put the small square of what pen color the enemy is)
(do several of the with different pen colours for different enemies and you can make the health points go further down (e.g -2) if its a stronger enemy)
You can also use the same script for going on something that will boost your points except dont put the - in the health point change. or If you want your health to go up over time :show timer forever if timer = (500) change variable [health] (+10) reset timer end
Lots of this is in red meaning its not a real script but im not so good with scratch blocks so this is not the exact script. The red bits you will have to swap for the bits you know it accually is but that will be easy
Offline
Blazingwave wrote:
Blazingwave wrote:
maurootjr wrote:
I dont or its possible in scratch
Of course its possible in scratch!
Also you could make the enemies one colour that nothing else is then when it is touched it will switch to a costume of your character getting hit or somthing and then health will go down like this :forever if touching colour <#000000> switch to costume [knocked out] think [ahhhhhh] change variable [health] (-1) end(where the the #000000 is you will actually put the small square of what pen color the enemy is)
(do several of the with different pen colours for different enemies and you can make the health points go further down (e.g -2) if its a stronger enemy)
You can also use the same script for going on something that will boost your points except dont put the - in the health point change. or If you want your health to go up over time :show timer forever if timer = (500) change variable [health] (+10) reset timer endLots of this is in red meaning its not a real script but im not so good with scratch blocks so this is not the exact script. The red bits you will have to swap for the bits you know it accually is but that will be easy
Thanks but the answer is not there yet I'll like to know how to make your opponent lose health when I hit them e.g. say Link is vs Yoshi and Link hit Yoshi Yoshi will lose some health how to do it like that
Offline
Blazingwave wrote:
Blazingwave wrote:
maurootjr wrote:
I dont or its possible in scratch
Of course its possible in scratch!
Also you could make the enemies one colour that nothing else is then when it is touched it will switch to a costume of your character getting hit or somthing and then health will go down like this :forever if (touching color [#000000]?) switch to costume [knocked out v] think [ahhhhhh] change [health v] by (-1) end(where the the #000000 is you will actually put the small square of what pen color the enemy is)
(do several of the with different pen colours for different enemies and you can make the health points go further down (e.g -2) if its a stronger enemy)
You can also use the same script for going on something that will boost your points except dont put the - in the health point change. or If you want your health to go up over time :show timer forever if <(timer) = (500)> change [health v] by (10) reset timer endLots of this is in red meaning its not a real script but im not so good with scratch blocks so this is not the exact script. The red bits you will have to swap for the bits you know it accually is but that will be easy
Fixed.
Last edited by ErnieParke (2012-11-03 18:04:26)
Offline
If you want to do what I did simply use the same script but broadcast a message which the enemy will recieve telling it to go down HP
Offline
Blazingwave wrote:
maurootjr wrote:
I dont or its possible in scratch
Of course its possible in scratch!
Also you could make the enemies one colour that nothing else is then when it is touched it will switch to a costume of your character getting hit or somthing and then health will go down like this :forever if <touching color [#000000]?> switch to costume [knocked out v] think [ahhhhhh] change [health v] by (-1) end(where the the #000000 is you will actually put the small square of what pen color the enemy is)
(do several of the with different pen colours for different enemies and you can make the health points go further down (e.g -2) if its a stronger enemy)
You can also use the same script for going on something that will boost your points except dont put the - in the health point change. or If you want your health to go up over time :show timer//this doesn't exist.... forever if <(timer) = (500)> change [health v] by (10) reset timer end
Fixed.
Offline
This is not exactly a health bar, but it still does work.
1st, Make a variable called "Health"
2nd, Make it so that touching the other player lowers it.
when gf clicked Forever if <Touching Player2> Change Health by [-5] end(Please note that this is not how the blocks actually look like when you are programming.)
when gf clicked Forever if <(Health) < [0]> Stop all end
Offline
Link904 wrote:
Ok how do I do that?
This is what your character will add to the script I wrote already for you
Forever if <touching [enemy1]?> broadcast [GO DOWN HP] change [health] by (-1) switch to costume [dieing] endThis is the script for the enemy
when I receive [GO DOWN HP] switch to costume [kick/punch]This is the script for the stage
When i receive [end of game] switch to costume [you died] wait (6) secs switch to costume [homepage]
Offline