Discuss Scratch

CookieGamer1119
Scratcher
2 posts

How to make it so when a variable goes to 0 it will Turn back to 100?

Im making a shooter game but when I put a code similar to this that didn't function. can somebody please help?
Hello3Rules
Scratcher
100+ posts

How to make it so when a variable goes to 0 it will Turn back to 100?

when green flag clicked
forever
if <(☁ score) = [0]> then
set [ score] to [100]
end


If i understood it correctly, is this what you mean?

Last edited by Hello3Rules (Jan. 16, 2022 06:31:17)


▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▎
●●●●●●●●●●●●●●●●●●●●●●●●
●• 10⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀☘⠀⠀●
●• ꜱʜᴇ/ʜᴇʀ⠀⠀⠀⠀⠀⠀⠀⠀⠀☘⠀⠀●
●• ɪɴᴛʀᴏᴠᴇʀᴛ | ♓︎⠀⠀⠀⠀⠀☘⠀⠀●
●●●●●●●●●●●●●●●●●●●●●●●●

▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▎


llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı.
dhuls
Scratcher
1000+ posts

How to make it so when a variable goes to 0 it will Turn back to 100?

Hello3Rules wrote:

(#2)
when green flag clicked
if <(☁ score) = [0]> then
set [ v] to [100]
end
That doesn't work.
You need to use a forever loop
when green flag clicked
forever
if <(variable) = [0]> then
set [variable v] to [100]
end
end
Hello3Rules
Scratcher
100+ posts

How to make it so when a variable goes to 0 it will Turn back to 100?

dhuls wrote:

Hello3Rules wrote:

(#2)
when green flag clicked
if <(☁ score) = [0]> then
set [ v] to [100]
end
That doesn't work.
You need to use a forever loop
when green flag clicked
forever
if <(variable) = [0]> then
set [variable v] to [100]
end
end

omg i just forgotted. thank you for reminding ^^

▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▎
●●●●●●●●●●●●●●●●●●●●●●●●
●• 10⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀☘⠀⠀●
●• ꜱʜᴇ/ʜᴇʀ⠀⠀⠀⠀⠀⠀⠀⠀⠀☘⠀⠀●
●• ɪɴᴛʀᴏᴠᴇʀᴛ | ♓︎⠀⠀⠀⠀⠀☘⠀⠀●
●●●●●●●●●●●●●●●●●●●●●●●●

▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▎


llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı. ♪♫llılılı.
CookieGamer1119
Scratcher
2 posts

How to make it so when a variable goes to 0 it will Turn back to 100?

dhuls wrote:

Hello3Rules wrote:

(#2)
when green flag clicked
if <(☁ score) = [0]> then
set [ v] to [100]
end
That doesn't work.
You need to use a forever loop
when green flag clicked
forever
if <(variable) = [0]> then
set [variable v] to [100]
end
end
didn't work! (by the poster of the thread)

Powered by DjangoBB