float fr = 10; float w = 20; float h = 20; float x = 150; float y = 150; int num = 100; float line1x1 = 20; float line1y1 = 30; float line1x2 = 40; float line1y2 = 60; float line2x1 = 40; float line2y1 = 30; float line2x2 = 20; float line2y2 = 60; float cirx[] = new float[num]; float ciry[] = new float[num]; void setup() { size(300,300); smooth(); framerate(30); noFill();} void draw() { float red = random(255); float green = random(0); float blue = random(0); noStroke(); line1x1 = line1x1 + 1; //increment the X to move across and down screen line1y1 = line1y1 + 1; line1x2 = line1x2 + 1; line1y2 = line1y2 + 1; line2x1 = line2x1 + 1; line2y1 = line2y1 + 1; line2x2 = line2x2 + 1; line2y2 = line2y2 + 1; //The X moving across the screen and where the mouse is background(0); if (mousePressed) { //when u press the mouse the X moves stroke(255); line(line1x1,line1y1,line1x2,line1y2); line(line2x1,line2y1,line2x2,line2y2); line(mouseX,mouseY,mouseX + 20,mouseY + 30); //when u press the mouse an X shows up where the mouse is line(mouseX + 20,mouseY,mouseX,mouseY + 30); //i want an X to stay where ever the mouse is but not working } //the mouse with following circles for(int i=1; i= 150){ //if the width is = or larger than 150 then decrease w = w * -1; } if (h >= 150) { //if the height is = or larger than 150 then decrease h = h * -1; } fill(r,g,b); //drawing the rect rectMode(CENTER); rect(x,y,w,h); } }