Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QQ''s Four Elements
- var green = color(144, 192, 84, 1);
- var brown = color(139, 69, 19, 1);
- var red = color(255, 0, 0, 1);
- var blue = color(53, 126, 215, 1);
- var cloudVision = 25;
- platform3D(-50, -50, 0, 100, 100, 3, green);
- // a white platform that has no shadow and only appears when you get near it
- function cloudPlatform(x, y, z, w, h, d, px, py, pz) {
- var distance = Math.sqrt(Math.pow(player.pos[0] - (x + w/2), 2) + Math.pow(player.pos[1] - (y + h/2), 2));
- box3D(x, y, z, w, h, d, color(255, 255, 255, Math.max(0, 1 - (distance/cloudVision))), 0);
- platforms.push([x, y, z, w, h, d, x-px, y-py, z-pz]);
- }
- function bobbingCloudPlatform(x, y, z, w, h, d, cycle, offset, amount, axis) {
- var a = [x, y, z][axis];
- var pa = a + Math.sin(((frameCount - 1) / 100) * cycle + offset) * amount;
- a += Math.sin((frameCount / 100) * cycle + offset) * amount;
- var ppos = [x, y, z];
- ppos[axis] = pa;
- var pos = [x, y, z];
- pos[axis] = a;
- var distance = Math.sqrt(Math.pow(player.pos[0] - (pos[0] + w/2), 2) + Math.pow(player.pos[1] - (pos[1] + h/2), 2));
- box3D(pos[0], pos[1], pos[2], w, h, d, color(255,255,255,Math.max(0, 1 - (distance/cloudVision))), 0);
- platforms.push([pos[0], pos[1], pos[2], w, h, d, pos[0]-ppos[0], pos[1]-ppos[1], pos[2]-ppos[2]]);
- }
- // a purple platform that waps you to [wx,wy,wz] if you step on it
- function warpPlatform(x, y, z, w, h, d, wx, wy, wz) {
- platform3D(x, y, z, w, h, d, color(90, 0, 180, 1));
- 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) {
- player.pos = [wx, wy, wz];
- }
- }
- // a springy platform that makes your jumps higher by a factor of factor
- function springPlatform(x, y, z, h, w, d, factor) {
- platform3D(x, y, z, w, h, d, color(255, 255, 90, 1));
- 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 &&
- player.vel[2] <= 0) {
- player.vel[2] *= factor;
- }
- }
- // fire wall platform: red, moves, and if you touch it, you die
- // make y-direction firewallin a bounding box, starting when you reach starty, stopping at the end
- function fireWall(bbx, bby, bbz, bbh, bbw, bbd, color, starty, speed) {
- if (window.fireWall_y == undefined) {
- window.fireWall_y = [];
- }
- if (window.fireWall_y[bby] != undefined) {
- window.fireWall_y[bby] += speed;
- 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 ||
- player.pos[2] < bbz || player.pos[2] > bbz + bbd) {
- window.fireWall_y[bby] = undefined;
- } else {
- platform3D(bbx, window.fireWall_y[bby], bbz, bbh, 2, bbd, color);
- if (player.pos[1] < window.fireWall_y[bby]) {
- player.pos[2] = 10;
- window.fireWall_y[bby] = undefined;
- }
- }
- } else {
- if (player.pos[0] >= bbx && player.pos[0] <= bbx + bbh && player.pos[2] >= bbz && player.pos[2] <= bbz + bbd && player.pos[1] >= starty &&
- player.pos[1] <= bby + bbw) {
- window.fireWall_y[bby] = bby;
- }
- }
- }
- // earth platform: brown, moves, and pushes you
- function pushMover(fx, fy, fz, h, w, d, color) {
- platform3D(fx(frameCount), fy(frameCount), fz(frameCount), h, w, d, color, fx(frameCount-1), fy(frameCount-1), fz(frameCount-1));
- }
- function triangleX(x, time, dist) {
- var z = x%(2*time);
- if (z < time) return z*(dist/time);
- return (2*time-z)*(dist/time);
- }
- // black platform that kills you if you touch it
- function deathPlatform(x, y, z, h, w, d) {
- box3D(x, y, z, h, w, d, color(0, 0, 0, 1), 0);
- 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) {
- player.pos[2] = 10;
- }
- }
- // air part 1
- cloudPlatform(60, -20, -3, 8, 8, 1);
- cloudPlatform(80, -15, -5, 3, 8, 1);
- cloudPlatform(90, 0, -5, 4, 5, 1);
- cloudPlatform(96, 0, -16, 14, 5, 1);
- cloudPlatform(104, -12, -21, 6, 5, 1);
- cloudPlatform(120, -26, -15, 6, 6, 1);
- cloudPlatform(135, -15, -19, 3, 8, 1);
- cloudPlatform(152, -15, -23, 3, 8, 1);
- cloudPlatform(155, -35, -23, 20, 3, 1);
- cloudPlatform(165, -35, -40, 8, 3, 6);
- bobbingCloudPlatform(165, -31, -60, 8, 8, 2, 5, 0, 20, 2);
- platform3D(183, -50, -80, 10, 30, 3, green);
- // air part 2
- bobbingCloudPlatform(213, -40, -96, 10, 10, 10, 2, 0, 30, 0);
- cloudPlatform(243, -40, -80, 10, 10, 1, green);
- cloudPlatform(243, -28, -50, 6, 6, 1, green);
- cloudPlatform(265, -22, -53, 15, 3, 1, green);
- cloudPlatform(278, -46, -56, 3, 20, 1, green);
- cloudPlatform(278, -46, -66, 3, 3, 1, green);
- cloudPlatform(278, -46, -76, 3, 3, 1, green);
- cloudPlatform(278, -46, -86, 60, 3, 1, green);
- cloudPlatform(350, -49, -85, 10, 10, 1, green);
- platform3D(350, -15, -80, 10, 30, 1, green);
- warpPlatform(350, 15, -80, 10, 10, 1, 0, 0, -1);
- // water 1
- platform3D(-20, -100, 2, 40, 50, 10, blue, -20, -99.7, 2);
- platform3D(-20, -110, 2, 40, 10, 10, green);
- platform3D(-20, -210, 2, 40, 100, 10, blue, -20, -215, 2);
- platform3D(-6, -120, -6, 4, 4, 8, green);
- platform3D(13, -135, -8, 4, 4, 10, green);
- platform3D(5, -150, -12, 4, 4, 14, green);
- platform3D(-20, -150, -14, 4, 4, 16, green);
- platform3D(-18, -172, -10, 4, 4, 12, green);
- platform3D(3, -190, -10, 4, 4, 12, green);
- platform3D(-20, -220, -10, 40, 10, 12, green);
- // water 2
- platform3D(-20, -370, 2, 40, 150, 10, blue, -18.5, -370, 2);
- platform3D(-20, -255, -6, 4, 4, 8, green);
- platform3D(-6, -270, -8, 4, 4, 10, green);
- platform3D(5, -280, -14, 4, 4, 16, green);
- platform3D(0, -290, -22, 4, 4, 24, green);
- platform3D(11, -321, -10, 4, 4, 12, green)
- platform3D(-6, -340, -14, 6, 6, 16, green);
- platform3D(11, -356, -19, 4, 4, 21, green);
- platform3D(-20, -380, -14, 40, 10, 16, green);
- platform3D(-6, -420, -14, 5, 40, 16, blue, -6, -422, -14);
- platform3D(-11, -450, -14, 5, 40, 16, blue, -11, -452, -14);
- platform3D(-6, -450, -14, 19, 5, 16, blue, -6, -452, -14);
- platform3D(13, -505, -14, 5, 60, 16, blue, 13, -507, -14);
- platform3D(-6, -505, -14, 19, 5, 16, blue, -6, -507, -14);
- platform3D(-11, -505, -14, 5, 20, 16, blue, -11, -507, -14);
- platform3D(-36, -490, -14, 25, 5, 16, blue, -36, -492, -14);
- platform3D(-46, -510, -14, 10, 40, 3, green);
- warpPlatform(-46, -525, -14, 10, 10, 3, 0, 0, -1);
- // earth 1
- platform3D(-200, -5, 0, 150, 10, 0, green);
- platform3D(-200, -155, 0, 10, 150, 0, green);
- platform3D(-218, -175, 0, 41, 20, 3, green);
- pushMover((x)=>(-60), (y)=>(-6+triangleX(y+15, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-90), (y)=>(-6+triangleX(y, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-100), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-110), (y)=>(-6+triangleX(y, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-120), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-120), (y)=>(-6+triangleX(y+30, 30, 20)), (z)=>(-12), 10, 10, 12, brown);
- pushMover((x)=>(-165), (y)=>(-6+triangleX(y+30, 40, 10)), (z)=>(-12), 25, 10, 12, brown);
- invinciblePlatform3D(-190, -7, -30, 140, 2, 35, -190, -7, -31);
- invinciblePlatform3D(-200, 5, -30, 150, 2, 35, -200, 5, -31);
- pushMover((x)=>(-200), (y)=>(-25+triangleX(y, 30, 30)), (z)=>(-5), 10, 3, 5, brown);
- pushMover((x)=>(-200), (y)=>(-50), (z)=>(-35+triangleX(z, 30, 20)), 10, 10, 20, brown);
- pushMover((x)=>(-200), (y)=>(-65), (z)=>(-35+triangleX(z+15, 30, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-75), (z)=>(-35+triangleX(z+45, 30, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-85), (z)=>(-35+triangleX(z+30, 30, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-105), (z)=>(-35+triangleX(z+50, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-110), (z)=>(-35+triangleX(z+44, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-115), (z)=>(-35+triangleX(z+38, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-120), (z)=>(-35+triangleX(z+32, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-125), (z)=>(-35+triangleX(z+26, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-130), (z)=>(-35+triangleX(z+20, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-135), (z)=>(-35+triangleX(z+12, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-140), (z)=>(-35+triangleX(z+6, 25, 20)), 10, 5, 20, brown);
- pushMover((x)=>(-200), (y)=>(-155), (z)=>(-35+triangleX(z+45, 25, 20)), 10, 10, 20, brown);
- // earth 2
- pushMover((x)=>(-230), (y)=>(-180+triangleX(y,30,20)), (z)=>(-6), 5, 10, 10, brown);
- pushMover((x)=>(-240), (y)=>(-180+triangleX(y+11,40,20)), (z)=>(-12), 5, 10, 10, brown);
- pushMover((x)=>(-250), (y)=>(-180+triangleX(y+26,50,20)), (z)=>(-18), 5, 10, 10, brown);
- pushMover((x)=>(-260), (y)=>(-185+triangleX(y+15,20,20)), (z)=>(-40), 5, 20, 25, brown);
- pushMover((x)=>(-280), (y)=>(-170), (z)=>(-60+triangleX(z, 40, 20)), 10, 10, 10, brown);
- pushMover((x)=>(-300), (y)=>(-170), (z)=>(-78+triangleX(z, 40, 20)), 10, 10, 28, brown);
- platform3D(-360, -180, -50, 50, 30, 3, green);
- platform3D(-359, -170, -40, 20, 10, 3, green);
- warpPlatform(-339, -170, -40, 10, 10, 1, 0, 0, -1);
- // fire part 1
- platform3D(-10, 60, -3, 6, 6, 1, red);
- platform3D(-10, 80, -3, 6, 6, 1, red);
- platform3D(0, 90, -5, 6, 6, 1, red);
- platform3D(10, 100, -7, 6, 6, 1, red);
- platform3D(0, 120, 0, 8, 8, 1, red);
- platform3D(-18, 136, -2, 6, 6, 1, red);
- platform3D(3, 152, -7, 6, 6, 1, red);
- platform3D(3, 172, -10, 6, 6, 1, red);
- platform3D(-11, 183, -15, 6, 6, 1, red);
- platform3D(5, 195, -20, 6, 6, 1, red);
- platform3D(5, 220, -10, 8, 8, 1, red);
- platform3D(15, 250, -10, 8, 8, 1, red);
- platform3D(0, 280, 0, 8, 8, 1, red);
- platform3D(-15, 300, 0, 40, 10, 3, green);
- fireWall(-30, 50, -40, 60, 250, 50, color(255, 128, 0, 0.1), 80, 0.2);
- // fire part 2
- platform3D(4, 320, -5, 2, 50, 1, red);
- platform3D(2, 395, 0, 6, 6, 1, red);
- bobbingPlatform3D(8, 420, -5, 10, 10, 1, red, 4, 0, 10, 2);
- bobbingPlatform3D(-8, 440, -5, 10, 10, 1, red, 6, 0, 10, 2);
- bobbingPlatform3D(0, 460, -5, 10, 10, 1, red, 6, 0, 10, 0);
- bobbingPlatform3D(5, 480, -5, 10, 10, 1, red, 6, 1.5, 10, 2);
- bobbingPlatform3D(5, 500, -15, 12, 6, 1, red, 6, 1.5, 10, 0);
- bobbingPlatform3D(5, 520, -15, 12, 6, 1, red, 8, 0, 10, 0);
- bobbingPlatform3D(5, 540, -15, 12, 6, 1, red, 10, 1.5, 10, 0);
- bobbingPlatform3D(5, 560, -15, 12, 6, 1, red, 4, 1.5, 10, 0);
- platform3D(0, 580, 0, 6, 6, 1, red);
- platform3D(-15, 600, 0, 40, 10, 3, green);
- fireWall(-30, 300, -40, 60, 300, 50, color(255, 128, 0, 0.1), 390, 0.45);
- warpPlatform(0, 615, 0, 10, 10, 1, 0, 0, -1);
- // light
- if (checkpoints >= 9) {
- springPlatform(10, 10, -5, 10, 10, 3, 2);
- springPlatform(-20, -20, -25, 10, 10, 3, 2);
- springPlatform(-30, -20, -60, 10, 10, 3, 2.5);
- springPlatform(-30, 20, -110, 10, 10, 3, 2);
- springPlatform(0, 0, -140, 10, 10, 3, 5);
- springPlatform(-10, -10, -380, 10, 30, 3, 2);
- springPlatform(-10, 10, -380, 10, 30, 3, 2);
- springPlatform(-10, 0, -380, 10, 10, 3, 2);
- springPlatform(10, 0, -380, 10, 10, 3, 2);
- platform3D(0, 0, -400, 10, 10, 3, green);
- }
- [["checkpoint", 0, 0, 0, false],
- ["checkpoint", 5, 305, 0, false], // fire 1
- ["checkpoint", 5, 605, 0, false], // fire 2
- ["checkpoint", 188, -35, -80, false], // air 1
- ["checkpoint", 355, 0, -80, false], // air 2
- ["checkpoint", 0, -215, -10, false], // water 1
- ["checkpoint", -41, -490, -14, false], // water 2
- ["checkpoint", -198, -165, 0, false], // earth 1
- ["checkpoint", -349, -165, -40, false], // earth 2
- ["checkpoint", 5, 5, -400, false] // ending
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement