Discuss Scratch

CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

I need help with button code I wanna make it so if you press “E” It shows something but when you press “E” again it hides it please help.

Last edited by CraySilver (Feb. 11, 2022 20:30:13)


yop

when green flag clicked
forever
say [let coding]
end
gor-dee
Scratcher
1000+ posts

A button doing something else when you click it again.

maybe
when this sprite clicked
if <(foo) = [true]> then


set [foo v] to [false]
show
else
set [foo v] to [true]
hide
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

let me try

yop

when green flag clicked
forever
say [let coding]
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

i think my computer broke when i put it

Last edited by CraySilver (Feb. 12, 2022 06:08:31)


yop

when green flag clicked
forever
say [let coding]
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

cause im on a chrome book and i drop my chrome book multiple times and ever since i dropped it, it doesnt load fast

yop

when green flag clicked
forever
say [let coding]
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

nevermind its just the code it doesnt work

yop

when green flag clicked
forever
say [let coding]
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

maybe i should use hidden costumes???

yop

when green flag clicked
forever
say [let coding]
end
CraySilver
Scratcher
59 posts

A button doing something else when you click it again.

nope costumes dont work

yop

when green flag clicked
forever
say [let coding]
end
bookmanoldstyle
Scratcher
33 posts

A button doing something else when you click it again.

when green flag clicked
switch costume to [apple]
set [e pressed?] to [0]

when [e] key pressed
if <e pressed? = 1> then
set [e pressed?] to [1]
switch costume to [apple]
play sound [Sorry, already pressed] until done
else
set [e pressed?] to [1]
switch costume to [banana]
play sound [Pressed it!] until done
end

Try this! I think it'll help. I've also made another version- https://turbowarp.org/643237609. I think it should work.

Nooooo! I saved my signature, and it's GONE!
bookmanoldstyle
Scratcher
33 posts

A button doing something else when you click it again.

gor-dee wrote:

maybe
when this sprite clicked
if <(foo) = [true]> then


set [foo v] to [false]
show
else
set [foo v] to [true]
hide
end

I think this'll work, too.

Nooooo! I saved my signature, and it's GONE!

Powered by DjangoBB