Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.47 KB | None | 0 0
  1. var lives = 7;
  2. var score = 0;
  3. var x3 = ["68", "150", "230"];
  4. var x = ["51", "146", "250"];
  5. var y = ["185", "316"];
  6. var y2 = ["145", "265", "385",];
  7. setScreen("homescreen");
  8. onEvent("Howtoscreen", "click", function() {
  9. setScreen("How To Play");
  10. });
  11. onEvent("Back", "click", function() {
  12. setScreen("homescreen");
  13. });
  14. onEvent("Start", "click", function() {
  15. setScreen("Level#1");
  16. hide();
  17. setText("Lives#1", lives);
  18. setText("Score#1", score);
  19. setPosition("Apple#1", x [(randomNumber(0, 2))], 225);
  20. });
  21. onEvent("Card#1", "click", function() {
  22. hideElement("Card#1");
  23. });
  24. onEvent("Card#2", "click", function() {
  25. hideElement("Card#2");
  26. });
  27. onEvent("Card#3", "click", function() {
  28. hideElement("Card#3");
  29. });
  30. onEvent("Card#4", "click", function() {
  31. hideElement("Card#4");
  32. });
  33. onEvent("Card#5", "click", function() {
  34. hideElement("Card#5");
  35. });
  36. onEvent("Card#6", "click", function() {
  37. hideElement("Card#6");
  38. });
  39. onEvent("Card#7", "click", function() {
  40. hideElement("Card#7");
  41. });
  42. onEvent("Card#8", "click", function() {
  43. hideElement("Card#8");
  44. });
  45. onEvent("Card#9", "click", function() {
  46. hideElement("Card#9");
  47. });
  48. onEvent("Card#10", "click", function() {
  49. hideElement("Card#10");
  50. });
  51. onEvent("Card#11", "click", function() {
  52. hideElement("Card#11");
  53. });
  54. onEvent("Card#12", "click", function() {
  55. hideElement("Card#12");
  56. });
  57. onEvent("Card#13", "click", function() {
  58. hideElement("Card#13");
  59. });
  60. onEvent("Card#14", "click", function() {
  61. hideElement("Card#14");
  62. });
  63. onEvent("Card#15", "click", function() {
  64. hideElement("Card#15");
  65. });
  66. onEvent("Card#16", "click", function() {
  67. hideElement("Card#16");
  68. });
  69. onEvent("Card#17", "click", function() {
  70. hideElement("Card#17");
  71. });
  72. onEvent("Card#18", "click", function() {
  73. hideElement("Card#18");
  74. });
  75.  
  76. onEvent("Level#1", "click", function() {
  77. lives = lives-1;
  78. setText("Lives#1", lives);
  79. if (lives===0) {
  80. setScreen("LoseScreen");
  81. }
  82. setText("Lives#2", lives);
  83. });
  84. onEvent("Apple#1", "click", function() {
  85. score = score+2;
  86. lives = lives+2;
  87. setScreen("Level#2");
  88. setText("Score#2", score);
  89. setPosition("Apple#2", x [(randomNumber(0, 2))], y [(randomNumber(0,1))]);
  90. if (score==6) {
  91. setScreen("VictoryScreen");
  92. }
  93. });
  94.  
  95.  
  96. onEvent("Level#2", "click", function() {
  97. lives = lives-1;
  98. setText("Lives#2", lives);
  99. if (lives===0) {
  100. setScreen("LoseScreen");
  101. }
  102. });
  103. onEvent("Apple#2", "click", function() {
  104. score = score+2;
  105. lives = lives+1;
  106. setScreen("Level#3");
  107. setText("Score#3", score);
  108. setText("Lives#3", lives);
  109. setPosition("Apple#3", x3 [(randomNumber(0, 2))], y2 [(randomNumber(0,2))]);
  110. if (score==6) {
  111. setScreen("VictoryScreen");
  112. }
  113. });
  114.  
  115.  
  116. onEvent("Level#3", "click", function() {
  117. setText("Lives#3", lives);
  118. lives = lives-1;
  119. if (lives===-1) {
  120. setScreen("LoseScreen");
  121. }
  122. });
  123. onEvent("Apple#3", "click", function() {
  124. score = score+2;
  125. lives = lives+1;
  126. setText("Score#3", score);
  127. setText("Lives#3", lives);
  128. if (score==6) {
  129. setScreen("VictoryScreen");
  130. }
  131. });
  132.  
  133.  
  134. function Restart1() {
  135. setText("Lives#1", lives=7);
  136. setText("Score#1", score=0);
  137. showElement("Card#1");
  138. showElement("Card#2");
  139. showElement("Card#3");
  140. showElement("Card#4");
  141. showElement("Card#5");
  142. showElement("Card#6");
  143. showElement("Card#7");
  144. showElement("Card#8");
  145. showElement("Card#9");
  146. showElement("Card#10");
  147. showElement("Card#11");
  148. showElement("Card#12");
  149. showElement("Card#13");
  150. showElement("Card#14");
  151. showElement("Card#15");
  152. showElement("Card#16");
  153. showElement("Card#17");
  154. showElement("Card#18");
  155. setPosition("Apple#1", x [(randomNumber(0, 2))], 225);
  156. }
  157. onEvent("Settings", "click", function() {
  158. setScreen("SettingsScreen");
  159. lives = lives+1;
  160. });
  161. onEvent("ReturnButton", "click", function() {
  162. setScreen("Level#1");
  163. });
  164. onEvent("StartOverButton", "click", function() {
  165. Restart1();
  166. setScreen("Level#1");
  167. });
  168. onEvent("HomeSButton", "click", function() {
  169. Restart1();
  170. setScreen("homescreen");
  171. });
  172. onEvent("Settings#2", "click", function() {
  173. setScreen("SettingsScreen#2");
  174. lives = lives+1;
  175. });
  176. onEvent("ReturnButton#2", "click", function() {
  177. setScreen("Level#2");
  178. setText("Lives#2", lives);
  179. });
  180. onEvent("StartOverButton#2", "click", function() {
  181. Restart1();
  182. setScreen("Level#1");
  183. });
  184. onEvent("rulesbutton", "click", function() {
  185. setScreen("How To Play");
  186. onEvent("Back", "click", function() {
  187. setScreen("Level#1");
  188. });
  189. });
  190. onEvent("HomeSButton#2", "click", function() {
  191. setScreen("homescreen");
  192. Restart1();
  193. });
  194. onEvent("rulesbutton#2", "click", function() {
  195. setScreen("How To Play");
  196. onEvent("Back", "click", function() {
  197. setScreen("Level#2");
  198. });
  199. });
  200. onEvent("PlayAgainButtonL", "click", function() {
  201. setScreen("homescreen");
  202. Restart1();
  203. });
  204. onEvent("Settings#3", "click", function() {
  205. setScreen("SettingsScreen#3");
  206. lives = lives+1;
  207. setText("Lives#3", lives);
  208. });
  209. onEvent("ReturnButton#3", "click", function() {
  210. setScreen("Level#3");
  211. });
  212. onEvent("StartOverButton#3", "click", function() {
  213. Restart1();
  214. setScreen("Level#1");
  215. });
  216. onEvent("HomeSButton#3", "click", function() {
  217. setScreen("homescreen");
  218. Restart1();
  219. });
  220. onEvent("PlayAgainButtonV", "click", function() {
  221. setScreen("homescreen");
  222. Restart1();
  223. });
  224. onEvent("rulesbutton#3", "click", function() {
  225. setScreen("How To Play");
  226. onEvent("Back", "click", function() {
  227. setScreen("Level#3");
  228. });
  229. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement