Discuss Scratch

aiyuen1
Scratcher
3 posts

Lives

Im trying to make this thing where when I have 5 coins it gives me a life. How do I make it so that when I die, I get to still live.
NotchsApple
New to Scratch
6 posts

Lives

do: When die, if coins>4 then change coins by -5
fakemaker1337
Scratcher
99 posts

Lives

NotchsApple wrote:

do: When die, if coins>4 then change coins by -5
if <(die )= [1]> then
if <(coins) > [4]> then
change [coins] by (-5)
end
end
Is this what you mean?

Last edited by fakemaker1337 (Feb. 25, 2022 15:06:42)


when green flag clicked
forever
if <<On Scratch> and <On Forums>> then
repeat until <(help need near me) = [no]>
if <(help need near me) = [yes]> then
Help!
end
end
end
end
aiyuen1
Scratcher
3 posts

Lives

I meant like and extra life not the coins. So If i run intro a wall (Im doing a 2d maze game) then I still get to live and not restart
aiyuen1
Scratcher
3 posts

Lives

https://scratch.mit.edu/projects/642486059/

check it our to see what I can do
helloworldbyeworld
Scratcher
1000+ posts

Lives

aiyuen1 wrote:

I meant like and extra life not the coins. So If i run intro a wall (Im doing a 2d maze game) then I still get to live and not restart
Okay, then try this:

when green flag clicked
set [Lives v] to (1) // or how many lives you get at the start of the game
forever
if <touching [wall v] ?> then // or whatever condition makes you die
change [Lives v] by (-1)
wait until <not <touching [wall v] ?>> // or <not <whatever condition makes you die>>
end
if <(Lives) < (1)> then
die::grey
stop [all v]
end
end

To have the player gain an extra life, such as when completing a level, change the lives variable by 1.

Helloworldbyeworld | 1200+ posts
Have a great day

Powered by DjangoBB