We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Random coordinates HELP
Page Index Toggle Pages: 1
Random coordinates HELP (Read 1063 times)
Random coordinates HELP
Aug 13th, 2009, 10:42am
 
Here's the fraction of the code:

    void draw() {
      rect(x, y, mouseX, mouseY);
}

How do I make the first x&y coordinates random?
I want it to make rectangles following the cursor at different sizes. I've got more code if you want to see it, just say.
Re: Random coordinates HELP
Reply #1 - Aug 13th, 2009, 10:51am
 
Code:
rect(random(0,width),random(0,height),mouseX,mouseY)

dont know whether u want this or not, check this too
:
Code:
rect(mouseX,mouseY,random(0,width-mouseX),random(0,height-mouseY));  
Re: Random coordinates HELP
Reply #2 - Aug 13th, 2009, 11:01am
 
Thanks the second one was the one I wanted. Cheesy Thanks very much
Page Index Toggle Pages: 1