Discuss Scratch

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.
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.
Laddie12
Scratcher
100+ posts

How to add lives?

when green flag clicked
set [life v] to [3]
forever

if <touching color [#ff0088] ?> then

change [life v] by (-1)
go to x: (startx) y: (starty)
end

end
startx and starty being the starting coordinates of the player

Last edited by Laddie12 (May 3, 2016 17:28:54)

BKFighter
Scratcher
1000+ posts

How to add lives?

Capan wrote:

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.
1) Create a variable named Lives
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 clicked
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
4) For the sprite with the three lives costume:
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?

Capan wrote:

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.
I don't know either
deck26
Scratcher
1000+ posts

How to add lives?

Pomamina815 wrote:

Capan wrote:

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.
I don't know either
Please don't necropost. Your comment does nothing useful and just brings an old topic back to the top page.

If you have a question please create your own new topic.
keenanbrennan
Scratcher
1 post

How to add lives?

thank you very much


2Dproductions
Scratcher
500+ posts

How to add lives?

keenanbrennan wrote:

thank you very much

please don't necropost

Powered by DjangoBB