Messages sent while mouse is down?
Jim Lambert
jiml at netrin.com
Sun Mar 12 14:44:35 EDT 2017
> Tim wrote:
>
> Click and drag the mouse through
> adjacent letters to make words.
>
> Without clicking, simply moving the mouse through the tiles
> (fields) triggers mouseenter, mouseleave, etc. which makes it
> easy to pick up the letters.
>
> But when the mouse is down, it seems mouseloc() is the only thing
> I can get. Using a variable what has all the field rectangles, I
> can use the mouseloc() to ultimately identify the field under the
> pointer, but it's too slow...
>
>
How about a slight change in the game’s instructions?
Instead of "click and drag through the letters to highlight a word", have the user click on the first letter of their word, mouse through the intervening letters, and finally click on the last letter of their word to end their word discovery process.
That way you entirely avoid having to track the mouseloc while the mouse is down.
Use the first click (mouseup) to begin ‘recording’ the user’s word discovery. That will tell you letter #1 of their word.
Then use subsequent mouseenters to track which letters the user moved into next and the order of entry. That will tell you the rest of the letters in their word.
Use the next click (mouseup) to end their word discovery process.
Then you compare their word to your dictionary to see if it is a legit word.
Of course, you'll want to account for clicks outside of the play area and ignore them or restrict mouse movement to the play area during the word discovery process.
Jim Lambert
More information about the use-livecode
mailing list