Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Touching(sprite) block not working
- -BobAndJoe-
-
Scratcher
2 posts
Touching(sprite) block not working
Hello, I am working on a project, but the touching sprite block doesn't work, and only returns a false output no matter what. Here is a sample of the code:
define a block
repeat (61)
repeat (60)
if <touching Level> then
change pen shade by (-5)
end
end
end
Last edited by -BobAndJoe- (April 3, 2023 00:56:32)
- medians
-
Scratcher
1000+ posts
Touching(sprite) block not working
Hold on, what sprite is this in? It might be in the same sprite that the touching block is detecting because in 3.0, it always returns false unless there are clones. Send the link to the project.
Last edited by medians (April 3, 2023 00:58:04)
- -BobAndJoe-
-
Scratcher
2 posts
Touching(sprite) block not working
Hold on, what sprite is this in? It might be in the same sprite that the touching block is detecting because in 3.0, it always returns false unless there are clones. Send the link to the project.First of all, fast reply

Second of all : Link: https://scratch.mit.edu/projects/829418845/
it is the sprite called: LIGHT
Look at the cast a shadow block
- MasterofTheBrick
-
Scratcher
1000+ posts
Touching(sprite) block not working
The costume is too small for the detection scripts to work - decreasing the y-coordinate by intervals of -8 will cause it to skim over the platforms you’re aiming to come into contact with. Scaling up the costume very slightly decreases the ‘resolution’ of the lighting by causing it to become pixelated, but makes it clearer to the viewer since it will hit the platforms with increasing frequency. Subsequently increasing y’s rate of change (from -8 to -10) reduces the concentration and produces an overall lighter effect.
You’ll have to strike a balance between increasing the costume size and y’s decreasing rate to achieve an effect you’re satisfied with.
You’ll have to strike a balance between increasing the costume size and y’s decreasing rate to achieve an effect you’re satisfied with.
- BbloX_Codingedu
-
Scratcher
1 post
Touching(sprite) block not working
I think you should just remove the repeat blocks, instead, put a forever block calling it OUTSIDE of the custom block.
- gipaty
-
Scratcher
29 posts
Touching(sprite) block not working
Do this:
define a block
forever
if <touching something> then
change pen shade by (blablabla)
end
end
- Discussion Forums
- » Help with Scripts
-
» Touching(sprite) block not working