Cursor Craze

Here is my final project in all of its glory: Cursor Craze.

Can you get to the other side??? There’s only one way to find out!!!

I’m not exactly sure how to post a downloadable link to the full folder- but i’ll figure it out. For now, all of the images I used are in the “Media” library in WordPress.

Screen Shot 2014-05-05 at 1.42.20 PM

 

Here’s the code:

PImage  starthere;
PImage finishhere;
PImage title;
PImage rules;
PImage youlose;
PImage youlose27;
PImage youwin;
PImage pressq;

PImage almostthere;
PImage youcandoit;
PImage greatstart;
PImage keepitup;
PImage woo;

PImage greatstartcover;
PImage youcandoitcover;
PImage keepitupcover;
PImage woocover;
PImage almosttherecover;

int gap = 20;

void setup() {
  size (800, 400);
  background (204, 204, 204);
  starthere = loadImage("starhere.png");
  finishhere = loadImage("finishhere.png");
  title = loadImage("cursorcraze.png");
  rules = loadImage("mazerules2.0.png");
  youlose = loadImage("youlose2.png");
  youlose27 = loadImage("youlose27.png");
  youwin = loadImage("youwin.png");
  pressq = loadImage("pressQ.png");
  almostthere = loadImage("almostthere.png");
  youcandoit = loadImage("youcandoit.png");
  greatstart = loadImage("greatstart.png");
  keepitup = loadImage("keepitup.png");
  woo = loadImage("woo.png");
  greatstartcover = loadImage("greatstartcover.png");
  youcandoitcover= loadImage("youcandoitcover.png");
  keepitupcover = loadImage("keepitupcover.png");
  woocover = loadImage("woocover.png");
  almosttherecover = loadImage("almosttherecover.png");

  stroke (0);
  fill (0);
  //top and bottom
  //1
  rect (0, 0, gap, 160); 
  rect (0, 200, gap, 200); 
  //2
  rect (20, 0, gap, 160); 
  rect (20, 200, gap, 220); 
  //3
  rect (40, 0, gap, 140); 
  rect (40, 180, gap, 240); 
  //4
  rect (60, 0, gap, 120); 
  rect (60, 160, gap, 260); 
  //5
  rect (80, 0, gap, 100); 
  rect (80, 140, gap, 280); 
  //6
  rect (100, 0, gap, 100); 
  rect (100, 140, gap, 280); 
  //7
  rect (120, 0, gap, 120); 
  rect (120, 160, gap, 260); 
  //8
  rect (140, 0, gap, 140); 
  rect (140, 180, gap, 280); 
  //9
  rect (160, 0, gap, 160); 
  rect (160, 200, gap, 200); 
  //10
  rect (180, 0, gap, 180); 
  rect (180, 220, gap, 200); 
  //11
  rect (200, 0, gap, 200); 
  rect (200, 240, gap, 200); 
  //12
  rect (220, 0, gap, 220); 
  rect (220, 260, gap, 200);
  //13
  rect (240, 0, gap, 240); 
  rect (240, 280, gap, 200); 
  //14
  rect (260, 0, gap, 260); 
  rect (260, 300, gap, 200);
  //15
  rect (280, 0, gap, 280); 
  rect (280, 320, gap, 200); 
  //16
  rect (300, 0, gap, 300);
  rect (300, 340, gap, 200); 
  //17
  rect (320, 0, gap, 320); 
  rect (320, 360, gap, 200);
  //18
  rect (340, 0, gap, 320);
  rect (340, 360, gap, 200); 
  //19
  rect (360, 0, gap, 300);
  rect (360, 340, gap, 200);
  //20
  rect (380, 0, gap, 280);
  rect (380, 320, gap, 200); 
  //21
  rect (400, 0, gap, 260);
  rect (400, 300, gap, 200); 
  //22 
  rect (420, 0, gap, 240); 
  rect (420, 280, gap, 200);
  //23
  rect (440, 0, gap, 220); 
  rect (440, 260, gap, 200); 
  //24
  rect (460, 0, gap, 220); 
  rect (460, 260, gap, 200);
  //25
  rect (480, 0, gap, 240);
  rect (480, 280, gap, 200); 
  //26
  rect (500, 0, gap, 260);
  rect (500, 300, gap, 200); 
  //27
  rect (520, 0, gap, 280);
  rect (520, 320, gap, 200); 
  //28
  rect (540, 0, gap, 280);
  rect (540, 320, gap, 200);  
  //29
  rect (560, 0, gap, 260);
  rect (560, 300, gap, 200); 
  //30 
  rect (580, 0, gap, 240); 
  rect (580, 280, gap, 200); 
  //31
  rect (600, 0, gap, 220); 
  rect (600, 260, gap, 200); 
  //32
  rect (620, 0, gap, 200);
  rect (620, 240, gap, 220); 
  //33
  rect (640, 0, gap, 180);
  rect (640, 220, gap, 240); 
  //34
  rect (660, 0, gap, 160); 
  rect (660, 200, gap, 260);
  //35
  rect (680, 0, gap, 140);
  rect (680, 180, gap, 280); 
  //36
  rect (700, 0, gap, 120);
  rect (700, 160, gap, 300); 
  //37
  rect (720, 0, gap, 120);
  rect (720, 160, gap, 320);  
  //38
  rect (740, 0, gap, 140); 
  rect (740, 180, gap, 300);
  //39
  rect (760, 0, gap, 160);
  rect (760, 200, gap, 320); 
  //40
  rect (780, 0, gap, 160); 
  rect (780, 200, gap, 320); 

  image(starthere, 0, 200);
  image(finishhere, 700, 200);
  image(title, 210, 0);
  image(rules, 220, 70);
  image(pressq, 680, 5);
}

void draw() {

  if ((mouseX > 0 && mouseX < 20) && (mouseY < 160  || mouseY > 200)) {
    background (youlose);
  }

  else if ((mouseX > 20 && mouseX < 40 ) && (mouseY < 160 || mouseY > 200)) {
    background (youlose);
  }

  else if ((mouseX > 40 && mouseX < 60) && (mouseY < 140 || mouseY > 180)) {
    background (youlose);
  }

  else if ((mouseX > 60 && mouseX < 80) && (mouseY < 120 || mouseY > 160)) {
    background (youlose);
  }

  else if ((mouseX > 80 && mouseX < 100) && (mouseY < 100 || mouseY > 140)) {
    background (youlose);
  }

  else if ((mouseX > 80 && mouseX < 100) && (mouseY > 100 || mouseY < 140)) { 
    image(greatstart, 50, 75);
  }

  else if ((mouseX > 100 && mouseX < 120) && (mouseY < 100 || mouseY > 140)) {
    background (youlose);
  }

  else if ((mouseX > 120 && mouseX < 140) && (mouseY < 120 || mouseY > 160)) {
    background (youlose);
  }

  else if ((mouseX > 120 && mouseX < 140) && (mouseY > 120 || mouseY < 160)) {
    image (greatstartcover, 50, 75);
  }

  else if ((mouseX > 140 && mouseX < 160) && (mouseY < 140 || mouseY > 180)) {
    background (youlose);
  }

  else if ((mouseX > 160 && mouseX < 180) && (mouseY < 160 || mouseY > 200)) {
    background (youlose);
  }
  //10
  else if ((mouseX > 180 && mouseX < 200) && (mouseY < 180 || mouseY > 220)) {
    background (youlose);
  }

  else if ((mouseX > 200 && mouseX < 220) && (mouseY < 200 || mouseY > 240)) {
    background (youlose);
  }

  else if ((mouseX > 220 && mouseX < 240) && (mouseY < 220 || mouseY > 260)) {
    background (youlose);
  }

  else if ((mouseX > 240 && mouseX < 260) && (mouseY < 240 || mouseY > 280)) {
    background (youlose);
  }

  else if ((mouseX > 260 && mouseX < 280) && (mouseY < 260 || mouseY > 300)) {
    background (youlose);
  }

  else if ((mouseX > 280 && mouseX < 300) && (mouseY < 280 || mouseY > 320)) {
    background (youlose);
  }

  else if ((mouseX > 300 && mouseX < 320) && (mouseY < 300 || mouseY > 340)) {
    background (youlose);
  }

  else if ((mouseX > 320 && mouseX < 340) && (mouseY < 320 || mouseY > 360)) {
    background (youlose);
  }

  else if ((mouseX > 320 && mouseX < 340) && (mouseY > 320 || mouseY < 360)) {
    image(youcandoit, 310, 360) ;
  }

  else if ((mouseX > 340 && mouseX < 360) && (mouseY < 320 || mouseY > 360)) {
    background (youlose);
  }

  else if ((mouseX > 360 && mouseX < 380) && (mouseY < 300 || mouseY > 340)) {
    background (youlose);
  }

  else if ((mouseX > 360 && mouseX < 380) && (mouseY > 300 || mouseY < 340)) {
    image (youcandoitcover, 310, 360);
  }

  //20
  else if ((mouseX > 380 && mouseX < 400) && (mouseY < 280 || mouseY > 320)) {
    background (youlose);
  }

  else if ((mouseX > 400 && mouseX < 420) && (mouseY < 260 || mouseY > 300)) {
    background (youlose);
  }

  else if ((mouseX > 420 && mouseX < 440) && (mouseY < 240 || mouseY > 280)) {
    background (youlose);
  }

  else if ((mouseX > 440 && mouseX < 460) && (mouseY < 220 || mouseY > 260)) {
    background (youlose);
  }

  else if ((mouseX > 440 && mouseX < 460) && (mouseY > 220 || mouseY < 260)) {
    image (keepitup, 430, 180);
  }

  else if ((mouseX > 460 && mouseX < 480) && (mouseY < 220 || mouseY > 260)) {
    background (youlose);
  }

  else if ((mouseX > 480 && mouseX < 500) && (mouseY < 240 || mouseY > 280)) {
    background (youlose);
  }

  else if ((mouseX > 480 && mouseX < 500) && (mouseY > 240 || mouseY < 280)) {
    image (keepitupcover, 430, 180);
  }

  else if ((mouseX > 500 && mouseX < 520) && (mouseY < 260 || mouseY > 300)) {
    background (youlose);
  }
  //27
  else if ((mouseX > 520 && mouseX < 540) && (mouseY < 280 || mouseY > 320)) {
    background (youlose27);
  }

  else if ((mouseX > 520 && mouseX < 540) && (mouseY > 280 || mouseY < 320)) {
    image (woo, 520, 320);
  }

  else if ((mouseX > 540 && mouseX < 560) && (mouseY < 280 || mouseY > 320)) {
    background (youlose);
  }

  else if ((mouseX > 560 && mouseX < 580) && (mouseY < 260 || mouseY > 300)) {
    background (youlose);
  }

  else if ((mouseX > 560 && mouseX < 580) && (mouseY > 260 || mouseY < 300)) {
    image (woocover, 520, 320);
  }

  //30
  else if ((mouseX > 580 && mouseX < 600) && (mouseY < 240 || mouseY > 280)) {
    background (youlose);
  }

  else if ((mouseX > 600 && mouseX < 620) && (mouseY < 220 || mouseY > 260)) {
    background (youlose);
  }

  else if ((mouseX > 640 && mouseX < 660) && (mouseY < 180 || mouseY > 220)) {
    background (youlose);
  }

  else if ((mouseX > 660 && mouseX < 680) && (mouseY < 160 || mouseY > 200)) {
    background (youlose);
  }

  else if ((mouseX > 680 && mouseX < 700) && (mouseY < 140 || mouseY > 180)) {
    background (youlose);
  }

  else if ((mouseX > 700 && mouseX < 720) && (mouseY < 120 || mouseY > 160)) {
    background (youlose);
  }

  else if ((mouseX > 700 && mouseX < 720) && (mouseY > 120 || mouseY < 160)) {
    image(almostthere, 690, 85);
  }

  else if ((mouseX > 720 && mouseX < 740) && (mouseY < 120 || mouseY > 160)) {
    background (youlose);
  }

  else if ((mouseX > 740 && mouseX < 760) && (mouseY < 140 || mouseY > 180)) {
    background (youlose);
  }

  else if ((mouseX > 740 && mouseX < 760) && (mouseY > 140 || mouseY < 180)) {
    image (almosttherecover, 690, 85);
  }

  //final 2 boxes
  else if ((mouseX > 760 && mouseX < 780) && (mouseY < 160 || mouseY > 200)) {
    background (youlose);
  }
  //40
  else if ((mouseX > 780 && mouseX < 800) && (mouseY < 160 || mouseY > 200)) {
    background (youlose);
  }

  else if ((mouseX > 760 && mouseX < 780) && (mouseY > 160 || mouseY < 200)) {
    background (youwin);
  }

  else if ((mouseX > 780 && mouseX < 800) && (mouseY > 160 || mouseY < 200)) {
    background (youwin);
  }

  if (keyPressed) {
    if (key == 'q') {
      background (204, 204, 204);
      stroke (0);
      fill (0);
      //top and bottom
      //1
      rect (0, 0, gap, 160); 
      rect (0, 200, gap, 200); 
      //2
      rect (20, 0, gap, 160); 
      rect (20, 200, gap, 220); 
      //3
      rect (40, 0, gap, 140); 
      rect (40, 180, gap, 240); 
      //4
      rect (60, 0, gap, 120); 
      rect (60, 160, gap, 260); 
      //5
      rect (80, 0, gap, 100); 
      rect (80, 140, gap, 280); 
      //6
      rect (100, 0, gap, 100); 
      rect (100, 140, gap, 280); 
      //7
      rect (120, 0, gap, 120); 
      rect (120, 160, gap, 260); 
      //8
      rect (140, 0, gap, 140); 
      rect (140, 180, gap, 280); 
      //9
      rect (160, 0, gap, 160); 
      rect (160, 200, gap, 200); 
      //10
      rect (180, 0, gap, 180); 
      rect (180, 220, gap, 200); 
      //11
      rect (200, 0, gap, 200); 
      rect (200, 240, gap, 200); 
      //12
      rect (220, 0, gap, 220); 
      rect (220, 260, gap, 200);
      //13
      rect (240, 0, gap, 240); 
      rect (240, 280, gap, 200); 
      //14
      rect (260, 0, gap, 260); 
      rect (260, 300, gap, 200);
      //15
      rect (280, 0, gap, 280); 
      rect (280, 320, gap, 200); 
      //16
      rect (300, 0, gap, 300);
      rect (300, 340, gap, 200); 
      //17
      rect (320, 0, gap, 320); 
      rect (320, 360, gap, 200);
      //18
      rect (340, 0, gap, 320);
      rect (340, 360, gap, 200); 
      //19
      rect (360, 0, gap, 300);
      rect (360, 340, gap, 200);
      //20
      rect (380, 0, gap, 280);
      rect (380, 320, gap, 200); 
      //21
      rect (400, 0, gap, 260);
      rect (400, 300, gap, 200); 
      //22 
      rect (420, 0, gap, 240); 
      rect (420, 280, gap, 200);
      //23
      rect (440, 0, gap, 220); 
      rect (440, 260, gap, 200); 
      //24
      rect (460, 0, gap, 220); 
      rect (460, 260, gap, 200);
      //25
      rect (480, 0, gap, 240);
      rect (480, 280, gap, 200); 
      //26
      rect (500, 0, gap, 260);
      rect (500, 300, gap, 200); 
      //27
      rect (520, 0, gap, 280);
      rect (520, 320, gap, 200); 
      //28
      rect (540, 0, gap, 280);
      rect (540, 320, gap, 200);  
      //29
      rect (560, 0, gap, 260);
      rect (560, 300, gap, 200); 
      //30 
      rect (580, 0, gap, 240); 
      rect (580, 280, gap, 200); 
      //31
      rect (600, 0, gap, 220); 
      rect (600, 260, gap, 200); 
      //32
      rect (620, 0, gap, 200);
      rect (620, 240, gap, 220); 
      //33
      rect (640, 0, gap, 180);
      rect (640, 220, gap, 240); 
      //34
      rect (660, 0, gap, 160); 
      rect (660, 200, gap, 260);
      //35
      rect (680, 0, gap, 140);
      rect (680, 180, gap, 280); 
      //36
      rect (700, 0, gap, 120);
      rect (700, 160, gap, 300); 
      //37
      rect (720, 0, gap, 120);
      rect (720, 160, gap, 320);  
      //38
      rect (740, 0, gap, 140); 
      rect (740, 180, gap, 300);
      //39
      rect (760, 0, gap, 160);
      rect (760, 200, gap, 320); 
      //40
      rect (780, 0, gap, 160); 
      rect (780, 200, gap, 320); 

      image(starthere, 0, 200);
      image(finishhere, 700, 200);
      image(title, 210, 0);
      image(rules, 220, 70);
      image(pressq, 680, 5);
    }
  }
}

Food for thought:

– would be great to add a timer

– would be even greater to have the map move

– Different levels would be awesome

 

 

Leave a Reply