Advertisement
mitchellvette

ProbeDroid Array

Apr 20th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ProbeDroid droids;
  2. int num = 10;
  3. int [] x = new int[num];
  4. int [] y = new int[num];
  5.  
  6. void setup(){
  7.   size(512, 512);
  8.   smooth();
  9.   strokeWeight(1);
  10. }
  11.  
  12. void draw() {
  13.   background(25);
  14.  
  15.   for(int i = x.length - 1; i > 0; i--){
  16.     x[i] = x[i-1];
  17.     y[i] = y[i-1];
  18.   }
  19.  
  20.   x[0] = mouseX;
  21.   y[0] = mouseY;
  22.  
  23.   for (int i = 0; i < x.length; i++){
  24.      droids = new ProbeDroid(-64 + x[i], -16 + y[i], .25);
  25.      droids.display();
  26.   }
  27.  
  28. }
  29.  
  30. class ProbeDroid {
  31. int xpos;
  32. int ypos;
  33. float scalar;
  34. float bodyWidth = 140;
  35. float bodyHeight = 420;
  36.  
  37. ProbeDroid(int x, int y, float s){
  38.   xpos = x;
  39.   ypos = y;
  40.   scalar = s;
  41. }
  42.  
  43. void display(){
  44.    pushMatrix();
  45.    translate(xpos, ypos);
  46.    scale(scalar);
  47.     fill(#465042);
  48.    //head and neck
  49.    rect(230, 70, 52, 30);
  50.    arc(256, 64, bodyWidth* 0.9, bodyHeight*.13, PI, TWO_PI);
  51.    arc(256, 64, bodyWidth *0.9, bodyHeight *.07, TWO_PI, PI+TWO_PI);
  52.    arc(256, 100, bodyWidth, bodyHeight*.07, PI, TWO_PI);
  53.    
  54.       //"arms"
  55.    rect(256 - bodyWidth/3, 125, 94, 10);
  56.    quad(248, 142, 270, 142, 280, 195, 266, 200);
  57.    quad(262, 195, 280, 195, 220, 230, 210, 230);
  58.    rect(215, 230, 55, 6);
  59.    rect(270, 215, 6, 35);
  60.    ellipse(260, 142, 25, 25);
  61.    ellipse(272, 195, 18, 18);
  62.    ellipse(215, 232, 15, 15);
  63.    ellipse(273, 233, 12, 12);
  64.    
  65.    quad(210, 130, 220, 130, 218, 140, 208, 140);
  66.    quad(210, 145, 220, 145, 240, 155, 230, 155);
  67.    strokeWeight(2);
  68.       line(238, 155, 238, 195);
  69.    strokeWeight(1);
  70.       line(234, 155, 234, 195);
  71.    quad(235, 195, 240, 198, 220, 215, 210, 200);
  72.    ellipse(213, 143, 12, 12);
  73.    ellipse(235, 155, 12, 12);
  74.    ellipse(235, 195, 12, 12);
  75.    
  76.    quad(290, 130, 300, 130, 300, 145, 290, 145);
  77.    quad(290, 145, 300, 145, 325, 158, 320, 160);
  78.    strokeWeight(2);
  79.    line(322, 160, 315, 190);
  80.    strokeWeight(1);
  81.    quad(315, 190, 315, 195, 300, 200, 295, 190);
  82.    ellipse(295, 145, 12, 12);
  83.    ellipse(322, 160, 10, 10);
  84.    ellipse(315, 190, 8, 8);
  85.    
  86.    //body mass
  87.    quad(256 - bodyWidth/2, 100.0, 256 + bodyWidth/2, 100.0,
  88.          256 + (bodyWidth/2)*0.8, 130.0, 256 - (bodyWidth/2)*0.8, 130.0);
  89.    quad(256 - bodyWidth/4.5, 35, 256 + bodyWidth/4.5, 35,
  90.          256 + bodyWidth/3.5, 42, 256 - bodyWidth/3.5, 42);
  91.    quad(256, 102, 256 + bodyWidth/5, 102, 256+bodyWidth/5, 132, 256, 132);
  92.    
  93.    //head details 1
  94.    arc(256 + bodyWidth*.05, 35, bodyWidth*.25, 10, PI, TWO_PI);
  95.    rect(235, 15, 3, 20);
  96.    rect(230, 20, 3, 15);
  97.    
  98.    //draw the eyes
  99.    fill(0);
  100.    arc(256 - bodyWidth *.36, 60, 28, 25, HALF_PI, PI+HALF_PI);
  101.    ellipse(256 - bodyWidth/3, 58, 10, 10);
  102.    ellipse(256 - bodyWidth/6, 64, 18, 18);
  103.    ellipse(256 + bodyWidth/6, 60, 22, 22);
  104.    arc(256 + bodyWidth/2.5, 62, 16, 16, PI+HALF_PI, TWO_PI+HALF_PI);
  105.    popMatrix();
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement