Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. var words1 = ["banana", "coffee", "computer"];
  2. var words2 = ["pb+J", "foosball", "plants"];
  3. var words3= ["moon", "lockers", "Midori"];
  4.  
  5. var verb = ["has", "wants", "eats"]
  6. var prep = ["with", "on", "under"]
  7.  
  8.  
  9. var index = 0;
  10.  
  11.  
  12.  
  13.  
  14. function preload(){
  15. //images1
  16. banana = loadImage("images/banana.jpg");
  17. coffee = loadImage("images/coffee.jpg");
  18. computer = loadImage("images/computer.jpg");
  19.  
  20. //images2
  21. pbj = loadImage("images/pbj.jpg")
  22. foosball = loadImage("images/foosball.jpg");
  23. plant = loadImage("images/plant.jpg");
  24.  
  25. //images3
  26. moon = loadImage("images/moon.jpg")
  27. midori = loadImage("images/midori.jpg");
  28. locker = loadImage("images/locker.jpg");
  29.  
  30. }
  31.  
  32.  
  33.  
  34. function setup() {
  35. createCanvas(700,700);
  36. fill(0);
  37. textSize(32);
  38.  
  39.  
  40. }
  41.  
  42.  
  43.  
  44.  
  45. function mousePressed(){
  46.  
  47. //set1
  48. index = index + 1;
  49. if (index == words1.length) {
  50. index = 0;
  51. }
  52.  
  53. if (index == images1.length) {
  54. index = 0;
  55. }
  56.  
  57.  
  58. //verb
  59. index = index + 1;
  60. if (index == verb.length) {
  61. index = 0;
  62. }
  63.  
  64.  
  65. //set2
  66. if (index == words2.length) {
  67. index = 0;
  68. }
  69.  
  70. if (index == images2.length) {
  71. index = 0;
  72. }
  73.  
  74. //prep
  75. index = index + 1;
  76. if (index == prep.length) {
  77. index = 0;
  78. }
  79.  
  80. //set3
  81. if (index == words3.length) {
  82. index = 0;
  83. }
  84.  
  85. if (index == images3.length) {
  86. index = 0;
  87. }
  88. }
  89.  
  90.  
  91.  
  92.  
  93. function draw() {
  94. background(255);
  95. textAlign(CENTER);
  96. text(words1[index], 100, 400);
  97. text(verb[index], 200, 400);
  98. text(words2[index], 300, 400);
  99. text(prep[index], 400, 400);
  100. text(words3[index], 500, 400);
  101.  
  102. var images1 = [banana, coffee, computer];
  103. image(images1[index], 100, 100, 100, 100);
  104. //image(image,[x=0],[y=0],[width],[height])
  105.  
  106. var images2 = [pbj, foosball, plant];
  107. image(images2[index], 300, 100, 100, 100);
  108.  
  109. var images3 = [moon, locker, midori];
  110. image(images3[index], 500, 100, 100, 100);
  111.  
  112. }
  113.  
  114. // //set1
  115. // index = index + 1;
  116. // if (index == words1.length) {
  117. // index = 0;
  118. // }
  119.  
  120. // if (index == images1.length) {
  121. // index = 0;
  122. // }
  123.  
  124.  
  125. // //verb
  126. // index = index + 1;
  127. // if (index == verb.length) {
  128. // index = 0;
  129. // }
  130.  
  131.  
  132. // //set2
  133. // if (index == words2.length) {
  134. // index = 0;
  135. // }
  136.  
  137. // if (index == images2.length) {
  138. // index = 0;
  139. // }
  140.  
  141. // //prep
  142. // index = index + 1;
  143. // if (index == prep.length) {
  144. // index = 0;
  145. // }
  146.  
  147. // //set3
  148. // if (index == words3.length) {
  149. // index = 0;
  150. // }
  151.  
  152. // if (index == images3.length) {
  153. // index = 0;
  154. // }
  155.  
  156. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement