Ji : Midterm

mt

Here is my sketch for midterm.

http://www.openprocessing.org/sketch/116891

You can click the lightning bugs to give them light!

I limited the area so you can only click the inside of the jar, and the lights will be cleared after you click 11 bugs.

Code:

PImage img;
int x;
int y;

int dot= 0;// save the number of the bubble
int [] mox= new int[12];// make a list of 20 that contains a new bubble’s xaxis
int [] my= new int[12];// make a list  of  20 that contains a new bubble’s xaxis
boolean light;

void setup() {
size(457, 658);
img = loadImage(“night.jpg”);
//  imageMode(CENTER);
noStroke();
}

void draw() {
image(img, 0, 0);

if (light==true) {
fill(237, 248, 170, 30);
for (int i=1; i < dot+1; i++) {
for (int j=7; j < 100; j+=7) {
float r= random(10);

ellipse( mox[i], my[i], j+r, j+r);
}
}
}
}

void mouseReleased() { // checking mouse released
if (mouseX > 120 && mouseY > 120 && mouseX < 380 && mouseY < 530 ) // set the limit
{
dot++; //increase the dot number
light=true; // switch on your blue ellipse

if (dot>=12) {// don’t let dot be greater than the number of values in the mox and my arrays
dot=0;
}

else

{

mox [dot]= mouseX; // make the next value of mox the current mouseX and mouseY positions

my [dot]= mouseY;
}
}
}

78 thoughts on “Ji : Midterm

  1. Kelly Woo

    Hey! Would you mind if I share your blog with my zynga group? There’s a lot of people that I think would really appreciate your content. Please let me know. Cheers|

  2. Curtis Nist

    Hi there this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get advice from someone with experience. Any help would be enormously appreciated!|

  3. Maxwell Harvilla

    When I initially left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I recieve 4 emails with the exact same comment. Is there a way you can remove me from that service? Many thanks!|

Leave a Reply

Your email address will not be published.