Advertisement
qqwref

Another Toast League level [edited]

May 8th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. QQ''s Four Elements
  2.  
  3.  
  4.  
  5. var green = color(144, 192, 84, 1);
  6. var brown = color(139, 69, 19, 1);
  7. var red = color(255, 0, 0, 1);
  8. var blue = color(53, 126, 215, 1);
  9. var cloudVision = 25;
  10.  
  11. platform3D(-50, -50, 0, 100, 100, 3, green);
  12.  
  13. // a white platform that has no shadow and only appears when you get near it
  14. function cloudPlatform(x, y, z, w, h, d, px, py, pz) {
  15.  var distance = Math.sqrt(Math.pow(player.pos[0] - (x + w/2), 2) + Math.pow(player.pos[1] - (y + h/2), 2));
  16.  box3D(x, y, z, w, h, d, color(255, 255, 255, Math.max(0, 1 - (distance/cloudVision))), 0);
  17.  platforms.push([x, y, z, w, h, d, x-px, y-py, z-pz]);
  18. }
  19. function bobbingCloudPlatform(x, y, z, w, h, d, cycle, offset, amount, axis) {
  20.  var a = [x, y, z][axis];
  21.  var pa = a + Math.sin(((frameCount - 1) / 100) * cycle + offset) * amount;
  22.  a += Math.sin((frameCount / 100) * cycle + offset) * amount;
  23.  var ppos = [x, y, z];
  24.  ppos[axis] = pa;
  25.  var pos = [x, y, z];
  26.  pos[axis] = a;
  27.  var distance = Math.sqrt(Math.pow(player.pos[0] - (pos[0] + w/2), 2) + Math.pow(player.pos[1] - (pos[1] + h/2), 2));
  28.  box3D(pos[0], pos[1], pos[2], w, h, d, color(255,255,255,Math.max(0, 1 - (distance/cloudVision))), 0);
  29.  platforms.push([pos[0], pos[1], pos[2], w, h, d, pos[0]-ppos[0], pos[1]-ppos[1], pos[2]-ppos[2]]);
  30. }
  31.  
  32. // a purple platform that waps you to [wx,wy,wz] if you step on it
  33. function warpPlatform(x, y, z, w, h, d, wx, wy, wz) {
  34.  platform3D(x, y, z, w, h, d, color(90, 0, 180, 1));
  35.  if (player.pos[0] >= x && player.pos[0] <= x+w && player.pos[1] >= y && player.pos[1] <= y+h && Math.abs(player.pos[2] - (z-1)) <= 0.1) {
  36.   player.pos = [wx, wy, wz];
  37.  }
  38. }
  39.  
  40. // a springy platform that makes your jumps higher by a factor of factor
  41. function springPlatform(x, y, z, h, w, d, factor) {
  42.  platform3D(x, y, z, w, h, d, color(255, 255, 90, 1));
  43.  if (player.pos[0] >= x && player.pos[0] <= x+w && player.pos[1] >= y && player.pos[1] <= y+h && Math.abs(player.pos[2] - (z-1)) <= 0.1 &&
  44.  
  45. player.vel[2] <= 0) {
  46.   player.vel[2] *= factor;
  47.  }
  48. }
  49.  
  50. // fire wall platform: red, moves, and if you touch it, you die
  51. // make y-direction firewallin a bounding box, starting when you reach starty, stopping at the end
  52. function fireWall(bbx, bby, bbz, bbh, bbw, bbd, color, starty, speed) {
  53.  if (window.fireWall_y == undefined) {
  54.   window.fireWall_y = [];
  55.  }
  56.  if (window.fireWall_y[bby] != undefined) {
  57.   window.fireWall_y[bby] += speed;
  58.   if (window.fireWall_y[bby] > bby + bbw || player.pos[0] < bbx || player.pos[0] > bbx + bbh || player.pos[1] < bby || player.pos[1] > bby + bbw ||
  59.  
  60. player.pos[2] < bbz || player.pos[2] > bbz + bbd) {
  61.    window.fireWall_y[bby] = undefined;
  62.   } else {
  63.    platform3D(bbx, window.fireWall_y[bby], bbz, bbh, 2, bbd, color);
  64.    if (player.pos[1] < window.fireWall_y[bby]) {
  65.     player.pos[2] = 10;
  66.     window.fireWall_y[bby] = undefined;
  67.    }
  68.   }
  69.  } else {
  70.   if (player.pos[0] >= bbx && player.pos[0] <= bbx + bbh && player.pos[2] >= bbz && player.pos[2] <= bbz + bbd && player.pos[1] >= starty &&
  71.  
  72. player.pos[1] <= bby + bbw) {
  73.    window.fireWall_y[bby] = bby;
  74.   }
  75.  }
  76. }
  77. // earth platform: brown, moves, and pushes you
  78. function pushMover(fx, fy, fz, h, w, d, color) {
  79.  platform3D(fx(frameCount), fy(frameCount), fz(frameCount), h, w, d, color, fx(frameCount-1), fy(frameCount-1), fz(frameCount-1));
  80. }
  81. function triangleX(x, time, dist) {
  82.  var z = x%(2*time);
  83.  if (z < time) return z*(dist/time);
  84.  return (2*time-z)*(dist/time);
  85. }
  86. // black platform that kills you if you touch it
  87. function deathPlatform(x, y, z, h, w, d) {
  88.  box3D(x, y, z, h, w, d, color(0, 0, 0, 1), 0);
  89.  if (player.pos[0] >= x && player.pos[0] <= x+h && player.pos[1] >= y && player.pos[1] <= y+w && player.pos[2] >= z && player.pos[2] <= z+d) {
  90.   player.pos[2] = 10;
  91.  }
  92. }
  93.  
  94. // air part 1
  95. cloudPlatform(60, -20, -3, 8, 8, 1);
  96. cloudPlatform(80, -15, -5, 3, 8, 1);
  97. cloudPlatform(90, 0, -5, 4, 5, 1);
  98. cloudPlatform(96, 0, -16, 14, 5, 1);
  99. cloudPlatform(104, -12, -21, 6, 5, 1);
  100. cloudPlatform(120, -26, -15, 6, 6, 1);
  101. cloudPlatform(135, -15, -19, 3, 8, 1);
  102. cloudPlatform(152, -15, -23, 3, 8, 1);
  103. cloudPlatform(155, -35, -23, 20, 3, 1);
  104. cloudPlatform(165, -35, -40, 8, 3, 6);
  105. bobbingCloudPlatform(165, -31, -60, 8, 8, 2, 5, 0, 20, 2);
  106. platform3D(183, -50, -80, 10, 30, 3, green);
  107.  
  108. // air part 2
  109. bobbingCloudPlatform(213, -40, -96, 10, 10, 10, 2, 0, 30, 0);
  110. cloudPlatform(243, -40, -80, 10, 10, 1, green);
  111. cloudPlatform(243, -28, -50, 6, 6, 1, green);
  112. cloudPlatform(265, -22, -53, 15, 3, 1, green);
  113. cloudPlatform(278, -46, -56, 3, 20, 1, green);
  114. cloudPlatform(278, -46, -66, 3, 3, 1, green);
  115. cloudPlatform(278, -46, -76, 3, 3, 1, green);
  116. cloudPlatform(278, -46, -86, 60, 3, 1, green);
  117. cloudPlatform(350, -49, -85, 10, 10, 1, green);
  118. platform3D(350, -15, -80, 10, 30, 1, green);
  119. warpPlatform(350, 15, -80, 10, 10, 1, 0, 0, -1);
  120.  
  121. // water 1
  122. platform3D(-20, -100, 2, 40, 50, 10, blue, -20, -99.7, 2);
  123. platform3D(-20, -110, 2, 40, 10, 10, green);
  124. platform3D(-20, -210, 2, 40, 100, 10, blue, -20, -215, 2);
  125. platform3D(-6, -120, -6, 4, 4, 8, green);
  126. platform3D(13, -135, -8, 4, 4, 10, green);
  127. platform3D(5, -150, -12, 4, 4, 14, green);
  128. platform3D(-20, -150, -14, 4, 4, 16, green);
  129. platform3D(-18, -172, -10, 4, 4, 12, green);
  130. platform3D(3, -190, -10, 4, 4, 12, green);
  131. platform3D(-20, -220, -10, 40, 10, 12, green);
  132.  
  133. // water 2
  134. platform3D(-20, -370, 2, 40, 150, 10, blue, -18.5, -370, 2);
  135. platform3D(-20, -255, -6, 4, 4, 8, green);
  136. platform3D(-6, -270, -8, 4, 4, 10, green);
  137. platform3D(5, -280, -14, 4, 4, 16, green);
  138. platform3D(0, -290, -22, 4, 4, 24, green);
  139. platform3D(11, -321, -10, 4, 4, 12, green)
  140. platform3D(-6, -340, -14, 6, 6, 16, green);
  141. platform3D(11, -356, -19, 4, 4, 21, green);
  142. platform3D(-20, -380, -14, 40, 10, 16, green);
  143. platform3D(-6, -420, -14, 5, 40, 16, blue, -6, -422, -14);
  144. platform3D(-11, -450, -14, 5, 40, 16, blue, -11, -452, -14);
  145. platform3D(-6, -450, -14, 19, 5, 16, blue, -6, -452, -14);
  146. platform3D(13, -505, -14, 5, 60, 16, blue, 13, -507, -14);
  147. platform3D(-6, -505, -14, 19, 5, 16, blue, -6, -507, -14);
  148. platform3D(-11, -505, -14, 5, 20, 16, blue, -11, -507, -14);
  149. platform3D(-36, -490, -14, 25, 5, 16, blue, -36, -492, -14);
  150. platform3D(-46, -510, -14, 10, 40, 3, green);
  151. warpPlatform(-46, -525, -14, 10, 10, 3, 0, 0, -1);
  152.  
  153. // earth 1
  154. platform3D(-200, -5, 0, 150, 10, 0, green);
  155. platform3D(-200, -155, 0, 10, 150, 0, green);
  156. platform3D(-218, -175, 0, 41, 20, 3, green);
  157. pushMover((x)=>(-60), (y)=>(-6+triangleX(y+15, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  158. pushMover((x)=>(-90), (y)=>(-6+triangleX(y, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  159. pushMover((x)=>(-100), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  160. pushMover((x)=>(-110), (y)=>(-6+triangleX(y, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  161. pushMover((x)=>(-120), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  162. pushMover((x)=>(-120), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
  163. pushMover((x)=>(-165), (y)=>(-6+triangleX(y+30, 40, 10)), (z)=>(-12), 25, 10, 12, brown);
  164. invinciblePlatform3D(-190, -7, -30, 140, 2, 35, -190, -7, -31);
  165. invinciblePlatform3D(-200, 5, -30, 150, 2, 35, -200, 5, -31);
  166. pushMover((x)=>(-200), (y)=>(-25+triangleX(y, 30, 30)), (z)=>(-5), 10, 3, 5, brown);
  167. pushMover((x)=>(-200), (y)=>(-50), (z)=>(-35+triangleX(z, 30, 20)), 10, 10, 20, brown);
  168. pushMover((x)=>(-200), (y)=>(-65), (z)=>(-35+triangleX(z+15, 30, 20)), 10, 5, 20, brown);
  169. pushMover((x)=>(-200), (y)=>(-75), (z)=>(-35+triangleX(z+45, 30, 20)), 10, 5, 20, brown);
  170. pushMover((x)=>(-200), (y)=>(-85), (z)=>(-35+triangleX(z+30, 30, 20)), 10, 5, 20, brown);
  171. pushMover((x)=>(-200), (y)=>(-105), (z)=>(-35+triangleX(z+50, 25, 20)), 10, 5, 20, brown);
  172. pushMover((x)=>(-200), (y)=>(-110), (z)=>(-35+triangleX(z+44, 25, 20)), 10, 5, 20, brown);
  173. pushMover((x)=>(-200), (y)=>(-115), (z)=>(-35+triangleX(z+38, 25, 20)), 10, 5, 20, brown);
  174. pushMover((x)=>(-200), (y)=>(-120), (z)=>(-35+triangleX(z+32, 25, 20)), 10, 5, 20, brown);
  175. pushMover((x)=>(-200), (y)=>(-125), (z)=>(-35+triangleX(z+26, 25, 20)), 10, 5, 20, brown);
  176. pushMover((x)=>(-200), (y)=>(-130), (z)=>(-35+triangleX(z+20, 25, 20)), 10, 5, 20, brown);
  177. pushMover((x)=>(-200), (y)=>(-135), (z)=>(-35+triangleX(z+12, 25, 20)), 10, 5, 20, brown);
  178. pushMover((x)=>(-200), (y)=>(-140), (z)=>(-35+triangleX(z+6, 25, 20)), 10, 5, 20, brown);
  179. pushMover((x)=>(-200), (y)=>(-155), (z)=>(-35+triangleX(z+45, 25, 20)), 10, 10, 20, brown);
  180.  
  181. // earth 2
  182. pushMover((x)=>(-230), (y)=>(-180+triangleX(y,30,20)), (z)=>(-6), 5, 10, 10, brown);
  183. pushMover((x)=>(-240), (y)=>(-180+triangleX(y+11,40,20)), (z)=>(-12), 5, 10, 10, brown);
  184. pushMover((x)=>(-250), (y)=>(-180+triangleX(y+26,50,20)), (z)=>(-18), 5, 10, 10, brown);
  185. pushMover((x)=>(-260), (y)=>(-185+triangleX(y+15,20,20)), (z)=>(-40), 5, 20, 25, brown);
  186. pushMover((x)=>(-280), (y)=>(-170), (z)=>(-60+triangleX(z, 40, 20)), 10, 10, 10, brown);
  187. pushMover((x)=>(-300), (y)=>(-170), (z)=>(-78+triangleX(z, 40, 20)), 10, 10, 28, brown);
  188. platform3D(-360, -180, -50, 50, 30, 3, green);
  189. platform3D(-359, -170, -40, 20, 10, 3, green);
  190. warpPlatform(-339, -170, -40, 10, 10, 1, 0, 0, -1);
  191.  
  192. // fire part 1
  193. platform3D(-10, 60, -3, 6, 6, 1, red);
  194. platform3D(-10, 80, -3, 6, 6, 1, red);
  195. platform3D(0, 90, -5, 6, 6, 1, red);
  196. platform3D(10, 100, -7, 6, 6, 1, red);
  197. platform3D(0, 120, 0, 8, 8, 1, red);
  198. platform3D(-18, 136, -2, 6, 6, 1, red);
  199. platform3D(3, 152, -7, 6, 6, 1, red);
  200. platform3D(3, 172, -10, 6, 6, 1, red);
  201. platform3D(-11, 183, -15, 6, 6, 1, red);
  202. platform3D(5, 195, -20, 6, 6, 1, red);
  203. platform3D(5, 220, -10, 8, 8, 1, red);
  204. platform3D(15, 250, -10, 8, 8, 1, red);
  205. platform3D(0, 280, 0, 8, 8, 1, red);
  206. platform3D(-15, 300, 0, 40, 10, 3, green);
  207. fireWall(-30, 50, -40, 60, 250, 50, color(255, 128, 0, 0.1), 80, 0.2);
  208.  
  209. // fire part 2
  210. platform3D(4, 320, -5, 2, 50, 1, red);
  211. platform3D(2, 395, 0, 6, 6, 1, red);
  212. bobbingPlatform3D(8, 420, -5, 10, 10, 1, red, 4, 0, 10, 2);
  213. bobbingPlatform3D(-8, 440, -5, 10, 10, 1, red, 6, 0, 10, 2);
  214. bobbingPlatform3D(0, 460, -5, 10, 10, 1, red, 6, 0, 10, 0);
  215. bobbingPlatform3D(5, 480, -5, 10, 10, 1, red, 6, 1.5, 10, 2);
  216. bobbingPlatform3D(5, 500, -15, 12, 6, 1, red, 6, 1.5, 10, 0);
  217. bobbingPlatform3D(5, 520, -15, 12, 6, 1, red, 8, 0, 10, 0);
  218. bobbingPlatform3D(5, 540, -15, 12, 6, 1, red, 10, 1.5, 10, 0);
  219. bobbingPlatform3D(5, 560, -15, 12, 6, 1, red, 4, 1.5, 10, 0);
  220. platform3D(0, 580, 0, 6, 6, 1, red);
  221. platform3D(-15, 600, 0, 40, 10, 3, green);
  222. fireWall(-30, 300, -40, 60, 300, 50, color(255, 128, 0, 0.1), 390, 0.45);
  223. warpPlatform(0, 615, 0, 10, 10, 1, 0, 0, -1);
  224.  
  225. // light
  226. if (checkpoints >= 9) {
  227.  springPlatform(10, 10, -5, 10, 10, 3, 2);
  228.  springPlatform(-20, -20, -25, 10, 10, 3, 2);
  229.  springPlatform(-30, -20, -60, 10, 10, 3, 2.5);
  230.  springPlatform(-30, 20, -110, 10, 10, 3, 2);
  231.  springPlatform(0, 0, -140, 10, 10, 3, 5);
  232.  springPlatform(-10, -10, -380, 10, 30, 3, 2);
  233.  springPlatform(-10, 10, -380, 10, 30, 3, 2);
  234.  springPlatform(-10, 0, -380, 10, 10, 3, 2);
  235.  springPlatform(10, 0, -380, 10, 10, 3, 2);
  236.  platform3D(0, 0, -400, 10, 10, 3, green);
  237. }
  238.  
  239.  
  240.  
  241. [["checkpoint", 0, 0, 0, false],
  242. ["checkpoint", 5, 305, 0, false], // fire 1
  243. ["checkpoint", 5, 605, 0, false], // fire 2
  244. ["checkpoint", 188, -35, -80, false], // air 1
  245. ["checkpoint", 355, 0, -80, false], // air 2
  246. ["checkpoint", 0, -215, -10, false], // water 1
  247. ["checkpoint", -41, -490, -14, false], // water 2
  248. ["checkpoint", -198, -165, 0, false], // earth 1
  249. ["checkpoint", -349, -165, -40, false], // earth 2
  250. ["checkpoint", 5, 5, -400, false] // ending
  251. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement