class Tile { PImage chunk; boolean dragged; float x,y; float offsetX, offsetY; float xset, yset; Tile(int thex, int they) { chunk = new PImage(w,h); x = thex; y = they; xset = thex; yset = they; dragged = false; } void render() { image(chunk,x,y); tint(255,0,0, 125); } void checkposition(float blobX, float blobY) { if ((blobX > x) && (blobX < x+w)) { if ((blobY > y) && (blobY < y+h)) { offsetX = blobX - x; offsetY = blobY - y; dragged = true; policeman = true; } } } void move() { if (dragged) { x = bx-offsetX; y = by-offsetY; } } void jiggle (float val) { //adjust sensitivity of response if(val < 0.1) { //set back to original location x = xset; y = yset; } else { float jiggler = (val*10)*random(-2,2); x = x+jiggler; y = y+jiggler; } } }