Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Change Color
- PartyPanda75
-
6 posts
Change Color
So I am making a game, and what i want to happen is this:
When I click on one sprite that is blue, i want another sprite to change blue. If anyone can help, that's awesome.
Also, how do i get the pen color to change if i click on a sprite?
Thanks
When I click on one sprite that is blue, i want another sprite to change blue. If anyone can help, that's awesome.
Also, how do i get the pen color to change if i click on a sprite?
Thanks
- UndeadSorcerer
-
100+ posts
Change Color
You can edit the costumes or use these:
set [color v] effect to (0)
set pen color to ()
- PartyPanda75
-
6 posts
Change Color
Ok, I tried that but when I go to the scripts on a sprite, and then say when this sprite clicked, set pen color to blue, it doesnt work. Am i doing it wrong?
- BigglesBooks
-
98 posts
Change Color
Okay, you can't just set color effect to “0”. You have to set it to a number between 0 and 200 that is blue. To work out which number is blue, you'll just have to test things out. This is my script for the set color effect:
*The “78” depends on the original color of the sprite.
when green flag clicked
set [color v] effect to (0)
when this sprite clicked
set [color v] effect to (78)
*The “78” depends on the original color of the sprite.
Last edited by BigglesBooks (March 8, 2017 01:19:13)
- PartyPanda75
-
6 posts
Change Color
Thank you, it works, but how would you get the pen color to change? By clicking on a sprite
- GryffindorFreak1
-
100+ posts
Change Color
Pen color won't work, that is something else. Try using this block:
(Sorry, I don't know what number color effect is blue)
If that isn't working, maybe you could try going into the costume editor, duplicating the first costume (by right clicking and choosing ‘duplicate’), and coloring your second costume blue using the fill tool. Then you can set it so that the sprite changes costumes when you click on it.
set [ color] effect to (...)
(Sorry, I don't know what number color effect is blue)
If that isn't working, maybe you could try going into the costume editor, duplicating the first costume (by right clicking and choosing ‘duplicate’), and coloring your second costume blue using the fill tool. Then you can set it so that the sprite changes costumes when you click on it.
- GryffindorFreak1
-
100+ posts
Change Color
Pen color won't work, that is something else. Try using this block:set [ color] effect to (...)
(Sorry, I don't know what number color effect is blue)
If that isn't working, maybe you could try going into the costume editor, duplicating the first costume (by right clicking and choosing ‘duplicate’), and coloring your second costume blue using the fill tool. Then you can set it so that the sprite changes costumes when you click on it.
Edit: Ninja'd. Sorry.

Ugh and now it posted as a new post!!!! Sorry my computer is lagging!!!
Last edited by GryffindorFreak1 (March 8, 2017 01:26:46)
- Scratch-Minion
-
1000+ posts
Change Color
There are 2 different things here: (1) drawing on the stage, and (2) the color of a sprite.
(1) The Pen blocks are used to draw on the stage.
You must use Pen Down, then you move a sprite around the stage to draw.
The color of the drawing on the stage can be set with the “set pen color to …” block.
You can draw on the stage with the pen down even if you hide the sprite.
(2) Sprites themselves also have colors which can be changed.
You can use the “set color effect to …” block to change the sprite colors.
If your sprite has mainly one color (plus maybe some black, white and gray), you can change the color to blue.
If, however, your sprite has many colors, the colors of the sprite will change but there will still be more than one color.
(I see there were about 3 other answers while I was typing this).
(1) The Pen blocks are used to draw on the stage.
You must use Pen Down, then you move a sprite around the stage to draw.
The color of the drawing on the stage can be set with the “set pen color to …” block.
You can draw on the stage with the pen down even if you hide the sprite.
(2) Sprites themselves also have colors which can be changed.
You can use the “set color effect to …” block to change the sprite colors.
If your sprite has mainly one color (plus maybe some black, white and gray), you can change the color to blue.
If, however, your sprite has many colors, the colors of the sprite will change but there will still be more than one color.
(I see there were about 3 other answers while I was typing this).
Last edited by Scratch-Minion (March 8, 2017 01:29:04)
- PartyPanda75
-
6 posts
Change Color
Thanks guys, its still not working, but I'll look into it more, i probably have a problem with another code…
- HoofEMP
-
100+ posts
Change Color
Unfortunately, the saturation effect was cut, so you can't turn an entire sprite blue if it's multicolour.
However, you can use this script to visually test to see which colour number you need for the sprite to appear the best blue:
However, you can use this script to visually test to see which colour number you need for the sprite to appear the best blue:
define colour test with speed (spd)
repeat until <key [space v] pressed?>//you can change space to whatever
change [colour v] effect by (1)
wait ((1) / (spd)) secs
end
- asivi
-
1000+ posts
Change Color
Just create different costumes for different colors
when this sprite clicked
if <(costume #) = []> then
switch costume to [ v]
end
- carteradams123
-
49 posts
Change Color
in case you are somehow still wondering how to do this 3 years later, here you go.
create blue costumes for each sprite.
when sprite #1 is clicked, have it activate an event.
when sprite #2 receives the event, have it switch costumes to the blue one
here is an example:
#1:
#2:
create blue costumes for each sprite.
when sprite #1 is clicked, have it activate an event.
when sprite #2 receives the event, have it switch costumes to the blue one
here is an example:
#1:
when this sprite clicked
broadcast [EVENT v]
#2:
when I receive [EVENT v]
switch costume to [(Your Blue Costume Here)]
Last edited by carteradams123 (Aug. 11, 2020 05:43:59)
- ansh25
-
12 posts
Change Color
I need help
Basically, is there anyway to make a colour change itself when it's completely surrounded by another colour?
I am making a game where you can win by drawing a circle around your opponents, but there are no controls for effects after drawing a circle, so I simplified my instructions to setting the circle variable to 1 every time the sprite touches the colour it's drawing and I want to be able to program my game to be able to change the colour inside the circle from white to greyish for a second so that if the enemy sprite is touching the greyish colour, they lose. To make this possible I need to find a command or series of commands which make it so that a colour changes when it is completely surrounded by another colour. Is there any way to do this?
Thanks.
Basically, is there anyway to make a colour change itself when it's completely surrounded by another colour?
I am making a game where you can win by drawing a circle around your opponents, but there are no controls for effects after drawing a circle, so I simplified my instructions to setting the circle variable to 1 every time the sprite touches the colour it's drawing and I want to be able to program my game to be able to change the colour inside the circle from white to greyish for a second so that if the enemy sprite is touching the greyish colour, they lose. To make this possible I need to find a command or series of commands which make it so that a colour changes when it is completely surrounded by another colour. Is there any way to do this?
Thanks.
Last edited by ansh25 (Oct. 15, 2020 16:02:26)
- MrElectron
-
1 post
Change Color
I'm making a game, and in it I have a square that changes color when the start button is pressed.
I want to make it so that the pen is the same color as the sprite. I have a variable for that, but it seems to still be different.
I want to make it so that the pen is the same color as the sprite. I have a variable for that, but it seems to still be different.
- bSpyder
-
100+ posts
Change Color
I'm making a game, and in it I have a square that changes color when the start button is pressed.
I want to make it so that the pen is the same color as the sprite. I have a variable for that, but it seems to still be different.
Please don't necropost, this topic is 4 years old. Please make your own topic and state your question there.
- me_the_super
-
100+ posts
Change Color
Wouldn't it be an easy solution to use brodcasts? Like this: So I am making a game, and what i want to happen is this:
When I click on one sprite that is blue, i want another sprite to change blue. If anyone can help, that's awesome.
Also, how do i get the pen color to change if i click on a sprite?
Thanks
when I recieve [message v] :: hat block :: events
if <(index) = [1]> then {
switch costume to [ costume v] :: looks
} :: control
when @greenFlag clicked :: events
set [ index v] to [1]
broadcast [ message v]
// If theres an index variable then you can choose whitch sprite/clone to switch to the blue costume.
- Discussion Forums
- » Help with Scripts
-
» Change Color