def setup(): size(500, 500) stroke(50, 50, 250) fill(150, 150, 250) rectMode(CENTER) global x, y, c x = [] y = [] c = [] def draw(): background(255) i = 0 while i <= len(x)-1: fill( c[i] ) rect(x[i], y[i], 25, 25) x[i] = x[i] + random(-5,5) y[i] = y[i] + random(-5,5) i = i + 1 def mousePressed(): x.append(200) y.append(200) r = random(0,255) g = random(0,255) b = random(0,255) c.append( color(r,g,b) ) print( len(x) )