Discuss Scratch

RogerLemon
Scratcher
6 posts

How to make scratch sprites be able to be clicked behind other sprites

So, I have one sprite as a light (ghost effect) with other sprites behind it. When you try to click the sprite behind it, it will act like you are clicking the light sprite. How would I make the sprites behind the light clickable, without making them in front of the light?
Cool_Dude2022
Scratcher
500+ posts

How to make scratch sprites be able to be clicked behind other sprites

RogerLemon wrote:

So, I have one sprite as a light (ghost effect) with other sprites behind it. When you try to click the sprite behind it, it will act like you are clicking the light sprite. How would I make the sprites behind the light clickable, without making them in front of the light?

Instead of detecting if the mouse is touching it, detect if the mouse is inside the hitbox instead.
YC72909
Scratcher
100+ posts

How to make scratch sprites be able to be clicked behind other sprites

Hello!

I think you could make another sprite or clone (you can choose which one works best for you) that is exactly the same as the sprite behind the light sprite. Bring that sprite to the front layer, hide it, and add click sensing. You could send a broadcast message to the real sprite behind the light sprite and make it do whatever you intended it to do.

So, in the copy of the sprite you're trying to click without bringing it in front of the light sprite, your script might look something like this:

gotofronthideforeveriftouchingmouse pointer?andmousedown?thenbroadcasta message to sprite behind the light sprite

Hopefully this helps
RogerLemon
Scratcher
6 posts

How to make scratch sprites be able to be clicked behind other sprites

Cool_Dude2022 wrote:

RogerLemon wrote:

So, I have one sprite as a light (ghost effect) with other sprites behind it. When you try to click the sprite behind it, it will act like you are clicking the light sprite. How would I make the sprites behind the light clickable, without making them in front of the light?

Instead of detecting if the mouse is touching it, detect if the mouse is inside the hitbox instead.
Thanks.

Powered by DjangoBB