Variables in "Touching" and "Touching Color" ??
id: 184974
category: Help with Scripts
posts: 13
Feb 24, 2016 01:52:12
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Dale_Mahalko
loading
How do you use variables with the Touching sense? I am using Scratch 2.0 standalone.
There is no way to “Set variable to color” in the editor by clicking on objects on the stage, to set a color…. (Let's see what the website does with this..)
If I try typing the name of a sprite into a variable, it does not detect the sprite. Putting the sprite name in quotes in the variable doesn't help.
I am trying to iterate through a list of sprites to scan for objects it is touching.
<touching (N) ?>
<touching color (N) ?>
There is no way to “Set variable to color” in the editor by clicking on objects on the stage, to set a color…. (Let's see what the website does with this..)
set (N) to [#ff0088]
If I try typing the name of a sprite into a variable, it does not detect the sprite. Putting the sprite name in quotes in the variable doesn't help.
I am trying to iterate through a list of sprites to scan for objects it is touching.
Feb 24, 2016 02:11:58
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Dale_Mahalko
loading
Whoops, got the “touching Sprite N” with a named sprite to work…. found a typo.
Though still no way to set a variable to a color, apparently.
Though still no way to set a variable to a color, apparently.
Feb 24, 2016 02:28:50
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
LLCoolJC
loading
You can test if touching a sprite easily like this:
<touching (join[Spritename][])?>
Feb 24, 2016 18:36:16
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Dale_Mahalko
loading
Yes, but the question remains why “Touching Color” allows a variable to be dropped into the color selection box, if you cannot actually store colors in variables. Looks like a bug or undocumented feature to me.
Feb 24, 2016 18:41:35
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
deck26
loading
You can represent colours using RGB codes - see the bottom half of Yes, but the question remains why “Touching Color” allows a variable to be dropped into the color selection box, if you cannot actually store colors in variables. Looks like a bug or undocumented feature to me.http://wiki.scratch.mit.edu/wiki/Set_Pen_Color_to_%28%29
Oct 22, 2019 22:01:00
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Sunburn02
loading
Has anyone found a fix to this? I want a drawing to stop once it touches another drawing and putting the variable i assigned to color does nothing for the touching color block. Any work arounds?
Oct 23, 2019 01:05:01
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Zizzle8383
loading
dont necropost Has anyone found a fix to this? I want a drawing to stop once it touches another drawing and putting the variable i assigned to color does nothing for the touching color block. Any work arounds?
Oct 23, 2019 01:06:29
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Zizzle8383
loading
(deleted)
Oct 23, 2019 10:25:17
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
deck26
loading
Instead of necroposting create your own new topic and share the project. Has anyone found a fix to this? I want a drawing to stop once it touches another drawing and putting the variable i assigned to color does nothing for the touching color block. Any work arounds?
Mar 3, 2022 09:55:45
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
advantage666
loading
i know this is too late but instead of using ‘#’ use ‘0x’ for the hex code
hope it helps
hope it helps
Mar 3, 2022 11:45:53
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
Brabygg
loading
You are indeed way, way too late. This is necroposting to the extreme. i know this is too late but instead of using ‘#’ use ‘0x’ for the hex code
hope it helps
Mar 23, 2024 20:27:06
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
FrederikQSI
loading
I need to detect if an object is touching another object and then change a varialbe because of that, but that loops and changes the variable infintly. Does anyone have a fix for this?
Apr 10, 2024 22:31:55
Variables in "Touching" and "Touching Color" ??
view on scratch
view on legacy ocular
owenl081
loading
Here is something that might help you I need to detect if an object is touching another object and then change a varialbe because of that, but that loops and changes the variable infintly. Does anyone have a fix for this?
when green flag clicked
forever
if <not <[variable that changes on touch] = [original value]>> then
if <touching [sprite v] ?> then
set [varaiable that changes on touch v] to [your value]
end
end
end