annie doll
YaBB Newbies
Offline
Posts: 1
Help needed :(
Apr 27th , 2010, 3:17am
Hi guys, Just wondering if anyone can help me. I am working through the processing program & am wondering if lines & a quad can be joined to make a 'shape' so that i am able to assign it to the mouse x & y, and it is able to enlarge and scale smaller when the mouse moves. Here is my current code, the ellipse at the bottom of the screen is what i would like to be a boat, so the boat is coming towards and away from the screen when the cursor moves the 'sun'. I know it's lame! Please help, this is driving me crazy! void setup() { size(400, 400); smooth(); noStroke(); } void draw() { ; if (mouseY < 100) { fill (62,161,234); rect(0, 0, 400, 200); } else if ((mouseY >= 50) && (mouseY <= 100)) { fill (184,192,198); rect(0, 0, 400, 200); } else if ((mouseY >=100) && (mouseY <=350)) { fill (255,181,44); rect(0, 0, 400, 200); } else if (mouseY >= 350){ fill (0); rect (0, 0,400, 200); } float x = mouseX; float y = mouseY; float mx = constrain(x, 0, 400); float my = constrain(y, 0, 200); fill(251,255,49); ellipse(mx, my, 70, 70); fill(80,234,197); float ix = width - mouseX; // Inverse X float iy = mouseY - height; // Inverse Y fill (39,55,216); rect(0, 200, 400, 200); fill (250); rect (x, height-220, y, y); } and here is the 'thing' i am imagining is the boat: size (200,200); smooth (); fill (0); quad (20,70,50,50,80,70,50,105); strokeWeight (2); line (20,70,22,85); line (80,70,78,85); line (50,105,50,130); line (78,85,50,130); line (50,130,22,85); THANKS HEAPS!! Any suggestions are appreciated!! x