Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help needed from smart coders !
- finalbidnow
-
New Scratcher
2 posts
Help needed from smart coders !
Haha, I didn't realize there was a specific forum for this! forgive the repost.
Hi! I'm not new to scratch but.. I am new to coding!

This is a new account because I want to make games rather than just explore projects by others, I don't want to make it big or anything, I just want to help bring a bit of happiness to someone's day
I need help making it so when you touch a specific spot on a sprite, it changes to a different costume. For example, this little stick man changes costumes from Normal_stick to Stick_left_eye when his left eye is clicked, and from Normal_stick to Stick_right_eye when his right eye is clicked.
Video tutorials would help a lot!

Hi! I'm not new to scratch but.. I am new to coding!


This is a new account because I want to make games rather than just explore projects by others, I don't want to make it big or anything, I just want to help bring a bit of happiness to someone's day
I need help making it so when you touch a specific spot on a sprite, it changes to a different costume. For example, this little stick man changes costumes from Normal_stick to Stick_left_eye when his left eye is clicked, and from Normal_stick to Stick_right_eye when his right eye is clicked.
Video tutorials would help a lot!


- jc_vega
-
Scratcher
10 posts
Help needed from smart coders !
Grab the when this sprite clicked block from the events category, and get the switch costume to costume1 block from the looks category and snap e'em together.
- dem_bot
-
Scratcher
1000+ posts
Help needed from smart coders !
well for a specific spot, you'll want to check if the mouse is near that spot. It depends a bit on how many of such spots you want and what their shapes are what the best approach is, but the most common one I use is to when the thing is clicked, check if the mouse coords are beyond a certain amount or not
- 10goto10
-
Scratcher
1000+ posts
Help needed from smart coders !
If you are clicking on specific item on the sprite (you mentioned eye) then you could make those items be separate clickable sprites. My guess is that you didn't want to do that because your main figure is moving. If that's the concern then what is usually done is to make the objects move relative to the main figure.
I made a small case study. The hat, glasses, and the face are separately clickable but they move like they are one sprite. https://scratch.mit.edu/projects/1388322407/
I made a small case study. The hat, glasses, and the face are separately clickable but they move like they are one sprite. https://scratch.mit.edu/projects/1388322407/
- Tundra_The_Therian
-
New Scratcher
1 post
Help needed from smart coders !
Try making each clickable part a slightly different color, and then use
if <<touching color [#ffffff] ?> and <mouse down?>> then
end
- dem_bot
-
Scratcher
1000+ posts
Help needed from smart coders !
Try making each clickable part a slightly different color, and then usemy friend, that's now how the touching colour block works. Touching colour tells you if the sprite is touching that colour, not if the mouse is touching that colour. Of course you could technically make a small sprite that always goes to the mouse and does the check, but touching colour block often does silly stuff and I would recommend just not using it.if <<touching color [#ffffff] ?> and <mouse down?>> then
end
- FancyTigerDustBall
-
Scratcher
84 posts
Help needed from smart coders !
That gets a little tricky. Like dem_bot said, you need to use the “mouse x” and “mouse y” variables to check if the mouse is in a specific area. If the left eye is between -10 and -6 away from the stick man's center on the x-axis and between +31 and +35 on the y-axis (for example) then you would have this code:
(Sorry, I had to split the “and” block or else it was too long)
It's a little tricky but it should work.
Let me know if you get this working!
when this sprite clicked
if <<<(mouse x) > ((x position) - (10))> and <(mouse x) < ((x position) - (6))>> and<> > then
<<> and <<(mouse y) > ((y position) + (31))> and <(mouse y) < ((y position) + (35))>>>
(Sorry, I had to split the “and” block or else it was too long)
It's a little tricky but it should work.
Let me know if you get this working!
Last edited by FancyTigerDustBall (Oct. 7, 2026 01:57:58)
- nembence
-
Scratcher
1000+ posts
Help needed from smart coders !
You can make costumes that have only one clickable part of the sprite, then you can temporarily switch to that and test if it's touching the mouse
when this sprite clicked
switch costume to (eye of stickman v)
set [eye clicked? v] to <touching (mouse-pointer v)?>
switch costume to (stickman v)
- Discussion Forums
- » Help with Scripts
-
» Help needed from smart coders !