final int WORLD_SIZE = 300; final int PARTICLE_SIZE = 30; final int DRIFT = 5; final int VALUE_RANGE = 300; final int WALL_SIZE = 15; final int TRANSPARENCY = 200; final int RATE = 30; int mx; int my; final float SPEED = 5; int numParticles = 5; int numWalls = ((WORLD_SIZE/WALL_SIZE)-1); int numConnectors = ((numParticles*(numParticles-1))/2); Particle particles[]=new Particle[numParticles]; Wall walls[][]=new Wall[numWalls][numWalls]; void setup() { framerate(RATE); size(300,300); ellipseMode(CENTER_DIAMETER); colorMode(HSB, 300); for (int i=0;i width) { vX = -vX; } if (posY - PARTICLE_SIZE/2 < 0 || posY + PARTICLE_SIZE/2 > height) { vY = -vY; } } void draw(){ stroke(0); fill(h,s,b,TRANSPARENCY); ellipse(posX,posY,PARTICLE_SIZE,PARTICLE_SIZE); } } class Wall{ int wallX; int wallY; boolean wallExists; void updateWall(){ wallX = mx; wallY = my; } void drawWall(){ noStroke(); fill(200,200); if (wallExists == true){ rect(wallX,wallY,WALL_SIZE,WALL_SIZE); } } } void mousePressed(){ if(walls[mouseX/WALL_SIZE][mouseY/WALL_SIZE].wallExists == false){ walls[mouseX/WALL_SIZE][mouseY/WALL_SIZE].wallExists = true; }else{ walls[mouseX/WALL_SIZE][mouseY/WALL_SIZE].wallExists = false; } }