Hi!

I think you could do this by doing the following:
Use an Input Splitter Patch for your initial value and connect it to a Multiplexer Patch, which in turn is connected to the X position of your Sprite Patch directly (or whatever coordinate you want it to control). Then use a Math Patch with one input from your Input Splitter and add to that a random number generated by a Random Patch. Connect the Math Patch to a second input port of your Multiplexer Patch. Now, connect the Left Button output port of a Mouse Patch to the Source Index Input port of your Multiplexer. Now, every time you press the left mouse button, the X position of your Sprite Patch will move a random distance from your initial position (from the Input Splitter Patch), respecting the constraints of your Random Patch (Min and Max input ports). If that wasn't clear enough, I can send you a such a composition or a screenshot to clarify things a bit.


If you want to update your initial position using the result of all this, you could maybe take a look at the Sample & Hold Patch. But that would introduce a circle in your connections, and I'm not sure if that is allowed in Tiger yet (did I break the Leopard NDA now? : P ).

Anyways, I hope some of this helps.

Regards,

Marco


On 26.10.2007, at 19:27, Andrew Larking wrote:

Hello everyone.

Before I start, I wanted to say thanks for all the help so far.

I want to place some sprites into random locations, not a problem. However I then want those sprites to move to another random location within a given distance, whenever I either press a mouse button, or audio goes over 0 etc. Basically imagine a sphere in the centre of the screen, i press a button and it will move randomly to another place within a certain distance, etc etc.

Hope that makes sense.

A.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to