I need help in mouse detection

(This is a template, feel free to delete it.)

What's problem you are encountering?

I tried to make a thing where the sprite draws some text on the screen, meanwhile calculating the exact position area of the text (the block reports a list, [[start of x pos], [end of x]], [start of y], [end of y]]). I want to make the program detect when the mouse is pressed down on the certain area, and respond differently when a certain area is clicked.

This problem can be simplified to: there are some (in this case, let's say 4) areas on the screen, each with a list with the area in this structure: [[start of x pos], [end of x]], [start of y], [end of y]]. Now when the mouse clicks on one, give a response.

This is the failed code:

(This part needs rewrite)
The debugging car is the debugging variable (car is typo) don't mind it.
The play block is the response.
The mouse between block works fine.

Can anyone help me please?

You want to break the "forever loop" when option is clicked, or just "for each"? "Stop this block" is meant for custom blocks. Used this way it just stop the entire script.

I'm sorry, I don't really understand what you're having problems with. It would be nice if you posted an example project.

I wouldn't do it that way at all. I'd create a sprite for each of those texts whose costume is the text, or whose costume is a transparent rectangle covering the text, and then use WHEN I AM CLICKED on each sprite.

doesn't detect a click on a transparent part of a sprite.

Oh. Bummer. Maybe it has to be 1% opaque or something?

I think that would work.

I'm making this choose-your-own-adventure template where you can use this project to make a CYOA game. It would be inconvenient to make a sprite for every text.

I've got a custom reporter that will create a costume from text.

You can change the background to nearly complete transparency (but enough so that it's clickable on)

Then you could just have one master text sprite and make clones of it as needed maybe


Thank you!

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