Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to add lives?
- Capan
-
Scratcher
23 posts
How to add lives?
Hello everybody, I want to know how to add lives in my game.
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
- Capan
-
Scratcher
23 posts
How to add lives?
Hello everybody, I want to know how to add lives in my game.
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
- Laddie12
-
Scratcher
100+ posts
How to add lives?
when green flag clickedstartx and starty being the starting coordinates of the player
set [life v] to [3]
forever
if <touching color [#ff0088] ?> then
change [life v] by (-1)
go to x: (startx) y: (starty)
end
end
Last edited by Laddie12 (May 3, 2016 17:28:54)
- BKFighter
-
Scratcher
1000+ posts
How to add lives?
Hello everybody, I want to know how to add lives in my game.1) Create a variable named Lives
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
2) Create a new sprite that has three costumes. One with three hearts (or whatever), one with two, and one with only one.
3) For deducting the life:
when green flag clicked4) For the sprite with the three lives costume:
set [lives v] to [3]
forever
if <touching color [whatever color] ?> then
change [lives v] by (-1)
wait until <not <touching color [the same color as above] ?>>
end
end
when green flag clicked
forever
if <(lives) > [0]> then
show
if <(lives) = [1]> then
switch costume to [1 life v]
end
if <(lives) = [2]> then
switch costume to [2 life v]
end
if <(lives) = [3]> then
switch costume to [3 life v]
end
else
hide
end
end
- Pomamina815
-
Scratcher
5 posts
How to add lives?
Hello everybody, I want to know how to add lives in my game.I don't know either
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.

- deck26
-
Scratcher
1000+ posts
How to add lives?
Please don't necropost. Your comment does nothing useful and just brings an old topic back to the top page.Hello everybody, I want to know how to add lives in my game.I don't know either
Whenever the main character touches a colour it would deduct one life.
The lives would also show as a sprite in the game.
If you have a question please create your own new topic.
- Discussion Forums
- » Help with Scripts
-
» How to add lives?
thank you very much