fork download
  1. String pageText;
  2. PImage nightWatchman;
  3. PImage tree1;
  4. PImage background;
  5. Boolean eyeLids = false;
  6. float tLidPos; //top eyelid position
  7. float bLidPos; //bottom eyelid position
  8. float bookXPos; //book position along shelves
  9. float bookYPos; //shelf position
  10. float bookHeight = 0;
  11. Boolean books = true;
  12. float count=0;
  13.  
  14. float[] bookList;
  15.  
  16.  
  17. void setup() {
  18. size(800, 800);
  19. background(150, 0, 0);
  20. nightWatchman = loadImage("nightWatchman2.png");
  21. background = loadImage("background.png");
  22. tree1 = loadImage("tree1.png");
  23. }
  24.  
  25. void draw() {
  26. noStroke();
  27. image(background, 0, 0);
  28.  
  29. //books
  30. drawBooks();
  31.  
  32. //eyes
  33. fill(255);
  34. ellipse(655, 287, 35, 35);
  35. ellipse(703, 287, 35, 35);
  36. fill(0);
  37. ellipse(655, 287, 15, 15);
  38. ellipse(703, 287, 15, 15);
  39.  
  40. //eyeLids
  41. fill(230, 198, 177);
  42. if (eyeLids == true) {
  43. for (int i=0; i<20; i++) {
  44. //top eyelids
  45. tLidPos = 251+i;
  46. rect(638, tLidPos, 35, 20);
  47. rect(686, tLidPos, 35, 20);
  48. }
  49. for (int b=0; b<15; b++) {
  50. //bottom eyelids
  51. bLidPos = 304-b;
  52. stroke(200, 156, 132);
  53. rect(638, bLidPos, 35, 15);
  54. rect(686, bLidPos, 35, 15);
  55. }
  56. }
  57.  
  58. //night watchman
  59. image(nightWatchman, 0, 0);
  60.  
  61. //text box and text
  62. fill(255);
  63. rect(50, 600, 700, 150);
  64. fill(0);
  65. pageText = " hen the library is closed and the night watchman has fallen asleep ";
  66. pageText += "in his big armchair, the shelves come to life. Doors and windows appear on ";
  67. pageText += "the backs of the books, lights come on, and the sound of voices drifts out ";
  68. pageText += "between the pages. Full grown trees spring up and chimneys begin to smoke. ";
  69. pageText += "Staircases and ladders join the shelves into great cities, and in the distance ";
  70. pageText += "small dogs bark.";
  71. textSize(27);
  72. text("W", 71, 635);
  73. textSize(15);
  74. text(pageText, 70, 620, 670, 140);
  75.  
  76. noStroke();
  77. ellipse(mouseX, mouseY, 30, 30);
  78. }
  79.  
  80. void mouseClicked() {
  81. if (mouseX >= 544 && mouseX <=800 && mouseY >=200 && mouseY<800) {
  82. eyeLids = true;
  83. count++;
  84. redraw();
  85. }
  86. }
  87.  
  88. void drawWindow(float x, float y) {
  89. fill(255, 232, 71);
  90. rect(x, y, 20, 30);
  91. stroke(111, 71, 23);
  92. line(x, y, x+20, y);
  93. line(x, y+30, x+20, y+30);
  94. line(x, y, x, y+30);
  95. line(x+20, y, x+20, y+30);
  96. line(x+10, y, x+10, y+30);
  97. line(x, y+15, x+20, y+15);
  98. }
  99.  
  100. void drawBooks() {
  101. for (int j=0; j<17; j++) {
  102. for (int n=0; n<3; n++) {
  103. fill(random(100, 255), 101, 100);
  104. bookXPos = j*44 +27;
  105. bookYPos = n*255 +258;
  106.  
  107. bookHeight = random(190, 221);
  108.  
  109. bookList = new float[17];
  110. bookList[0] = bookHeight;
  111. bookList[1] = bookHeight;
  112. bookList[2] = bookHeight;
  113. bookList[3] = bookHeight;
  114. bookList[4] = bookHeight;
  115. bookList[5] = bookHeight;
  116. bookList[6] = bookHeight;
  117. bookList[7] = bookHeight;
  118. bookList[8] = bookHeight;
  119. bookList[9] = bookHeight;
  120. bookList[10] = bookHeight;
  121. bookList[11] = bookHeight;
  122. bookList[12] = bookHeight;
  123. bookList[13] = bookHeight;
  124. bookList[14] = bookHeight;
  125. bookList[15] = bookHeight;
  126. bookList[16] = bookHeight;
  127.  
  128.  
  129. //tells the program not to draw books between these coordinates
  130. if (bookXPos >= 150 && bookXPos <=320 && bookYPos >= 283 && bookYPos <= 514) {
  131. books=false;
  132. }
  133. else {
  134. books=true;
  135. }
  136.  
  137. //everywhere else, draw books
  138. if (books == true) {
  139. rect(bookXPos, bookYPos-bookList[j], 40, bookList[j]);
  140. }
  141. }
  142. }
  143. noLoop();
  144. }
  145.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
String pageText;
^
Main.java:2: error: class, interface, or enum expected
PImage nightWatchman;
^
Main.java:3: error: class, interface, or enum expected
PImage tree1;
^
Main.java:4: error: class, interface, or enum expected
PImage background;
^
Main.java:5: error: class, interface, or enum expected
Boolean eyeLids = false;
^
Main.java:6: error: class, interface, or enum expected
float tLidPos; //top eyelid position
^
Main.java:7: error: class, interface, or enum expected
float bLidPos; //bottom eyelid position
^
Main.java:8: error: class, interface, or enum expected
float bookXPos; //book position along shelves
^
Main.java:9: error: class, interface, or enum expected
float bookYPos; //shelf position
^
Main.java:10: error: class, interface, or enum expected
float bookHeight = 0;
^
Main.java:11: error: class, interface, or enum expected
Boolean books = true;
^
Main.java:12: error: class, interface, or enum expected
float count=0;
^
Main.java:14: error: class, interface, or enum expected
float[] bookList;
^
Main.java:17: error: class, interface, or enum expected
void setup() {
^
Main.java:19: error: class, interface, or enum expected
  background(150, 0, 0);
  ^
Main.java:20: error: class, interface, or enum expected
  nightWatchman = loadImage("nightWatchman2.png");
  ^
Main.java:21: error: class, interface, or enum expected
  background = loadImage("background.png");
  ^
Main.java:22: error: class, interface, or enum expected
  tree1 = loadImage("tree1.png");
  ^
Main.java:23: error: class, interface, or enum expected
}
^
Main.java:27: error: class, interface, or enum expected
  image(background, 0, 0);
  ^
Main.java:30: error: class, interface, or enum expected
  drawBooks();
  ^
Main.java:33: error: class, interface, or enum expected
  fill(255);
  ^
Main.java:34: error: class, interface, or enum expected
  ellipse(655, 287, 35, 35);
  ^
Main.java:35: error: class, interface, or enum expected
  ellipse(703, 287, 35, 35);
  ^
Main.java:36: error: class, interface, or enum expected
  fill(0);
  ^
Main.java:37: error: class, interface, or enum expected
  ellipse(655, 287, 15, 15);
  ^
Main.java:38: error: class, interface, or enum expected
  ellipse(703, 287, 15, 15);
  ^
Main.java:41: error: class, interface, or enum expected
  fill(230, 198, 177);
  ^
