Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how does scratch's touching() sensor work?
- broskinumber3
-
41 posts
how does scratch's touching() sensor work?
im mainly interested in figuring this out for clone collision detections, mainly for detecting what type of sprite it is, and reading variables from it.
any info / videos regarding this topic would be very very VERY helpful.
cheers, b#3
any info / videos regarding this topic would be very very VERY helpful.
cheers, b#3
- broskinumber3
-
41 posts
how does scratch's touching() sensor work?
i cant think of anything to actually detect the clones pixel's touching eachother, the easiest workaround i can think of is writing all of their positions into an X and Y table (list), at a certain clone index, and calculating distances from there, but i want real accuracy and actual touching, not just seeing how far away the other clones/sprites are from a certain clone/sprite
- kkhtr
-
23 posts
how does scratch's touching() sensor work?
I did some testing and I'm pretty sure the
and you could probably use a script with variables to send clone specific Info (variables).
If you don't know how to make a clone specific variable it is basically if you make a variable “for this sprite only” when a clone is created that clone has his own version of that variable. (it will not be able to be shown without using a script with “for all sprites” variables.)
<touching [ v] ?>Does let clones detect other clones
and you could probably use a script with variables to send clone specific Info (variables).
If you don't know how to make a clone specific variable it is basically if you make a variable “for this sprite only” when a clone is created that clone has his own version of that variable. (it will not be able to be shown without using a script with “for all sprites” variables.)
- broskinumber3
-
41 posts
how does scratch's touching() sensor work?
forgot to say my main main reason which is for scrolling projects & detecting offscreen collisions
- broskinumber3
-
41 posts
how does scratch's touching() sensor work?
ive actually used this a few times before, when i made an example sprite, this time, scratch cat, detect if touching scratch cat, only issue, it cant detect offscreen collisions which is what really matters to me rn
I did some testing and I'm pretty sure the<touching [ v] ?>Does let clones detect other clones
and you could probably use a script with variables to send clone specific Info (variables).
If you don't know how to make a clone specific variable it is basically if you make a variable “for this sprite only” when a clone is created that clone has his own version of that variable. (it will not be able to be shown without using a script with “for all sprites” variables.)
- kkhtr
-
23 posts
how does scratch's touching() sensor work?
BTW here is where I have been testing my ideas:
https://scratch.mit.edu/projects/923183760/
Space to move square
Click to move circle
Hold q to switch who is talking.
https://scratch.mit.edu/projects/923183760/
Space to move square
Click to move circle
Hold q to switch who is talking.
Last edited by kkhtr (Nov. 12, 2023 05:50:02)
- kkhtr
-
23 posts
how does scratch's touching() sensor work?
Dude i wish I could talk to you about something that lets people work on projects like G docs together but scratch bans mentions of chrome extensions for the website.
PLS DON"T REPORT ME FOR THIS MESSAGE
PLS DON"T REPORT ME FOR THIS MESSAGE
Last edited by kkhtr (Nov. 12, 2023 05:52:07)
- broadwaynerd73
-
13 posts
how does scratch's touching() sensor work?
Hi! I don't know if this is what your looking for but I believe that to use the
<touching [ v] ?>block you have to put it in side a forever block because if you don't it will only check if it's touching it once and then it won't check again so you should have a code a bit like this
forever
if <> then <touching [ v] ?>
Last edited by broadwaynerd73 (Nov. 12, 2023 10:17:56)
- broskinumber3
-
41 posts
how does scratch's touching() sensor work?
im looking for how the sensing block actually works, not for the block itself.
Hi! I don't know if this is what your looking for but I believe that to use the<touching [ v] ?>block you have to put it in side a forever block because if you don't it will only check if it's touching it once and then it won't check again so you should have a code a bit like thisforever
if <> then <touching [ v] ?>
- Rafael_Bagi123
-
86 posts
how does scratch's touching() sensor work?
im looking for how the sensing block actually works, not for the block itself.Hi! I don't know if this is what your looking for but I believe that to use the<touching [ v] ?>block you have to put it in side a forever block because if you don't it will only check if it's touching it once and then it won't check again so you should have a code a bit like thisforever
if <> then <touching [ v] ?>
bro i thinking you trying to discover something very obvious, the touching sensor block work, when the sprites detect that he is over or below another sprite, if the sprite is the sprite you want he give a yes, else no
but i see you want to see off screen collisions so, here is my ideia:
first every sprite need an id
put every sprite x and y into a list, after in another list put the how many pixels big he is (below the costume name is a number x another number is how many pixel big he is for the x asis and for the y asis)
after do some math to see if they colide with each other
i have no ideia how to program this, i'm sorry

- kkhtr
-
23 posts
how does scratch's touching() sensor work?
Well when you put an is touching (0) block inside a set variable block when the touching is happening it is considered to be false and then when touching it says the variable is true. However when put in a change variable block it is considered 1 when touching and 0 when not.
- Discussion Forums
- » Help with Scripts
-
» how does scratch's touching() sensor work?