import controlP5.*; PShape newyork; PShape ashape; int kids; int[] randi; ArrayList alist; JakeButton SampleButton; void setup() { size(750, 600); smooth(); // svg is in the public domain newyork = loadShape("NewYork.svg"); kids = newyork.getChildCount()-2; alist = new ArrayList(kids); for (int j = 1; j <= kids; j++) alist.add(j); Collections.shuffle(alist); randi = new int[4]; for (int j = 0; j < 4; j++) randi[j] = (Integer)alist.get(j); PImage[] imageset = {loadImage("samplemedark.jpg"), loadImage("samplemelight.jpg")}; SampleButton = new JakeButton(250, 450, imageset[1],imageset[0],imageset[0]); } void draw() { background(255); //newyork.disableStyle(); //fill(0,100,100); // noStroke(); shape(newyork, 50, 50); for (int j = 0; j < 4; j++) { ashape = newyork.getChild(randi[j]); ashape.disableStyle(); fill(0, 0, 255); shape(ashape, 50, 50); } SampleButton.updateButton(); SampleButton.drawButton(); if(SampleButton.clicked) { for (int j = 0; j < 4; j++) { ashape = newyork.getChild(randi[j]); ashape.enableStyle(); } Collections.shuffle(alist); for (int j = 0; j < 4; j++) randi[j] = (Integer)alist.get(j); } }