Main.java:42: error: class, interface, or enum expected
  if (eyeLids == true) {
  ^
Main.java:43: error: class, interface, or enum expected
    for (int i=0; i<20; i++) {
                  ^
Main.java:43: error: class, interface, or enum expected
    for (int i=0; i<20; i++) {
                        ^
Main.java:46: error: class, interface, or enum expected
      rect(638, tLidPos, 35, 20);
      ^
Main.java:47: error: class, interface, or enum expected
      rect(686, tLidPos, 35, 20);
      ^
Main.java:48: error: class, interface, or enum expected
    }
    ^
Main.java:49: error: class, interface, or enum expected
    for (int b=0; b<15; b++) {
                  ^
Main.java:49: error: class, interface, or enum expected
    for (int b=0; b<15; b++) {
                        ^
Main.java:52: error: class, interface, or enum expected
      stroke(200, 156, 132);
      ^
Main.java:53: error: class, interface, or enum expected
      rect(638, bLidPos, 35, 15);
      ^
Main.java:54: error: class, interface, or enum expected
      rect(686, bLidPos, 35, 15);
      ^
Main.java:55: error: class, interface, or enum expected
    }
    ^
Main.java:62: error: class, interface, or enum expected
  fill(255);
  ^
Main.java:63: error: class, interface, or enum expected
  rect(50, 600, 700, 150);
  ^
Main.java:64: error: class, interface, or enum expected
  fill(0);
  ^
Main.java:65: error: class, interface, or enum expected
  pageText = "     hen the library is closed and the night watchman has fallen asleep ";
  ^
Main.java:66: error: class, interface, or enum expected
  pageText += "in his big armchair, the shelves come to life. Doors and windows appear on ";
  ^
Main.java:67: error: class, interface, or enum expected
  pageText += "the backs of the books, lights come on, and the sound of voices drifts out ";
  ^
Main.java:68: error: class, interface, or enum expected
  pageText += "between the pages. Full grown trees spring up and chimneys begin to smoke. ";
  ^
Main.java:69: error: class, interface, or enum expected
  pageText += "Staircases and ladders join the shelves into great cities, and in the distance ";
  ^
Main.java:70: error: class, interface, or enum expected
  pageText += "small dogs bark.";
  ^
Main.java:71: error: class, interface, or enum expected
  textSize(27);
  ^
Main.java:72: error: class, interface, or enum expected
  text("W", 71, 635);
  ^
Main.java:73: error: class, interface, or enum expected
  textSize(15);
  ^
Main.java:74: error: class, interface, or enum expected
  text(pageText, 70, 620, 670, 140);
  ^
Main.java:76: error: class, interface, or enum expected
  noStroke();
  ^
Main.java:77: error: class, interface, or enum expected
  ellipse(mouseX, mouseY, 30, 30);
  ^
Main.java:78: error: class, interface, or enum expected
}
^
Main.java:83: error: class, interface, or enum expected
    count++;
    ^
Main.java:84: error: class, interface, or enum expected
    redraw();
    ^
Main.java:85: error: class, interface, or enum expected
  }
  ^
Main.java:90: error: class, interface, or enum expected
  rect(x, y, 20, 30);
  ^
Main.java:91: error: class, interface, or enum expected
  stroke(111, 71, 23);
  ^
Main.java:92: error: class, interface, or enum expected
  line(x, y, x+20, y);
  ^
Main.java:93: error: class, interface, or enum expected
  line(x, y+30, x+20, y+30);
  ^
Main.java:94: error: class, interface, or enum expected
  line(x, y, x, y+30);
  ^
Main.java:95: error: class, interface, or enum expected
  line(x+20, y, x+20, y+30);
  ^
Main.java:96: error: class, interface, or enum expected
  line(x+10, y, x+10, y+30);
  ^
Main.java:97: error: class, interface, or enum expected
  line(x, y+15, x+20, y+15);
  ^
Main.java:98: error: class, interface, or enum expected
}
^
Main.java:101: error: class, interface, or enum expected
  for (int j=0; j<17; j++) {
                ^
Main.java:101: error: class, interface, or enum expected
  for (int j=0; j<17; j++) {
                      ^
Main.java:102: error: class, interface, or enum expected
    for (int n=0; n<3; n++) {
                  ^
Main.java:102: error: class, interface, or enum expected
    for (int n=0; n<3; n++) {
                       ^
Main.java:104: error: class, interface, or enum expected
      bookXPos = j*44 +27;
      ^
Main.java:105: error: class, interface, or enum expected
      bookYPos = n*255 +258;
      ^
Main.java:107: error: class, interface, or enum expected
      bookHeight = random(190, 221);
      ^
Main.java:109: error: class, interface, or enum expected
      bookList = new float[17];
      ^
Main.java:110: error: class, interface, or enum expected
      bookList[0] = bookHeight;
      ^
Main.java:111: error: class, interface, or enum expected
      bookList[1] = bookHeight; 
      ^
Main.java:112: error: class, interface, or enum expected
      bookList[2] = bookHeight; 
      ^
Main.java:113: error: class, interface, or enum expected
      bookList[3] = bookHeight; 
      ^
Main.java:114: error: class, interface, or enum expected
      bookList[4] = bookHeight; 
      ^
Main.java:115: error: class, interface, or enum expected
      bookList[5] = bookHeight; 
      ^
Main.java:116: error: class, interface, or enum expected
      bookList[6] = bookHeight; 
      ^
Main.java:117: error: class, interface, or enum expected
      bookList[7] = bookHeight; 
      ^
Main.java:118: error: class, interface, or enum expected
      bookList[8] = bookHeight; 
      ^
Main.java:119: error: class, interface, or enum expected
      bookList[9] = bookHeight; 
      ^
Main.java:120: error: class, interface, or enum expected
      bookList[10] = bookHeight; 
      ^
Main.java:121: error: class, interface, or enum expected
      bookList[11] = bookHeight; 
      ^
Main.java:122: error: class, interface, or enum expected
      bookList[12] = bookHeight; 
      ^
Main.java:123: error: class, interface, or enum expected
      bookList[13] = bookHeight;
      ^
Main.java:124: error: class, interface, or enum expected
      bookList[14] = bookHeight;
      ^
Main.java:125: error: class, interface, or enum expected
      bookList[15] = bookHeight;
      ^
Main.java:126: error: class, interface, or enum expected
      bookList[16] = bookHeight;
      ^
Main.java:130: error: class, interface, or enum expected
      if (bookXPos >= 150 && bookXPos <=320 && bookYPos >= 283 && bookYPos <= 514) {
      ^
Main.java:132: error: class, interface, or enum expected
      }
      ^
Main.java:135: error: class, interface, or enum expected
      }
      ^
Main.java:140: error: class, interface, or enum expected
      }
      ^
Main.java:144: error: class, interface, or enum expected
}
^
98 errors
stdout
Standard output is empty