Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Losing Lives in my game.
- HarryPotterGeek500
-
Scratcher
100+ posts
Losing Lives in my game.
Hey guys.. i am trying to make a game, and in the game “bombs” drop, and if one drops on you it is supposed to make you lose a life. However, they are not making you lose lives yet. I have my lives as a variable, and the bomb is a sprite. Could you help me? Thanks!! 

- AmazingUsername
-
New Scratcher
3 posts
Losing Lives in my game.
Make a variable called lives, and when the bomb drops on you, you can have a script that senses that when the sprite is touching a bomb, then decrease the lives by -1.
- HarryPotterGeek500
-
Scratcher
100+ posts
Losing Lives in my game.
Make a variable called lives, and when the bomb drops on you, you can have a script that senses that when the sprite is touching a bomb, then decrease the lives by -1.That is what i did!!


- LadybugMCJ
-
Scratcher
26 posts
Losing Lives in my game.
when green flag clicked
set [lives v] to [5 ]wait (0.001) secs
forever/[scratchblocks]
if<touching [bomb v] ?>then
change [lives v] by (-1)
[/scratchblocks]
end
the 0.001 secs makes it so you won't constantly die
Edit: sorry, i'm really bad at making these, I hope you can understand…

Last edited by LadybugMCJ (July 17, 2014 20:17:09)
- gdpr533f604550b2f20900645890
-
Scratcher
1000+ posts
Losing Lives in my game.
You need a forever loop. Also, it would make more sense to wait until the bomb isn't touching you, instead of 0.001 seconds, like this:
when gf clicked
Set [Lives] to (5)
Forever
If (touching [bomb]?) then
Wait until (not (touching [bomb]?)
Change [Lives] by (-1)
Last edited by gdpr533f604550b2f20900645890 (July 19, 2014 08:27:42)
- LittleTrixta2
-
New Scratcher
2 posts
Losing Lives in my game.
help i dont know how to decrease my lives when my sprite touches blue or the ghost. please help this is very urgent 







- deck26
-
Scratcher
1000+ posts
Losing Lives in my game.
help i dont know how to decrease my lives when my sprite touches blue or the ghost. please help this is very urgent
If you want help quickly you'd be much better starting your own topic than adding to someone else's.
Modify the script shown.
when gf clicked
Set [Lives] to (5)
Forever
If <<touching [ghost]?> or <touching color [#000088] ?>> then
Change [Lives] by (-1)
Wait until <<not <touching [ghost]?>> and <not <touching color [#000088] ?>>>
end
- Abbygh
-
Scratcher
2 posts
Losing Lives in my game.
Im having trouble getting my lives variable to decrease too. Ive tried all the previous suggestions. Its a game when bomb are coming at you and on one side of you is your home land which isa sprite. If the bomb touches you, it goes away. If not and it goes to your homeland it is suppost to delete one (out of three) lives. i can't get it to delete thoughh. Can I have some help?
- bjazmoore
-
Scratcher
33 posts
Losing Lives in my game.
Abbygh - what does your code look like and which sprite is it attached to?
- deck26
-
Scratcher
1000+ posts
Losing Lives in my game.
Im having trouble getting my lives variable to decrease too. Ive tried all the previous suggestions. Its a game when bomb are coming at you and on one side of you is your home land which isa sprite. If the bomb touches you, it goes away. If not and it goes to your homeland it is suppost to delete one (out of three) lives. i can't get it to delete thoughh. Can I have some help?
Abbygh - what does your code look like and which sprite is it attached to?You should really start your own topic rather than necroposting on someone else's.
- Amateurscratch
-
Scratcher
1000+ posts
Losing Lives in my game.
If you do a script that says'If touching ‘bomb’ then change ‘lives’ by'-1' then on ‘lives’ it will say'-1'.Maybe try this!
if{touching{bomb}} then
if{lives}={2} then
change lives to 1
Or like that script and so on.
if{touching{bomb}} then
if{lives}={2} then
change lives to 1
Or like that script and so on.
- paigey__
-
Scratcher
1 post
Losing Lives in my game.
I have one where if you click one of the balls and it turns black then you lose a life, I did the broadcast things but they don't go out in order, the project is Water Quest copy. Please help!
- Discussion Forums
- » Help with Scripts
-
» Losing Lives in my game.