Discuss Scratch

Beans21Canned
New Scratcher
1 post

Help! Why isn't "touching _" in Sensing working?

Why is my <touching ?> block is not working?
when green flag clicked
forever
if <touching [sprite2] ?> then
change [Score] by (-1
end
end

Last edited by Beans21Canned (Oct. 23, 2025 11:27:59)

J_REX2
Scratcher
21 posts

Help! Why isn't "touching _" in Sensing working?

based on the code you provided, this would constantly remove 1 score for every FRAME Sprite1 touches Sprite2. here’s a fix:
when green flag clicked
forever
if <touching (Sprite2 v) ?> then
change [Score v] by (-1)
wait until <not<touching (Sprite2 v) ?>>
end
end
What this does is fix this bug by waiting until the Sprite1 has stopped touching Sprite2 before removing any more score.

Powered by DjangoBB