Forums > MaxMSP

LCD sprite move?

August 1, 2011 | 7:15 am

Is there such a command? Or workaround, other than clearing and re-drawing? Better yet, a way to make a sprite draggable in the UI? I’m looking to place some images in an LCD, be able to have the user move them, and to have Max track their position.

I searched and read the docs, nothing looks too promising…

Thanks,
Brian


August 1, 2011 | 8:29 am

I’m not sure about your question…
but perhaps the use of "thispatcher" can help you.


August 1, 2011 | 10:18 am

Here’s one way to do it with a thispatcher object and pictctrl objects for sprites. Hit the button in the top left, and then you can drag around the three gray pictctrl objects when the patch is locked or in presentation mode.

This uses a mousestate object to poll the mouse position, and then a three-way gate to route the XY coordinates to one of three scripting messages that moves one of the three pictctrl objects. The pictctrl objects are in button mode, so they send out a 1 when you click and hold (=click and drag) and a 0 when you release the mouse button. They’re linked to [select 1] objects so that when you click, they’ll bang a message box that opens the appropriate gate. When you release the mouse, the 0 from the pictctrl goes out the right outlet of the select object to close the gate entirely so that the coordinates aren’t triggering any of the move messages.

You can track the positions of the three pictctrls (which you can set to any image you want…see the help/ref files) by also sending the latest coordinates sent out of each of the three gate outlets to number boxes (or however you want to store that info).

Is that what you had in mind?

– Pasted Max Patch, click to expand. –

August 1, 2011 | 10:51 am

wow that’s pretty inventive:)

my version is a bit more pedestrian, using lcd:

edit– just read the OP properly– you wanted pictures. Have a look at the [images] subpatch in the lcd helpfile– you can adapt my patch to your purposes with the images commands

– Pasted Max Patch, click to expand. –

August 3, 2011 | 6:45 am

Wow, both are cool, thanks! I love that they’re so different and each have their own distinct– and very Max-ian– logic. :)
Either would fit the bill…


Viewing 5 posts - 1 through 5 (of 5 total)