How to see if a var watcher is moused over

For a project, I need to be able to see whether or not a variable watcher is moused over. I tried setting specific coords and seeing if mouse x > coord1 && mouse y < coord2 etc. But I realized that doesn't work with fullscreen mode. Could someone help me with this?

What do you mean like that? It works in full screen for me.
This sctipt,
untitled script pic (6)
Always reports 240 if my mouse is on the right edge of the stage.

That may be true, but the watcher POSITIONS change in fullscreen, and there's no way to change that. So it'll end up being fairly inaccurate.

Right now, there is a bug where the untitled script pic (7) blocks take the color of the watchers into account, so you could use that, especially if you have a solid color stage.

Actually, the stage in the project is user-influenced, so that wouldn't be possible. Besides, that bug will probably be fixed sometime and it would break the project. Apparently that's not a bug, but still.

Are you sure that's a bug? The block reports the visible color at that point, including sprites, not just the pentrails color.

The last time this came up, the answer was to overlay a transparent sprite over the watcher. But I guess if you don't know its position that doesn't help?

I bet it's a four-line JS function to get from the variable name to the watcher object and from there to its position and size. One of you JS experts want to take that on?

PS No such thing as a dumb question.

It might not be, I had just heard it called a bug, probably because most people (myself included) think of watchers as being on a separate layer from the stage.

Challenge accepted.

Solution
const watcher = this.findVariableWatcher(varName),
        mouse = this.world().hand.position();
return watcher? watcher.bounds.containsPoint(mouse) : false; 

Thank you so much!

wow! is there any code so instead of it working with the mouse-pointer it works only/also with sprites?

Good question; challenge accepted.
This kind of works:
return this.findVariableWatcher(varName).bounds.intersects(this.bounds);
It takes the rectangular bounding area around the sprite, so this would be perfect for a sprite with a rectangular costume and is not rotated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.