How to use pos_x method in wpt

Best JavaScript code snippet using wpt

sketch.js

Source:sketch.js Github

copy

Full Screen

1var floorPos_y;2var scrollPos;3var gameChar_world_x;4//OBJECTS5var trees;6var mountains;7var clouds = [];8var canyons;9var collectables;10//GameCharacter11var Doraemon;12var isLeft;13var isRight;14var isFalling;15var isPlummeting;16var game_score;17var flagpole;18var lives;19var screenBorder;20var platforms;21var isContact;22var floorCollision;23var gameState;24//Sounds25var jumpSound;26var collectableSound;27var plummentingSound;28var reachFlagpole;29var gameoverSound;30var backgroundSound;31var enemySound;32var floorSound;33var enemies;34var enemyContact;35function preload() {36 soundFormats("mp3", "wav");37 //load sounds here38 jumpSound = loadSound("assets/jump.wav");39 jumpSound.setVolume(0.2);40 plummentingSound = loadSound("assets/plummenting.wav");41 plummentingSound.setVolume(0.2);42 collectableSound = loadSound("assets/collectable.wav");43 collectableSound.setVolume(0.2);44 reachFlagpole = loadSound("assets/Flagpole.wav");45 reachFlagpole.setVolume(0.1);46 gameoverSound = loadSound("assets/gameover.wav");47 gameoverSound.setVolume(0.1);48 backgroundSound = loadSound("assets/backgroundmusic.wav");49 backgroundSound.setVolume(0.1);50 enemySound = loadSound("assets/enemy.wav");51 enemySound.setVolume(0.2);52 floorSound = loadSound("assets/floor.wav");53 floorSound.setVolume(0.2);54}55function setup() {56 textFont("Courier New");57 createCanvas(1024, 576);58 floorPos_y = (height * 3) / 4;59 lives = 3;60 screenBorder = 100;61 InitSceneryObjects();62 startGame();63}64function startGame() {65 backgroundSound.loop();66 gameoverSound.stop();67 reachFlagpole.stop();68 game_score = 0;69 //Object CHARACTER70 Doraemon = {71 pos_x: 280,72 pos_y: floorPos_y - 50,73 gameover: false,74 floor_contact: function () {75 if (this.pos_y == floorPos_y || isContact) {76 return true;77 }78 return false;79 },80 };81 // Variable to control the background scrolling.82 scrollPos = 0;83 // Variable to store the real position of the gameChar in the game84 // world. Needed for collision detection.85 gameChar_world_x = Doraemon.pos_x - scrollPos;86 // Boolean variables to control the movement of the game character.87 isLeft = false;88 isRight = false;89 isFalling = false;90 isPlummeting = false;91 collectables = [92 { pos_x: 350, pos_y: 350, size: 0.5, isFound: false },93 { pos_x: 1350, pos_y: 350, size: 0.5, isFound: false },94 { pos_x: 925, pos_y: 150, size: 0.5, isFound: false },95 ];96 trees = [97 { pos_x: 175, pos_y: 360, trunkHeight: 95, trunkWidth: 30 },98 { pos_x: 680, pos_y: 350, trunkHeight: 95, trunkWidth: 30 },99 { pos_x: 1530, pos_y: 400, trunkHeight: 95, trunkWidth: 30 },100 { pos_x: 1970, pos_y: 400, trunkHeight: 95, trunkWidth: 30 },101 { pos_x: 2300, pos_y: 350, trunkHeight: 95, trunkWidth: 30 },102 ];103 mountains = [104 { pos_x: -600, pos_y: floorPos_y, width: 300, height: 700 },105 { pos_x: -400, pos_y: floorPos_y, width: 200, height: 600 },106 { pos_x: -200, pos_y: floorPos_y, width: 300, height: 500 },107 { pos_x: 600, pos_y: floorPos_y, width: 370, height: 700 },108 { pos_x: 800, pos_y: floorPos_y, width: 300, height: 500 },109 { pos_x: 905, pos_y: floorPos_y, width: 200, height: 450 },110 { pos_x: 1950, pos_y: floorPos_y, width: 300, height: 500 },111 { pos_x: 2050, pos_y: floorPos_y, width: 300, height: 700 },112 { pos_x: 2190, pos_y: floorPos_y, width: 200, height: 600 },113 ];114 canyons = [115 { pos_x: 75, width: 15 },116 { pos_x: 1099, width: 15 },117 { pos_x: 1435, width: 15 },118 ];119 //flagpole120 flagpole = {121 isReached: false,122 x_pos: 1900,123 };124 platforms = [];125 //PUSHING platforms into platforms array126 platforms.push(createPlatforms(450, 350, 200));127 platforms.push(createPlatforms(650, 290, 200));128 platforms.push(create_Moving_Platforms(850, 230, 100, 20));129 enemies = [];130 //PUSHING enemy into enemies array131 enemies.push(new Enemy(400, floorPos_y, 200));132 enemies.push(new Enemy(740, floorPos_y, 200));133 enemies.push(new Enemy(650, 290, 200, 200));134}135function draw() {136 background(251, 206, 177); //fill the sky137 //Draw Sun138 stroke(207, 182, 59);139 strokeWeight(5);140 fill(255, 215, 0);141 ellipse(280 - scrollPos / 100, 100, 130, 130);142 noStroke();143 //Draw Clouds144 for (var i = 0; i < clouds.length; i++) {145 clouds[i].update();146 clouds[i].draw();147 }148 push();149 translate(scrollPos, 0);150 // Draw mountains.151 drawMountains();152 // Draw canyons.153 for (var i = 0; i < canyons.length; i++) {154 drawCanyon(canyons[i]);155 checkCanyon(canyons[i]);156 }157 //Draw Ground158 drawGround();159 // Draw trees.160 drawTrees();161 // Draw collectable items.162 for (var i = 0; i < collectables.length; i++) {163 if (!collectables[i].isFound) {164 drawCollectable(collectables[i]);165 checkCollectable(collectables[i]);166 }167 }168 //draw Platforms169 for (var i = 0; i < platforms.length; i++) {170 platforms[i].draw();171 }172 // Draw flagpole173 renderFlagpole();174 // Draw enemies175 for (var i = 0; i < enemies.length; i++) {176 enemies[i].draw();177 // Check enemy collision detection178 enemyContact = enemies[i].checkContact(gameChar_world_x, Doraemon.pos_y);179 checkPlayerDie();180 }181 pop();182 // Draw game character.183 drawGameChar();184 checkPlayerDie();185 //SCOREBOARD186 //Lives187 for (var i = 0; i < lives; i++) {188 scoreBoard(200 + i * 50, 90);189 }190 //GAME_SCORE191 fill(1);192 stroke(255);193 strokeWeight(10);194 textSize(25);195 text("Score: " + game_score, width / 2, 40);196 //LIVES197 fill(1);198 stroke(255);199 text("Lives: " + lives, 40, 40);200 //GAME OVER OR LEVEL COMPLETE201 if (isFalling) {202 checkGameState();203 }204 if (lives < 1) {205 fill(1);206 noStroke();207 text("GAME OVER. Press space to continue", 40, 80);208 gameState = true;209 plummentingSound.stop();210 enemySound.stop();211 return;212 }213 if (flagpole.isReached) {214 fill(1);215 noStroke();216 text("LEVEL COMPLETE. Press space to continue", 40, 80);217 gameState = true;218 return;219 }220 // ------------------------------221 // Logic to make the character move or the bacground scroll222 // ------------------------------223 if (isLeft) {224 if (Doraemon.pos_x > width * 0.2) {225 Doraemon.pos_x -= 2;226 } else {227 scrollPos += 2;228 }229 }230 if (isRight) {231 if (Doraemon.pos_x < width * 0.8) {232 Doraemon.pos_x += 2;233 } else {234 scrollPos -= 2;235 }236 }237 // ------------------------------238 // Logic to make the game character rise and fall.239 // ------------------------------240 floorCollision = Doraemon.floor_contact();241 if (isFalling && floorCollision) {242 Doraemon.pos_y -= 100;243 jumpSound.play();244 }245 if (isContact && !floorSound.isPlaying()) {246 floorSound.play();247 }248 if (!floorSound.isPlaying()) {249 floorSound.play(0.008);250 }251 //Character Up in the air252 if (Doraemon.pos_y < floorPos_y) {253 //check contact with platforms254 isContact = false;255 for (var i = 0; i < platforms.length; i++) {256 if (platforms[i].checkContact(gameChar_world_x, Doraemon.pos_y)) {257 isContact = true;258 break;259 }260 }261 if (isContact == false) {262 //Gravity - returning down263 Doraemon.pos_y += 2;264 floorSound.stop();265 }266 }267 //Character Plummenting268 if (isPlummeting) {269 Doraemon.pos_y += 4;270 isLeft = false;271 isRight = false;272 isFalling = false;273 if (!plummentingSound.isPlaying()) {274 plummentingSound.play();275 }276 }277 // ------------------------------278 // Reaching FlagPole279 // ------------------------------280 if (flagpole.isReached == false) {281 checkFlagpole();282 }283 // Update real position of gameChar for collision detection.284 gameChar_world_x = Doraemon.pos_x - scrollPos;285}286// ---------------------287// Key control functions288// ---------------------289function keyPressed() {290 //SET TRUE WHEN - if statements to control the animation of the character when291 // keys are pressed.292 //isFalling - When hit spacebar293 if (key == " " || keyCode == 32) {294 isFalling = true;295 }296 //isLeft position - When hit Left Arrow297 if (key == "%" || keyCode == 37) {298 isLeft = true;299 }300 //isRight position - When hit Right Arrow301 else if (key == "'" || keyCode == 39) {302 isRight = true;303 }304}305function keyReleased() {306 // RETURN TO FALSE WHEN307 // keys are released.308 if (keyCode == 32) {309 isFalling = false;310 }311 //isLeft position312 if (key == "%" || keyCode == 37) {313 isLeft = false;314 }315 //isRight position316 else if (key == "'" || keyCode == 39) {317 isRight = false;318 }319}320// ------------------------------321// Game character render function322// ------------------------------323// Function to draw the game character.324function drawGameChar() {325 // draw game character326 if (isLeft && (isFalling || isPlummeting)) {327 // jumping-left code328 //FEET329 stroke(1);330 strokeWeight(1);331 fill(93, 173, 235);332 rect(Doraemon.pos_x - 10, Doraemon.pos_y - 16, 8, 14);333 fill(255);334 ellipse(Doraemon.pos_x - 6, Doraemon.pos_y, 8, 10);335 //ARMS336 fill(93, 173, 235);337 stroke(1);338 beginShape();339 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 30);340 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 25);341 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 10);342 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 20);343 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 35);344 endShape();345 noStroke();346 //hands347 fill(255);348 stroke(1);349 ellipse(Doraemon.pos_x + 16, Doraemon.pos_y - 30, 7, 12);350 noStroke();351 //BODY352 fill(93, 173, 235);353 ellipse(Doraemon.pos_x - 4, Doraemon.pos_y - 23, 27, 33);354 stroke(1);355 fill(255);356 ellipse(Doraemon.pos_x - 11, Doraemon.pos_y - 22, 13, 23);357 noStroke();358 //BODYSACK359 stroke(1);360 fill(255);361 arc(Doraemon.pos_x - 11, Doraemon.pos_y - 18, 10, 15, TWO_PI, PI, CHORD);362 noStroke();363 //COLLAR364 fill(255, 0, 0);365 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 30, 30, TWO_PI, PI);366 fill(255, 191, 0);367 ellipse(Doraemon.pos_x - 7, Doraemon.pos_y - 27, 7, 7);368 //head1369 stroke(1);370 fill(93, 173, 235);371 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 35, 45);372 noStroke();373 //head2374 fill(255);375 ellipse(Doraemon.pos_x - 9, Doraemon.pos_y - 52, 17, 37);376 //eyes377 stroke(1);378 strokeWeight(1);379 fill(255);380 ellipse(Doraemon.pos_x - 9, Doraemon.pos_y - 66, 10, 13);381 //nose382 fill(255, 0, 0);383 ellipse(Doraemon.pos_x - 15, Doraemon.pos_y - 60, 7, 7);384 //eye point385 strokeWeight(3);386 point(Doraemon.pos_x - 7, Doraemon.pos_y - 62);387 strokeWeight(1);388 line(389 Doraemon.pos_x - 15,390 Doraemon.pos_y - 56,391 Doraemon.pos_x,392 Doraemon.pos_y - 58393 );394 line(395 Doraemon.pos_x - 15,396 Doraemon.pos_y - 54,397 Doraemon.pos_x,398 Doraemon.pos_y - 54399 );400 line(401 Doraemon.pos_x - 15,402 Doraemon.pos_y - 52,403 Doraemon.pos_x,404 Doraemon.pos_y - 50405 );406 //mouth407 fill(171, 39, 79);408 arc(Doraemon.pos_x - 18, Doraemon.pos_y - 49, 27, 27, 0, HALF_PI);409 } else if (isRight && (isFalling || isPlummeting)) {410 // jumping-right code411 //FEET412 stroke(1);413 strokeWeight(1);414 fill(93, 173, 235);415 rect(Doraemon.pos_x + 2, Doraemon.pos_y - 16, 8, 14);416 fill(255);417 ellipse(Doraemon.pos_x + 6, Doraemon.pos_y, 8, 10);418 //ARMS419 fill(93, 173, 235);420 stroke(1);421 beginShape();422 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 30);423 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 25);424 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 10);425 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 20);426 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 35);427 endShape();428 noStroke();429 //hands430 fill(255);431 stroke(1);432 ellipse(Doraemon.pos_x - 16, Doraemon.pos_y - 30, 7, 12);433 noStroke();434 //BODY435 fill(93, 173, 235);436 ellipse(Doraemon.pos_x + 4, Doraemon.pos_y - 23, 27, 33);437 stroke(1);438 fill(255);439 ellipse(Doraemon.pos_x + 11, Doraemon.pos_y - 22, 13, 23);440 noStroke();441 //BODYSACK442 stroke(1);443 fill(255);444 arc(Doraemon.pos_x + 11, Doraemon.pos_y - 18, 10, 15, TWO_PI, PI, CHORD);445 noStroke();446 //COLLAR447 fill(255, 0, 0);448 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 30, 30, TWO_PI, PI);449 fill(255, 191, 0);450 ellipse(Doraemon.pos_x + 7, Doraemon.pos_y - 27, 7, 7);451 //head1452 stroke(1);453 fill(93, 173, 235);454 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 35, 45);455 noStroke();456 //head2457 fill(255);458 ellipse(Doraemon.pos_x + 9, Doraemon.pos_y - 52, 17, 37);459 //eyes460 stroke(1);461 strokeWeight(1);462 fill(255);463 ellipse(Doraemon.pos_x + 9, Doraemon.pos_y - 66, 10, 13);464 //nose465 fill(255, 0, 0);466 ellipse(Doraemon.pos_x + 15, Doraemon.pos_y - 60, 7, 7);467 //eye point468 strokeWeight(3);469 point(Doraemon.pos_x + 7, Doraemon.pos_y - 62);470 strokeWeight(1);471 line(472 Doraemon.pos_x + 15,473 Doraemon.pos_y - 56,474 Doraemon.pos_x,475 Doraemon.pos_y - 58476 );477 line(478 Doraemon.pos_x + 15,479 Doraemon.pos_y - 54,480 Doraemon.pos_x,481 Doraemon.pos_y - 54482 );483 line(484 Doraemon.pos_x + 15,485 Doraemon.pos_y - 52,486 Doraemon.pos_x,487 Doraemon.pos_y - 50488 );489 //mouth490 fill(171, 39, 79);491 arc(Doraemon.pos_x + 18, Doraemon.pos_y - 49, 27, 27, HALF_PI, PI);492 } else if (isLeft) {493 // add your walking left code494 stroke(1);495 strokeWeight(1);496 beginShape();497 fill(93, 173, 235);498 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 20);499 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 15);500 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 20);501 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 30);502 vertex(Doraemon.pos_x + 16, Doraemon.pos_y - 25);503 endShape();504 //hands505 fill(255);506 stroke(1);507 ellipse(Doraemon.pos_x + 16, Doraemon.pos_y - 20, 7, 10);508 noStroke();509 //FEET510 fill(93, 173, 235);511 stroke(1);512 rect(Doraemon.pos_x - 15, Doraemon.pos_y - 13, 10, 12);513 rect(Doraemon.pos_x - 3, Doraemon.pos_y - 13, 10, 12);514 stroke(1);515 fill(255);516 ellipse(Doraemon.pos_x - 13, Doraemon.pos_y - 2, 14, 6);517 ellipse(Doraemon.pos_x + 2, Doraemon.pos_y, 14, 6);518 noStroke();519 //BODY520 fill(93, 173, 235);521 ellipse(Doraemon.pos_x - 4, Doraemon.pos_y - 23, 27, 38);522 stroke(1);523 fill(255);524 ellipse(Doraemon.pos_x - 11, Doraemon.pos_y - 22, 13, 28);525 noStroke();526 //BODYSACK527 stroke(1);528 fill(255);529 arc(Doraemon.pos_x - 11, Doraemon.pos_y - 18, 10, 20, TWO_PI, PI, CHORD);530 noStroke();531 //COLLAR532 fill(255, 0, 0);533 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 30, 30, TWO_PI, PI);534 fill(255, 191, 0);535 ellipse(Doraemon.pos_x - 7, Doraemon.pos_y - 27, 7, 7);536 //head1537 stroke(1);538 fill(93, 173, 235);539 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 35, 45);540 noStroke();541 //head2542 fill(255);543 ellipse(Doraemon.pos_x - 9, Doraemon.pos_y - 52, 17, 37);544 //eyes545 stroke(1);546 //strokeWeight(1);547 fill(255);548 ellipse(Doraemon.pos_x - 9, Doraemon.pos_y - 66, 10, 13);549 //nose550 fill(255, 0, 0);551 ellipse(Doraemon.pos_x - 15, Doraemon.pos_y - 60, 7, 7);552 //eye point553 strokeWeight(3);554 point(Doraemon.pos_x - 5, Doraemon.pos_y - 66);555 strokeWeight(1);556 line(557 Doraemon.pos_x - 15,558 Doraemon.pos_y - 56,559 Doraemon.pos_x,560 Doraemon.pos_y - 58561 );562 line(563 Doraemon.pos_x - 15,564 Doraemon.pos_y - 54,565 Doraemon.pos_x,566 Doraemon.pos_y - 54567 );568 line(569 Doraemon.pos_x - 15,570 Doraemon.pos_y - 52,571 Doraemon.pos_x,572 Doraemon.pos_y - 50573 );574 //mouth575 noFill();576 arc(Doraemon.pos_x - 14, Doraemon.pos_y - 50, 17, 25, 0, HALF_PI);577 } else if (isRight) {578 // add your walking right code579 //ARMS580 fill(93, 173, 235);581 stroke(1);582 strokeWeight(1);583 beginShape();584 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 20);585 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 15);586 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 20);587 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 30);588 vertex(Doraemon.pos_x - 16, Doraemon.pos_y - 25);589 endShape();590 //hands591 fill(255);592 stroke(1);593 ellipse(Doraemon.pos_x - 16, Doraemon.pos_y - 20, 7, 10);594 noStroke();595 //FEET596 fill(93, 173, 235);597 stroke(1);598 rect(Doraemon.pos_x + 5, Doraemon.pos_y - 13, 10, 12);599 rect(Doraemon.pos_x - 7, Doraemon.pos_y - 13, 10, 12);600 stroke(1);601 fill(255);602 ellipse(Doraemon.pos_x + 13, Doraemon.pos_y - 2, 14, 6);603 ellipse(Doraemon.pos_x - 2, Doraemon.pos_y, 14, 6);604 noStroke();605 //BODY606 fill(93, 173, 235);607 ellipse(Doraemon.pos_x + 4, Doraemon.pos_y - 23, 27, 38);608 stroke(1);609 fill(255);610 ellipse(Doraemon.pos_x + 11, Doraemon.pos_y - 22, 13, 28);611 noStroke();612 //BODYSACK613 stroke(1);614 fill(255);615 arc(Doraemon.pos_x + 11, Doraemon.pos_y - 18, 10, 20, TWO_PI, PI, CHORD);616 noStroke();617 //COLLAR618 fill(255, 0, 0);619 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 30, 30, TWO_PI, PI);620 fill(255, 191, 0);621 ellipse(Doraemon.pos_x + 7, Doraemon.pos_y - 27, 7, 7);622 //head1623 stroke(1);624 fill(93, 173, 235);625 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 35, 45);626 noStroke();627 //head2628 fill(255);629 ellipse(Doraemon.pos_x + 9, Doraemon.pos_y - 52, 17, 37);630 //eyes631 stroke(1);632 strokeWeight(1);633 fill(255);634 ellipse(Doraemon.pos_x + 9, Doraemon.pos_y - 66, 10, 13);635 //nose636 fill(255, 0, 0);637 ellipse(Doraemon.pos_x + 15, Doraemon.pos_y - 60, 7, 7);638 //eye point639 strokeWeight(3);640 point(Doraemon.pos_x + 5, Doraemon.pos_y - 66);641 strokeWeight(1);642 line(643 Doraemon.pos_x + 15,644 Doraemon.pos_y - 56,645 Doraemon.pos_x,646 Doraemon.pos_y - 58647 );648 line(649 Doraemon.pos_x + 15,650 Doraemon.pos_y - 54,651 Doraemon.pos_x,652 Doraemon.pos_y - 54653 );654 line(655 Doraemon.pos_x + 15,656 Doraemon.pos_y - 52,657 Doraemon.pos_x,658 Doraemon.pos_y - 50659 );660 //mouth661 noFill();662 arc(Doraemon.pos_x + 14, Doraemon.pos_y - 50, 17, 25, HALF_PI, PI);663 } else if (isFalling || isPlummeting) {664 // add your jumping facing forwards code665 noStroke();666 strokeWeight(1);667 //FEET668 fill(93, 173, 235);669 rect(Doraemon.pos_x - 15, Doraemon.pos_y - 13, 10, 12);670 rect(Doraemon.pos_x + 5, Doraemon.pos_y - 13, 10, 12);671 stroke(1);672 fill(255);673 ellipse(Doraemon.pos_x - 10, Doraemon.pos_y - 1, 14, 7);674 ellipse(Doraemon.pos_x + 10, Doraemon.pos_y - 1, 14, 7);675 noStroke();676 //ARMS677 fill(93, 173, 235);678 beginShape();679 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 15);680 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 15);681 vertex(Doraemon.pos_x + 20, Doraemon.pos_y - 40);682 vertex(Doraemon.pos_x + 25, Doraemon.pos_y - 35);683 vertex(Doraemon.pos_x + 20, Doraemon.pos_y - 25);684 endShape();685 beginShape();686 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 15);687 vertex(Doraemon.pos_x + 0, Doraemon.pos_y - 15);688 vertex(Doraemon.pos_x - 20, Doraemon.pos_y - 40);689 vertex(Doraemon.pos_x - 24, Doraemon.pos_y - 35);690 vertex(Doraemon.pos_x - 20, Doraemon.pos_y - 25);691 endShape();692 //hands693 fill(255);694 stroke(1);695 ellipse(Doraemon.pos_x + 21, Doraemon.pos_y - 35, 7, 10);696 ellipse(Doraemon.pos_x - 21, Doraemon.pos_y - 35, 7, 10);697 noStroke();698 //BODY699 fill(93, 173, 235);700 ellipse(Doraemon.pos_x, Doraemon.pos_y - 23, 40, 38);701 stroke(1);702 fill(255);703 ellipse(Doraemon.pos_x, Doraemon.pos_y - 22, 33, 33);704 noStroke();705 //BODYSACK706 stroke(1);707 fill(255);708 arc(Doraemon.pos_x, Doraemon.pos_y - 18, 25, 20, TWO_PI, PI, CHORD);709 noStroke();710 //COLLAR711 fill(255, 0, 0);712 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 35, 30, TWO_PI, PI);713 fill(255, 191, 0);714 ellipse(Doraemon.pos_x, Doraemon.pos_y - 27, 7, 7);715 //head1716 fill(93, 173, 235);717 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 45, 45);718 //head2719 fill(255);720 ellipse(Doraemon.pos_x, Doraemon.pos_y - 50, 37, 37);721 //mouth722 stroke(1);723 fill(229, 43, 80);724 arc(Doraemon.pos_x, Doraemon.pos_y - 48, 30, 27, TWO_PI, PI);725 //moustache726 line(727 Doraemon.pos_x + 5,728 Doraemon.pos_y - 56,729 Doraemon.pos_x + 14,730 Doraemon.pos_y - 58731 );732 line(733 Doraemon.pos_x + 5,734 Doraemon.pos_y - 54,735 Doraemon.pos_x + 14,736 Doraemon.pos_y - 54737 );738 line(739 Doraemon.pos_x + 5,740 Doraemon.pos_y - 52,741 Doraemon.pos_x + 14,742 Doraemon.pos_y - 50743 );744 line(745 Doraemon.pos_x - 5,746 Doraemon.pos_y - 56,747 Doraemon.pos_x - 14,748 Doraemon.pos_y - 58749 );750 line(751 Doraemon.pos_x - 5,752 Doraemon.pos_y - 54,753 Doraemon.pos_x - 14,754 Doraemon.pos_y - 54755 );756 line(757 Doraemon.pos_x - 5,758 Doraemon.pos_y - 52,759 Doraemon.pos_x - 14,760 Doraemon.pos_y - 50761 );762 //eyes763 stroke(1);764 strokeWeight(1);765 fill(255);766 ellipse(Doraemon.pos_x + 5, Doraemon.pos_y - 66, 10, 13);767 ellipse(Doraemon.pos_x - 5, Doraemon.pos_y - 66, 10, 13);768 line(769 Doraemon.pos_x,770 Doraemon.pos_y - 50,771 Doraemon.pos_x,772 Doraemon.pos_y - 63773 );774 //nose775 fill(255, 0, 0);776 ellipse(Doraemon.pos_x, Doraemon.pos_y - 60, 7, 7);777 //eye point778 strokeWeight(3);779 point(Doraemon.pos_x + 5, Doraemon.pos_y - 66);780 point(Doraemon.pos_x - 5, Doraemon.pos_y - 66);781 } else {782 // add your standing front facing code783 noStroke();784 strokeWeight(1);785 //FEET786 fill(93, 173, 235);787 rect(Doraemon.pos_x - 15, Doraemon.pos_y - 13, 10, 12);788 rect(Doraemon.pos_x + 5, Doraemon.pos_y - 13, 10, 12);789 stroke(1);790 fill(255);791 ellipse(Doraemon.pos_x - 10, Doraemon.pos_y, 14, 6);792 ellipse(Doraemon.pos_x + 10, Doraemon.pos_y, 14, 6);793 noStroke();794 //BODY795 fill(93, 173, 235);796 ellipse(Doraemon.pos_x, Doraemon.pos_y - 23, 40, 38);797 stroke(1);798 fill(255);799 ellipse(Doraemon.pos_x, Doraemon.pos_y - 22, 33, 33);800 noStroke();801 //ARMS802 fill(93, 173, 235);803 beginShape();804 vertex(Doraemon.pos_x, Doraemon.pos_y - 15);805 vertex(Doraemon.pos_x + 3, Doraemon.pos_y - 15);806 vertex(Doraemon.pos_x + 13, Doraemon.pos_y - 30);807 vertex(Doraemon.pos_x + 19, Doraemon.pos_y - 25);808 vertex(Doraemon.pos_x + 10, Doraemon.pos_y - 15);809 endShape();810 beginShape();811 vertex(Doraemon.pos_x - 3, Doraemon.pos_y - 15);812 vertex(Doraemon.pos_x - 13, Doraemon.pos_y - 30);813 vertex(Doraemon.pos_x - 19, Doraemon.pos_y - 25);814 vertex(Doraemon.pos_x - 10, Doraemon.pos_y - 15);815 endShape();816 //BODYSACK817 stroke(1);818 fill(255);819 arc(Doraemon.pos_x, Doraemon.pos_y - 18, 25, 20, TWO_PI, PI, CHORD);820 noStroke();821 //COLLAR822 fill(255, 0, 0);823 arc(Doraemon.pos_x, Doraemon.pos_y - 42, 35, 30, TWO_PI, PI);824 fill(255, 191, 0);825 ellipse(Doraemon.pos_x, Doraemon.pos_y - 27, 7, 7);826 //head1827 fill(93, 173, 235);828 ellipse(Doraemon.pos_x, Doraemon.pos_y - 53, 45, 45);829 //head2830 fill(255);831 ellipse(Doraemon.pos_x, Doraemon.pos_y - 50, 37, 37);832 //mouth833 stroke(1);834 noFill();835 arc(Doraemon.pos_x, Doraemon.pos_y - 48, 30, 27, TWO_PI, PI);836 //eyes837 stroke(1);838 strokeWeight(1);839 fill(255);840 ellipse(Doraemon.pos_x + 5, Doraemon.pos_y - 66, 10, 13);841 ellipse(Doraemon.pos_x - 5, Doraemon.pos_y - 66, 10, 13);842 line(843 Doraemon.pos_x,844 Doraemon.pos_y - 50,845 Doraemon.pos_x,846 Doraemon.pos_y - 63847 );848 //nose849 fill(255, 0, 0);850 ellipse(Doraemon.pos_x, Doraemon.pos_y - 60, 7, 7);851 //moustache852 line(853 Doraemon.pos_x + 5,854 Doraemon.pos_y - 56,855 Doraemon.pos_x + 14,856 Doraemon.pos_y - 58857 );858 line(859 Doraemon.pos_x + 5,860 Doraemon.pos_y - 54,861 Doraemon.pos_x + 14,862 Doraemon.pos_y - 54863 );864 line(865 Doraemon.pos_x + 5,866 Doraemon.pos_y - 52,867 Doraemon.pos_x + 14,868 Doraemon.pos_y - 50869 );870 line(871 Doraemon.pos_x - 5,872 Doraemon.pos_y - 56,873 Doraemon.pos_x - 14,874 Doraemon.pos_y - 58875 );876 line(877 Doraemon.pos_x - 5,878 Doraemon.pos_y - 54,879 Doraemon.pos_x - 14,880 Doraemon.pos_y - 54881 );882 line(883 Doraemon.pos_x - 5,884 Doraemon.pos_y - 52,885 Doraemon.pos_x - 14,886 Doraemon.pos_y - 50887 );888 //eye point889 strokeWeight(3);890 point(Doraemon.pos_x + 5, Doraemon.pos_y - 66);891 point(Doraemon.pos_x - 5, Doraemon.pos_y - 66);892 }893}894// ---------------------------895// Background render functions896// ---------------------------897// Function to draw mountains objects.898function drawMountains() {899 for (var i = 0; i < mountains.length; i++) {900 stroke(1);901 fill(17, 96, 98);902 ellipse(903 mountains[i].pos_x,904 mountains[i].pos_y,905 mountains[i].width,906 mountains[i].height,907 PI,908 PI909 );910 }911}912// Function to draw trees objects.913function drawTrees() {914 //TREE trunk915 for (var i = 0; i < trees.length; i++) {916 stroke(1);917 fill(83, 27, 0);918 rect(919 trees[i].pos_x,920 trees[i].pos_y + 33,921 trees[i].trunkWidth,922 trees[i].trunkHeight923 );924 //TREE leaf925 noStroke();926 fill(135, 169, 107);927 triangle(928 trees[i].pos_x - 85,929 trees[i].pos_y + 62,930 trees[i].pos_x + 5,931 trees[i].pos_y - 170,932 trees[i].pos_x + 95,933 trees[i].pos_y + 62934 );935 fill(189, 183, 107);936 triangle(937 trees[i].pos_x - 75,938 trees[i].pos_y + 62,939 trees[i].pos_x + 15,940 trees[i].pos_y - 150,941 trees[i].pos_x + 105,942 trees[i].pos_y + 62943 );944 //GRASS beneath TREE945 stroke(1);946 fill(233, 116, 81);947 beginShape();948 vertex(trees[i].pos_x - 25, trees[i].pos_y + 132);949 vertex(trees[i].pos_x - 15, trees[i].pos_y + 122);950 vertex(trees[i].pos_x - 5, trees[i].pos_y + 132);951 vertex(trees[i].pos_x + 5, trees[i].pos_y + 122);952 vertex(trees[i].pos_x + 15, trees[i].pos_y + 132);953 vertex(trees[i].pos_x + 25, trees[i].pos_y + 122);954 vertex(trees[i].pos_x + 35, trees[i].pos_y + 132);955 vertex(trees[i].pos_x + 45, trees[i].pos_y + 122);956 vertex(trees[i].pos_x + 55, trees[i].pos_y + 132);957 endShape();958 }959}960function drawGround() {961 beginShape();962 vertex(0, floorPos_y); //Generate new floor going from x=0 backward963 vertex(0, height);964 vertex(0 - scrollPos, height);965 vertex(0 - scrollPos, floorPos_y);966 endShape();967 beginShape();968 vertex(400, height); //Starting new floor at x=400969 vertex(400, floorPos_y);970 vertex(600, 432); //ZigZag1971 vertex(610, 422);972 vertex(620, 432);973 vertex(630, 422);974 vertex(640, 432);975 vertex(890, 432); //ZigZag2976 vertex(900, 422);977 vertex(910, 432);978 vertex(920, 422);979 vertex(930, 432);980 vertex(width, floorPos_y);981 vertex(width, height);982 endShape();983 beginShape();984 vertex(1760, floorPos_y); //Generate new floor from x=1760 forward985 vertex(1760, height);986 vertex(width - scrollPos, height);987 vertex(width - scrollPos, floorPos_y);988 endShape();989}990// ---------------------------------991// Canyon render and check functions992// ---------------------------------993// Function to draw canyon objects.994function drawCanyon(t_canyon) {995 noStroke();996 fill(233, 116, 81);997 beginShape();998 vertex(t_canyon.pos_x - t_canyon.width, height); //START canyon999 vertex(t_canyon.pos_x - t_canyon.width, floorPos_y);1000 vertex(t_canyon.pos_x, 432); //ZigZag1001 vertex(t_canyon.pos_x + 10, 422);1002 vertex(t_canyon.pos_x + 20, 432);1003 vertex(t_canyon.pos_x + 30, 422);1004 vertex(t_canyon.pos_x + 40, 432);1005 vertex(t_canyon.pos_x + 210, 432); //ZigZag1006 vertex(t_canyon.pos_x + 220, 422);1007 vertex(t_canyon.pos_x + 230, 432);1008 vertex(t_canyon.pos_x + 240, 422);1009 vertex(t_canyon.pos_x + 250, 432);1010 vertex(t_canyon.pos_x + 250 + t_canyon.width, floorPos_y);1011 vertex(t_canyon.pos_x + 250 + t_canyon.width, height); //END CANYON1012 endShape();1013}1014// Function to check character is over a canyon.1015function checkCanyon(t_canyon) {1016 var start = t_canyon.pos_x - t_canyon.width;1017 var end = t_canyon.pos_x + 250 + t_canyon.width;1018 if (1019 isContact ||1020 Doraemon.pos_y < floorPos_y ||1021 (gameChar_world_x > start && gameChar_world_x < end) ||1022 (gameChar_world_x > 400 && gameChar_world_x < width) ||1023 (gameChar_world_x < 0 && gameChar_world_x < t_canyon.pos_x) ||1024 (gameChar_world_x > t_canyon.pos_x && gameChar_world_x > 1760)1025 ) {1026 isPlummeting = false;1027 } else if (1028 ((!isContact || Doraemon.pos_y > floorPos_y) &&1029 (gameChar_world_x > end || gameChar_world_x > t_canyon.pos_x) &&1030 (gameChar_world_x > start || gameChar_world_x < start)) ||1031 (gameChar_world_x < start && gameChar_world_x < 60)1032 ) {1033 isPlummeting = true;1034 }1035}1036// ----------------------------------1037// Collectable items render and check functions1038// ----------------------------------1039// Function to draw collectable objects.1040function drawCollectable(t_collectable) {1041 stroke(59, 122, 87);1042 strokeWeight(7);1043 noFill();1044 arc(1045 t_collectable.pos_x,1046 t_collectable.pos_y - 15,1047 90 / 2,1048 80 / 2,1049 QUARTER_PI - HALF_PI,1050 HALF_PI1051 );1052 arc(1053 t_collectable.pos_x - 5,1054 t_collectable.pos_y - 35,1055 89 / 2,1056 90 / 2,1057 TWO_PI,1058 HALF_PI1059 );1060 noStroke();1061 stroke(175, 0, 40);1062 strokeWeight(3);1063 fill(222, 49, 99);1064 ellipse(t_collectable.pos_x - 5, t_collectable.pos_y - 10, 35 / 2, 35 / 2);1065 ellipse(t_collectable.pos_x, t_collectable.pos_y, 35 / 2, 35 / 2);1066}1067// Function to check character has collected an item.1068function checkCollectable(t_collectable) {1069 var d = dist(1070 gameChar_world_x,1071 Doraemon.pos_y,1072 t_collectable.pos_x,1073 t_collectable.pos_y1074 );1075 if (d < 20) {1076 t_collectable.isFound = true;1077 game_score += 1;1078 collectableSound.play();1079 }1080}1081function renderFlagpole() {1082 push();1083 strokeWeight(5);1084 stroke(100);1085 line(flagpole.x_pos, floorPos_y, flagpole.x_pos, floorPos_y - 250);1086 fill(255, 0, 255);1087 noStroke();1088 if (flagpole.isReached) {1089 rect(flagpole.x_pos, floorPos_y - 250, 50, 50);1090 } else {1091 rect(flagpole.x_pos, floorPos_y - 50, 50, 50);1092 }1093 pop();1094}1095function checkFlagpole() {1096 var d = abs(gameChar_world_x - flagpole.x_pos);1097 if (d < 15) {1098 flagpole.isReached = true;1099 backgroundSound.stop();1100 reachFlagpole.play();1101 }1102}1103function checkPlayerDie() {1104 for (var i = lives; i > 0; i--) {1105 if (1106 enemyContact ||1107 (Doraemon.pos_y > floorPos_y && Doraemon.pos_y > height)1108 ) {1109 lives--;1110 backgroundSound.stop();1111 enemySound.play();1112 if (lives > 0) {1113 startGame();1114 break;1115 } else if (lives < 1) {1116 gameoverSound.play();1117 plummentingSound.stop();1118 }1119 }1120 }1121}1122function scoreBoard(x, y) {1123 //COLLAR1124 noStroke();1125 fill(255, 0, 0);1126 arc(x, y - 42, 35, 30, TWO_PI, PI);1127 fill(255, 191, 0);1128 ellipse(x, y - 27, 7, 7);1129 //head11130 fill(93, 173, 235);1131 ellipse(x, y - 53, 45, 45);1132 //head21133 fill(255);1134 ellipse(x, y - 50, 37, 37);1135 //mouth1136 stroke(1);1137 strokeWeight(1);1138 noFill();1139 arc(x, y - 48, 30, 27, TWO_PI, PI);1140 //eyes1141 stroke(1);1142 strokeWeight(1);1143 fill(255);1144 ellipse(x + 5, y - 66, 10, 13);1145 ellipse(x - 5, y - 66, 10, 13);1146 line(x, y - 50, x, y - 63);1147 //nose1148 fill(255, 0, 0);1149 ellipse(x, y - 60, 7, 7);1150 //moustache1151 line(x + 5, y - 56, x + 14, y - 58);1152 line(x + 5, y - 54, x + 14, y - 54);1153 line(x + 5, y - 52, x + 14, y - 50);1154 line(x - 5, y - 56, x - 14, y - 58);1155 line(x - 5, y - 54, x - 14, y - 54);1156 line(x - 5, y - 52, x - 14, y - 50);1157 //eye point1158 strokeWeight(3);1159 point(x + 5, y - 66);1160 point(x - 5, y - 66);1161}1162function InitSceneryObjects() {1163 //clouds1164 for (var i = 0; i < 5; i++) {1165 clouds.push(createClouds());1166 }1167}1168function createClouds(x, y) {1169 var c = {1170 pos: undefined,1171 dir: undefined,1172 size: random(0.6, 1),1173 setup: function () {1174 this.pos = createVector(random(0, width), random(0, 150));1175 this.dir = createVector(random(-1, 1), random(-1, 1));1176 this.dir.normalize();1177 },1178 draw: function () {1179 push();1180 translate(this.pos.x, this.pos.y);1181 //Drawing code1182 fill(97, 144, 181, 150);1183 noStroke();1184 ellipse(0, 0 + 70 * this.size, this.size * 100, this.size * 80);1185 ellipse(1186 0 + 20 * this.size,1187 0 + 20 * this.size,1188 this.size * 80,1189 this.size * 751190 );1191 ellipse(1192 0 + 80 * this.size,1193 0 + 40 * this.size,1194 this.size * 120,1195 this.size * 1201196 );1197 ellipse(1198 0 + 147 * this.size,1199 0 + 56 * this.size,1200 this.size * 90,1201 this.size * 801202 );1203 stroke(124, 185, 232, 180);1204 strokeWeight(4);1205 fill(255, 255, 255);1206 ellipse(1207 0 + 90 * this.size,1208 0 + 20 * this.size,1209 this.size * 125,1210 this.size * 1401211 );1212 ellipse(1213 0 + 35 * this.size,1214 0 + 20 * this.size,1215 this.size * 85,1216 this.size * 801217 );1218 ellipse(1219 0 + 12 * this.size,1220 0 + 60 * this.size,1221 this.size * 100,1222 this.size * 701223 );1224 ellipse(1225 0 + 137 * this.size,1226 0 + 50 * this.size,1227 this.size * 105,1228 this.size * 701229 );1230 ellipse(1231 0 + 145 * this.size,1232 0 + 15 * this.size,1233 this.size * 70,1234 this.size * 701235 );1236 fill(255);1237 arc(1238 0 + 85 * this.size,1239 0 + 60 * this.size,1240 this.size * 120,1241 this.size * 130,1242 PI,1243 TWO_PI1244 );1245 pop();1246 },1247 update: function () {1248 this.pos.x += random(-0.2, 0.5);1249 this.pos.y += random(-0.2, 0.2);1250 //Constrain direction1251 this.dir = constrain(this.dir, 0, 60);1252 this.pos.add(this.dir);1253 this.screenWrap();1254 },1255 screenWrap: function () {1256 if (this.pos.x > width + screenBorder) {1257 this.pos.x -= width + screenBorder;1258 } else if (this.pos.x < -screenBorder) {1259 this.pos.x += width + screenBorder;1260 }1261 if (this.pos.y > height + screenBorder) {1262 this.pos.y -= height + screenBorder;1263 } else if (this.pos.y < -screenBorder) {1264 this.pos.y += height + screenBorder;1265 }1266 },1267 };1268 //calling the setup1269 c.setup(x, y);1270 return c;1271}1272//Factory pattern = The function returns Object (p)1273function createPlatforms(x, y, l) {1274 var p = {1275 x: x,1276 y: y,1277 l: l,1278 draw: function () {1279 fill(233, 116, 81);1280 stroke(1);1281 strokeWeight(3);1282 rect(this.x, this.y, this.l, 20);1283 },1284 checkContact: function (gamec_x, gamec_y) {1285 if (gamec_x > this.x && gamec_x < this.x + l) {1286 //distance between platform and gamec_y1287 var d = this.y - gamec_y;1288 if (d >= 0 && d < 5) {1289 return true;1290 }1291 return false;1292 }1293 },1294 };1295 return p;1296}1297function create_Moving_Platforms(x, y, l, range) {1298 var p = {1299 x: x,1300 y: y,1301 l: l,1302 range: range,1303 inc: 1,1304 xPos: x,1305 draw: function () {1306 this.update();1307 fill(233, 116, 81);1308 stroke(1);1309 strokeWeight(3);1310 rect(this.x, this.y, this.l, 20);1311 },1312 checkContact: function (gamec_x, gamec_y) {1313 if (gamec_x > this.x && gamec_x < this.x + l) {1314 //distance between platform and gamec_y1315 var d = this.y - gamec_y;1316 if (d >= 0 && d < 5) {1317 return true;1318 }1319 return false;1320 }1321 },1322 update: function () {1323 this.x += this.inc;1324 if (this.x >= width) {1325 this.inc -= 1;1326 } else if (this.x < this.xPos) {1327 this.inc += 1;1328 }1329 },1330 };1331 return p;1332}1333//Constructor Function for defining enemies1334function Enemy(x, y, range) {1335 this.x = x;1336 this.y = y;1337 this.range = range;1338 this.currentX = x;1339 this.inc = 1;1340 this.update = function () {1341 //moving enemy by 1 each frame1342 this.currentX += this.inc;1343 if (this.currentX >= this.x + this.range) {1344 //moving back enemy1345 this.inc -= 1;1346 } else if (this.currentX < this.x) {1347 this.inc = 1;1348 }1349 };1350 this.draw = function () {1351 this.update();1352 fill(255, 0, 0);1353 ellipse(this.currentX, this.y, 20, 20);1354 };1355 this.checkContact = function (gc_x, gc_y) {1356 var d = dist(gc_x, gc_y, this.currentX, this.y);1357 console.log(d);1358 if (d < 20) {1359 return true;1360 }1361 return false;1362 };1363}1364//Function for checking if the player won or lost1365function checkGameState() {1366 if (flagpole.isReached || lives < 1) {1367 if (keyCode == " " || keyCode == " 32") {1368 lives = 3;1369 startGame();1370 }1371 }1372 return;...

Full Screen

Full Screen

paths.js

Source:paths.js Github

copy

Full Screen

1var initPaths = [{2 "index": 59,3 "particles": [{4 "pos_x": 106,5 "pos_y": 1476 }, {7 "pos_x": 132,8 "pos_y": 1479 }, {10 "pos_x": 133,11 "pos_y": 17112 }, {13 "pos_x": 106,14 "pos_y": 17815 }, {16 "pos_x": 131,17 "pos_y": 19218 }, {19 "pos_x": 106,20 "pos_y": 21521 }, {22 "pos_x": 131,23 "pos_y": 21724 }, {25 "pos_x": 106,26 "pos_y": 23827 }, {28 "pos_x": 134,29 "pos_y": 23730 }, {31 "pos_x": 117,32 "pos_y": 25233 }, {34 "pos_x": 131,35 "pos_y": 25336 }, {37 "pos_x": 120,38 "pos_y": 14939 }]40}, {41 "index": 1,42 "particles": [{43 "pos_x": 82,44 "pos_y": 17145 }, {46 "pos_x": 82,47 "pos_y": 19048 }, {49 "pos_x": 98,50 "pos_y": 17251 }, {52 "pos_x": 106,53 "pos_y": 19154 }, {55 "pos_x": 123,56 "pos_y": 17557 }, {58 "pos_x": 139,59 "pos_y": 18760 }, {61 "pos_x": 143,62 "pos_y": 17163 }, {64 "pos_x": 159,65 "pos_y": 18966 }, {67 "pos_x": 166,68 "pos_y": 17169 }, {70 "pos_x": 167,71 "pos_y": 18972 }]73}, {74 "index": 2,75 "particles": [{76 "pos_x": 170,77 "pos_y": 23478 }, {79 "pos_x": 171,80 "pos_y": 25381 }, {82 "pos_x": 152,83 "pos_y": 25384 }, {85 "pos_x": 142,86 "pos_y": 23587 }, {88 "pos_x": 131,89 "pos_y": 25290 }, {91 "pos_x": 134,92 "pos_y": 23493 }]94}, {95 "index": 3,96 "particles": [{97 "pos_x": 182,98 "pos_y": 13999 }, {100 "pos_x": 208,101 "pos_y": 139102 }, {103 "pos_x": 210,104 "pos_y": 164105 }, {106 "pos_x": 209,107 "pos_y": 183108 }, {109 "pos_x": 182,110 "pos_y": 167111 }, {112 "pos_x": 182,113 "pos_y": 193114 }, {115 "pos_x": 209,116 "pos_y": 205117 }, {118 "pos_x": 183,119 "pos_y": 220120 }, {121 "pos_x": 208,122 "pos_y": 228123 }, {124 "pos_x": 182,125 "pos_y": 235126 }, {127 "pos_x": 182,128 "pos_y": 254129 }, {130 "pos_x": 208,131 "pos_y": 255132 }]133}, {134 "index": 4,135 "particles": [{136 "pos_x": 210,137 "pos_y": 172138 }, {139 "pos_x": 210,140 "pos_y": 189141 }, {142 "pos_x": 229,143 "pos_y": 190144 }, {145 "pos_x": 228,146 "pos_y": 172147 }, {148 "pos_x": 246,149 "pos_y": 172150 }, {151 "pos_x": 247,152 "pos_y": 189153 }, {154 "pos_x": 261,155 "pos_y": 172156 }, {157 "pos_x": 275,158 "pos_y": 176159 }, {160 "pos_x": 272,161 "pos_y": 192162 }, {163 "pos_x": 286,164 "pos_y": 192165 }, {166 "pos_x": 282,167 "pos_y": 181168 }]169}, {170 "index": 5,171 "particles": [{172 "pos_x": 258,173 "pos_y": 253174 }, {175 "pos_x": 285,176 "pos_y": 253177 }, {178 "pos_x": 285,179 "pos_y": 234180 }, {181 "pos_x": 258,182 "pos_y": 229183 }, {184 "pos_x": 259,185 "pos_y": 211186 }, {187 "pos_x": 285,188 "pos_y": 209189 }, {190 "pos_x": 284,191 "pos_y": 193192 }, {193 "pos_x": 258,194 "pos_y": 193195 }, {196 "pos_x": 272,197 "pos_y": 253198 }, {199 "pos_x": 271,200 "pos_y": 193201 }]202}, {203 "index": 6,204 "particles": [{205 "pos_x": 327,206 "pos_y": 200207 }, {208 "pos_x": 326,209 "pos_y": 172210 }, {211 "pos_x": 312,212 "pos_y": 178213 }, {214 "pos_x": 302,215 "pos_y": 189216 }, {217 "pos_x": 297,218 "pos_y": 203219 }, {220 "pos_x": 297,221 "pos_y": 216222 }, {223 "pos_x": 302,224 "pos_y": 233225 }, {226 "pos_x": 308,227 "pos_y": 243228 }, {229 "pos_x": 327,230 "pos_y": 225231 }, {232 "pos_x": 319,233 "pos_y": 249234 }]235}, {236 "index": 7,237 "particles": [{238 "pos_x": 329,239 "pos_y": 197240 }, {241 "pos_x": 336,242 "pos_y": 189243 }, {244 "pos_x": 348,245 "pos_y": 179246 }, {247 "pos_x": 349,248 "pos_y": 172249 }, {250 "pos_x": 327,251 "pos_y": 172252 }, {253 "pos_x": 348,254 "pos_y": 169255 }]256}, {257 "index": 8,258 "particles": [{259 "pos_x": 329,260 "pos_y": 220261 }, {262 "pos_x": 327,263 "pos_y": 201264 }, {265 "pos_x": 346,266 "pos_y": 203267 }, {268 "pos_x": 350,269 "pos_y": 220270 }, {271 "pos_x": 365,272 "pos_y": 203273 }, {274 "pos_x": 372,275 "pos_y": 219276 }, {277 "pos_x": 384,278 "pos_y": 202279 }, {280 "pos_x": 395,281 "pos_y": 217282 }, {283 "pos_x": 404,284 "pos_y": 217285 }, {286 "pos_x": 328,287 "pos_y": 213288 }]289}, {290 "index": 9,291 "particles": [{292 "pos_x": 319,293 "pos_y": 250294 }, {295 "pos_x": 333,296 "pos_y": 254297 }, {298 "pos_x": 352,299 "pos_y": 254300 }, {301 "pos_x": 373,302 "pos_y": 254303 }, {304 "pos_x": 328,305 "pos_y": 228306 }, {307 "pos_x": 340,308 "pos_y": 237309 }, {310 "pos_x": 354,311 "pos_y": 249312 }]313}, {314 "index": 10,315 "particles": [{316 "pos_x": 339,317 "pos_y": 236318 }, {319 "pos_x": 374,320 "pos_y": 254321 }, {322 "pos_x": 381,323 "pos_y": 237324 }, {325 "pos_x": 395,326 "pos_y": 254327 }, {328 "pos_x": 367,329 "pos_y": 239330 }, {331 "pos_x": 411,332 "pos_y": 237333 }, {334 "pos_x": 413,335 "pos_y": 253336 }]337}, {338 "index": 11,339 "particles": [{340 "pos_x": 393,341 "pos_y": 220342 }, {343 "pos_x": 388,344 "pos_y": 202345 }, {346 "pos_x": 392,347 "pos_y": 191348 }, {349 "pos_x": 409,350 "pos_y": 213351 }, {352 "pos_x": 414,353 "pos_y": 206354 }, {355 "pos_x": 416,356 "pos_y": 191357 }, {358 "pos_x": 412,359 "pos_y": 182360 }]361}, {362 "index": 12,363 "particles": [{364 "pos_x": 340,365 "pos_y": 189366 }, {367 "pos_x": 363,368 "pos_y": 189369 }, {370 "pos_x": 350,371 "pos_y": 171372 }, {373 "pos_x": 369,374 "pos_y": 172375 }, {376 "pos_x": 380,377 "pos_y": 187378 }, {379 "pos_x": 386,380 "pos_y": 171381 }, {382 "pos_x": 390,383 "pos_y": 190384 }, {385 "pos_x": 399,386 "pos_y": 172387 }, {388 "pos_x": 408,389 "pos_y": 177390 }, {391 "pos_x": 412,392 "pos_y": 182393 }]394}, {395 "index": 13,396 "particles": [{397 "pos_x": 587,398 "pos_y": 169399 }, {400 "pos_x": 587,401 "pos_y": 187402 }, {403 "pos_x": 559,404 "pos_y": 188405 }, {406 "pos_x": 553,407 "pos_y": 171408 }, {409 "pos_x": 540,410 "pos_y": 188411 }, {412 "pos_x": 530,413 "pos_y": 170414 }, {415 "pos_x": 517,416 "pos_y": 186417 }, {418 "pos_x": 587,419 "pos_y": 179420 }, {421 "pos_x": 507,422 "pos_y": 171423 }, {424 "pos_x": 509,425 "pos_y": 192426 }, {427 "pos_x": 496,428 "pos_y": 173429 }, {430 "pos_x": 485,431 "pos_y": 183432 }]433}, {434 "index": 14,435 "particles": [{436 "pos_x": 508,437 "pos_y": 197438 }, {439 "pos_x": 508,440 "pos_y": 191441 }, {442 "pos_x": 484,443 "pos_y": 185444 }, {445 "pos_x": 481,446 "pos_y": 197447 }, {448 "pos_x": 484,449 "pos_y": 208450 }, {451 "pos_x": 494,452 "pos_y": 217453 }, {454 "pos_x": 506,455 "pos_y": 221456 }]457}, {458 "index": 15,459 "particles": [{460 "pos_x": 510,461 "pos_y": 201462 }, {463 "pos_x": 521,464 "pos_y": 204465 }, {466 "pos_x": 528,467 "pos_y": 221468 }, {469 "pos_x": 507,470 "pos_y": 221471 }, {472 "pos_x": 540,473 "pos_y": 203474 }, {475 "pos_x": 551,476 "pos_y": 219477 }, {478 "pos_x": 561,479 "pos_y": 203480 }, {481 "pos_x": 567,482 "pos_y": 220483 }, {484 "pos_x": 583,485 "pos_y": 205486 }, {487 "pos_x": 594,488 "pos_y": 218489 }, {490 "pos_x": 592,491 "pos_y": 211492 }, {493 "pos_x": 507,494 "pos_y": 214495 }]496}, {497 "index": 16,498 "particles": [{499 "pos_x": 595,500 "pos_y": 219501 }, {502 "pos_x": 597,503 "pos_y": 230504 }, {505 "pos_x": 593,506 "pos_y": 240507 }, {508 "pos_x": 569,509 "pos_y": 227510 }, {511 "pos_x": 564,512 "pos_y": 223513 }, {514 "pos_x": 587,515 "pos_y": 249516 }, {517 "pos_x": 579,518 "pos_y": 251519 }, {520 "pos_x": 581,521 "pos_y": 235522 }]523}, {524 "index": 17,525 "particles": [{526 "pos_x": 570,527 "pos_y": 232528 }, {529 "pos_x": 564,530 "pos_y": 237531 }, {532 "pos_x": 562,533 "pos_y": 254534 }, {535 "pos_x": 579,536 "pos_y": 252537 }, {538 "pos_x": 570,539 "pos_y": 249540 }]541}, {542 "index": 18,543 "particles": [{544 "pos_x": 484,545 "pos_y": 237546 }, {547 "pos_x": 484,548 "pos_y": 254549 }, {550 "pos_x": 515,551 "pos_y": 254552 }, {553 "pos_x": 517,554 "pos_y": 236555 }, {556 "pos_x": 542,557 "pos_y": 236558 }, {559 "pos_x": 549,560 "pos_y": 252561 }, {562 "pos_x": 565,563 "pos_y": 236564 }, {565 "pos_x": 563,566 "pos_y": 254567 }, {568 "pos_x": 485,569 "pos_y": 248570 }]571}, {572 "index": 19,573 "particles": [{574 "pos_x": 709,575 "pos_y": 170576 }, {577 "pos_x": 708,578 "pos_y": 188579 }, {580 "pos_x": 683,581 "pos_y": 188582 }, {583 "pos_x": 661,584 "pos_y": 188585 }, {586 "pos_x": 644,587 "pos_y": 189588 }, {589 "pos_x": 639,590 "pos_y": 171591 }, {592 "pos_x": 662,593 "pos_y": 171594 }, {595 "pos_x": 690,596 "pos_y": 171597 }, {598 "pos_x": 615,599 "pos_y": 183600 }, {601 "pos_x": 623,602 "pos_y": 176603 }]604}, {605 "index": 20,606 "particles": [{607 "pos_x": 644,608 "pos_y": 190609 }, {610 "pos_x": 633,611 "pos_y": 200612 }, {613 "pos_x": 605,614 "pos_y": 198615 }, {616 "pos_x": 614,617 "pos_y": 185618 }, {619 "pos_x": 605,620 "pos_y": 212621 }, {622 "pos_x": 609,623 "pos_y": 229624 }, {625 "pos_x": 620,626 "pos_y": 215627 }]628}, {629 "index": 21,630 "particles": [{631 "pos_x": 634,632 "pos_y": 203633 }, {634 "pos_x": 634,635 "pos_y": 221636 }, {637 "pos_x": 627,638 "pos_y": 250639 }, {640 "pos_x": 619,641 "pos_y": 246642 }, {643 "pos_x": 613,644 "pos_y": 237645 }, {646 "pos_x": 609,647 "pos_y": 231648 }, {649 "pos_x": 625,650 "pos_y": 232651 }]652}, {653 "index": 22,654 "particles": [{655 "pos_x": 635,656 "pos_y": 223657 }, {658 "pos_x": 644,659 "pos_y": 235660 }, {661 "pos_x": 646,662 "pos_y": 254663 }, {664 "pos_x": 629,665 "pos_y": 251666 }, {667 "pos_x": 637,668 "pos_y": 252669 }]670}, {671 "index": 23,672 "particles": [{673 "pos_x": 646,674 "pos_y": 252675 }, {676 "pos_x": 671,677 "pos_y": 254678 }, {679 "pos_x": 674,680 "pos_y": 236681 }, {682 "pos_x": 645,683 "pos_y": 234684 }, {685 "pos_x": 647,686 "pos_y": 252687 }, {688 "pos_x": 672,689 "pos_y": 247690 }]691}, {692 "index": 24,693 "particles": [{694 "pos_x": 674,695 "pos_y": 235696 }, {697 "pos_x": 709,698 "pos_y": 235699 }, {700 "pos_x": 708,701 "pos_y": 252702 }, {703 "pos_x": 671,704 "pos_y": 254705 }, {706 "pos_x": 691,707 "pos_y": 254708 }, {709 "pos_x": 667,710 "pos_y": 245711 }]712}, {713 "index": 25,714 "particles": [{715 "pos_x": 802,716 "pos_y": 189717 }, {718 "pos_x": 782,719 "pos_y": 188720 }, {721 "pos_x": 761,722 "pos_y": 189723 }, {724 "pos_x": 746,725 "pos_y": 172726 }, {727 "pos_x": 766,728 "pos_y": 169729 }, {730 "pos_x": 786,731 "pos_y": 169732 }, {733 "pos_x": 812,734 "pos_y": 170735 }, {736 "pos_x": 828,737 "pos_y": 176738 }, {739 "pos_x": 837,740 "pos_y": 188741 }, {742 "pos_x": 727,743 "pos_y": 185744 }, {745 "pos_x": 732,746 "pos_y": 177747 }]748}, {749 "index": 26,750 "particles": [{751 "pos_x": 747,752 "pos_y": 201753 }, {754 "pos_x": 756,755 "pos_y": 188756 }, {757 "pos_x": 721,758 "pos_y": 189759 }, {760 "pos_x": 719,761 "pos_y": 200762 }, {763 "pos_x": 728,764 "pos_y": 184765 }, {766 "pos_x": 718,767 "pos_y": 211768 }]769}, {770 "index": 27,771 "particles": [{772 "pos_x": 807,773 "pos_y": 202774 }, {775 "pos_x": 835,776 "pos_y": 206777 }, {778 "pos_x": 826,779 "pos_y": 217780 }, {781 "pos_x": 831,782 "pos_y": 213783 }, {784 "pos_x": 815,785 "pos_y": 219786 }, {787 "pos_x": 792,788 "pos_y": 219789 }, {790 "pos_x": 782,791 "pos_y": 204792 }, {793 "pos_x": 767,794 "pos_y": 219795 }, {796 "pos_x": 761,797 "pos_y": 203798 }, {799 "pos_x": 747,800 "pos_y": 203801 }, {802 "pos_x": 737,803 "pos_y": 220804 }, {805 "pos_x": 719,806 "pos_y": 221807 }, {808 "pos_x": 719,809 "pos_y": 203810 }, {811 "pos_x": 718,812 "pos_y": 214813 }]814}, {815 "index": 28,816 "particles": [{817 "pos_x": 808,818 "pos_y": 191819 }, {820 "pos_x": 811,821 "pos_y": 197822 }, {823 "pos_x": 837,824 "pos_y": 195825 }, {826 "pos_x": 835,827 "pos_y": 186828 }, {829 "pos_x": 809,830 "pos_y": 204831 }, {832 "pos_x": 836,833 "pos_y": 206834 }, {835 "pos_x": 836,836 "pos_y": 201837 }]838}, {839 "index": 29,840 "particles": [{841 "pos_x": 747,842 "pos_y": 222843 }, {844 "pos_x": 755,845 "pos_y": 234846 }, {847 "pos_x": 754,848 "pos_y": 254849 }, {850 "pos_x": 744,851 "pos_y": 252852 }, {853 "pos_x": 734,854 "pos_y": 247855 }, {856 "pos_x": 725,857 "pos_y": 239858 }, {859 "pos_x": 719,860 "pos_y": 225861 }, {862 "pos_x": 720,863 "pos_y": 223864 }]865}, {866 "index": 30,867 "particles": [{868 "pos_x": 755,869 "pos_y": 234870 }, {871 "pos_x": 782,872 "pos_y": 236873 }, {874 "pos_x": 819,875 "pos_y": 236876 }, {877 "pos_x": 833,878 "pos_y": 236879 }, {880 "pos_x": 834,881 "pos_y": 255882 }, {883 "pos_x": 814,884 "pos_y": 255885 }, {886 "pos_x": 790,887 "pos_y": 255888 }, {889 "pos_x": 750,890 "pos_y": 255891 }, {892 "pos_x": 752,893 "pos_y": 245894 }]895}, {896 "index": 31,897 "particles": [{898 "pos_x": 850,899 "pos_y": 170900 }, {901 "pos_x": 875,902 "pos_y": 170903 }, {904 "pos_x": 878,905 "pos_y": 191906 }, {907 "pos_x": 851,908 "pos_y": 201909 }, {910 "pos_x": 852,911 "pos_y": 185912 }, {913 "pos_x": 877,914 "pos_y": 208915 }, {916 "pos_x": 877,917 "pos_y": 223918 }, {919 "pos_x": 878,920 "pos_y": 242921 }, {922 "pos_x": 877,923 "pos_y": 254924 }, {925 "pos_x": 851,926 "pos_y": 254927 }, {928 "pos_x": 851,929 "pos_y": 233930 }, {931 "pos_x": 862,932 "pos_y": 174933 }]934}, {935 "index": 32,936 "particles": [{937 "pos_x": 926,938 "pos_y": 189939 }, {940 "pos_x": 914,941 "pos_y": 190942 }, {943 "pos_x": 877,944 "pos_y": 190945 }, {946 "pos_x": 868,947 "pos_y": 171948 }, {949 "pos_x": 902,950 "pos_y": 171951 }, {952 "pos_x": 902,953 "pos_y": 180954 }, {955 "pos_x": 929,956 "pos_y": 173957 }, {958 "pos_x": 940,959 "pos_y": 173960 }, {961 "pos_x": 947,962 "pos_y": 178963 }, {964 "pos_x": 952,965 "pos_y": 185966 }, {967 "pos_x": 955,968 "pos_y": 194969 }]970}, {971 "index": 33,972 "particles": [{973 "pos_x": 927,974 "pos_y": 253975 }, {976 "pos_x": 954,977 "pos_y": 254978 }, {979 "pos_x": 954,980 "pos_y": 229981 }, {982 "pos_x": 926,983 "pos_y": 224984 }, {985 "pos_x": 927,986 "pos_y": 195987 }, {988 "pos_x": 953,989 "pos_y": 194990 }, {991 "pos_x": 924,992 "pos_y": 193993 }, {994 "pos_x": 940,995 "pos_y": 198996 }, {997 "pos_x": 942,998 "pos_y": 254999 }]1000}, {1001 "index": 34,1002 "particles": [{1003 "pos_x": 996,1004 "pos_y": 2031005 }, {1006 "pos_x": 1040,1007 "pos_y": 2021008 }, {1009 "pos_x": 1055,1010 "pos_y": 2011011 }, {1012 "pos_x": 1084,1013 "pos_y": 1991014 }, {1015 "pos_x": 1077,1016 "pos_y": 2121017 }, {1018 "pos_x": 1072,1019 "pos_y": 2191020 }, {1021 "pos_x": 1082,1022 "pos_y": 2091023 }, {1024 "pos_x": 1054,1025 "pos_y": 2211026 }, {1027 "pos_x": 1031,1028 "pos_y": 2211029 }, {1030 "pos_x": 1010,1031 "pos_y": 2211032 }, {1033 "pos_x": 991,1034 "pos_y": 2201035 }, {1036 "pos_x": 966,1037 "pos_y": 2201038 }, {1039 "pos_x": 965,1040 "pos_y": 2061041 }]1042}, {1043 "index": 35,1044 "particles": [{1045 "pos_x": 966,1046 "pos_y": 2161047 }, {1048 "pos_x": 973,1049 "pos_y": 1921050 }, {1051 "pos_x": 969,1052 "pos_y": 1941053 }, {1054 "pos_x": 998,1055 "pos_y": 1961056 }, {1057 "pos_x": 997,1058 "pos_y": 2041059 }, {1060 "pos_x": 981,1061 "pos_y": 1811062 }, {1063 "pos_x": 986,1064 "pos_y": 1751065 }, {1066 "pos_x": 995,1067 "pos_y": 1741068 }, {1069 "pos_x": 975,1070 "pos_y": 1841071 }]1072}, {1073 "index": 36,1074 "particles": [{1075 "pos_x": 998,1076 "pos_y": 1931077 }, {1078 "pos_x": 1016,1079 "pos_y": 1811080 }, {1081 "pos_x": 1025,1082 "pos_y": 1691083 }, {1084 "pos_x": 1013,1085 "pos_y": 1681086 }, {1087 "pos_x": 992,1088 "pos_y": 1721089 }, {1090 "pos_x": 988,1091 "pos_y": 1761092 }]1093}, {1094 "index": 37,1095 "particles": [{1096 "pos_x": 1005,1097 "pos_y": 1881098 }, {1099 "pos_x": 1036,1100 "pos_y": 1891101 }, {1102 "pos_x": 1048,1103 "pos_y": 1701104 }, {1105 "pos_x": 1033,1106 "pos_y": 1691107 }, {1108 "pos_x": 1024,1109 "pos_y": 1691110 }, {1111 "pos_x": 1057,1112 "pos_y": 1861113 }, {1114 "pos_x": 1072,1115 "pos_y": 1731116 }]1117}, {1118 "index": 38,1119 "particles": [{1120 "pos_x": 1055,1121 "pos_y": 2011122 }, {1123 "pos_x": 1059,1124 "pos_y": 1931125 }, {1126 "pos_x": 1073,1127 "pos_y": 1731128 }, {1129 "pos_x": 1082,1130 "pos_y": 1831131 }, {1132 "pos_x": 1086,1133 "pos_y": 1991134 }, {1135 "pos_x": 1074,1136 "pos_y": 1851137 }, {1138 "pos_x": 1055,1139 "pos_y": 1891140 }]1141}, {1142 "index": 39,1143 "particles": [{1144 "pos_x": 992,1145 "pos_y": 2201146 }, {1147 "pos_x": 1001,1148 "pos_y": 2331149 }, {1150 "pos_x": 1001,1151 "pos_y": 2541152 }, {1153 "pos_x": 991,1154 "pos_y": 2511155 }, {1156 "pos_x": 980,1157 "pos_y": 2461158 }, {1159 "pos_x": 972,1160 "pos_y": 2371161 }, {1162 "pos_x": 966,1163 "pos_y": 2221164 }, {1165 "pos_x": 979,1166 "pos_y": 2231167 }]1168}, {1169 "index": 40,1170 "particles": [{1171 "pos_x": 1080,1172 "pos_y": 2361173 }, {1174 "pos_x": 1080,1175 "pos_y": 2541176 }, {1177 "pos_x": 1058,1178 "pos_y": 2561179 }, {1180 "pos_x": 1049,1181 "pos_y": 2361182 }, {1183 "pos_x": 1033,1184 "pos_y": 2531185 }, {1186 "pos_x": 1013,1187 "pos_y": 2541188 }, {1189 "pos_x": 1001,1190 "pos_y": 2541191 }, {1192 "pos_x": 1000,1193 "pos_y": 2341194 }, {1195 "pos_x": 1020,1196 "pos_y": 2371197 }, {1198 "pos_x": 1081,1199 "pos_y": 2461200 }]1201}, {1202 "index": 41,1203 "particles": [{1204 "pos_x": 1181,1205 "pos_y": 1381206 }, {1207 "pos_x": 1154,1208 "pos_y": 1381209 }, {1210 "pos_x": 1154,1211 "pos_y": 1571212 }, {1213 "pos_x": 1155,1214 "pos_y": 1751215 }, {1216 "pos_x": 1153,1217 "pos_y": 1941218 }, {1219 "pos_x": 1182,1220 "pos_y": 1771221 }, {1222 "pos_x": 1182,1223 "pos_y": 2001224 }, {1225 "pos_x": 1180,1226 "pos_y": 2221227 }, {1228 "pos_x": 1181,1229 "pos_y": 2511230 }, {1231 "pos_x": 1154,1232 "pos_y": 2541233 }, {1234 "pos_x": 1181,1235 "pos_y": 2551236 }, {1237 "pos_x": 1168,1238 "pos_y": 2521239 }, {1240 "pos_x": 1156,1241 "pos_y": 2441242 }, {1243 "pos_x": 1167,1244 "pos_y": 1411245 }]1246}, {1247 "index": 42,1248 "particles": [{1249 "pos_x": 1199,1250 "pos_y": 1571251 }, {1252 "pos_x": 1198,1253 "pos_y": 1381254 }, {1255 "pos_x": 1224,1256 "pos_y": 1391257 }, {1258 "pos_x": 1225,1259 "pos_y": 1551260 }, {1261 "pos_x": 1212,1262 "pos_y": 1561263 }, {1264 "pos_x": 1212,1265 "pos_y": 1391266 }, {1267 "pos_x": 1204,1268 "pos_y": 1471269 }]1270}, {1271 "index": 43,1272 "particles": [{1273 "pos_x": 1198,1274 "pos_y": 1711275 }, {1276 "pos_x": 1225,1277 "pos_y": 1721278 }, {1279 "pos_x": 1226,1280 "pos_y": 1981281 }, {1282 "pos_x": 1198,1283 "pos_y": 2091284 }, {1285 "pos_x": 1198,1286 "pos_y": 2341287 }, {1288 "pos_x": 1198,1289 "pos_y": 2531290 }, {1291 "pos_x": 1226,1292 "pos_y": 2541293 }, {1294 "pos_x": 1226,1295 "pos_y": 2321296 }, {1297 "pos_x": 1212,1298 "pos_y": 2521299 }, {1300 "pos_x": 1212,1301 "pos_y": 1731302 }]1303}, {1304 "index": 44,1305 "particles": [{1306 "pos_x": 1236,1307 "pos_y": 1701308 }, {1309 "pos_x": 1264,1310 "pos_y": 1721311 }, {1312 "pos_x": 1274,1313 "pos_y": 1941314 }, {1315 "pos_x": 1247,1316 "pos_y": 1991317 }, {1318 "pos_x": 1255,1319 "pos_y": 2191320 }, {1321 "pos_x": 1284,1322 "pos_y": 2191323 }, {1324 "pos_x": 1270,1325 "pos_y": 2521326 }, {1327 "pos_x": 1290,1328 "pos_y": 2361329 }, {1330 "pos_x": 1297,1331 "pos_y": 2531332 }, {1333 "pos_x": 1251,1334 "pos_y": 1731335 }, {1336 "pos_x": 1283,1337 "pos_y": 2511338 }]1339}, {1340 "index": 45,1341 "particles": [{1342 "pos_x": 1322,1343 "pos_y": 1711344 }, {1345 "pos_x": 1350,1346 "pos_y": 1711347 }, {1348 "pos_x": 1339,1349 "pos_y": 1951350 }, {1351 "pos_x": 1309,1352 "pos_y": 1991353 }, {1354 "pos_x": 1326,1355 "pos_y": 2211356 }, {1357 "pos_x": 1296,1358 "pos_y": 2251359 }, {1360 "pos_x": 1293,1361 "pos_y": 2391362 }, {1363 "pos_x": 1314,1364 "pos_y": 2541365 }, {1366 "pos_x": 1302,1367 "pos_y": 2541368 }, {1369 "pos_x": 1335,1370 "pos_y": 1721371 }, {1372 "pos_x": 1292,1373 "pos_y": 2521374 }]1375}, {1376 "index": 46,1377 "particles": [{1378 "pos_x": 1396,1379 "pos_y": 1901380 }, {1381 "pos_x": 1414,1382 "pos_y": 1881383 }, {1384 "pos_x": 1441,1385 "pos_y": 1891386 }, {1387 "pos_x": 1473,1388 "pos_y": 1881389 }, {1390 "pos_x": 1468,1391 "pos_y": 1811392 }, {1393 "pos_x": 1460,1394 "pos_y": 1741395 }, {1396 "pos_x": 1451,1397 "pos_y": 1721398 }, {1399 "pos_x": 1436,1400 "pos_y": 1701401 }, {1402 "pos_x": 1417,1403 "pos_y": 1701404 }, {1405 "pos_x": 1399,1406 "pos_y": 1701407 }, {1408 "pos_x": 1383,1409 "pos_y": 1721410 }, {1411 "pos_x": 1370,1412 "pos_y": 1781413 }, {1414 "pos_x": 1361,1415 "pos_y": 1881416 }]1417}, {1418 "index": 47,1419 "particles": [{1420 "pos_x": 1443,1421 "pos_y": 1911422 }, {1423 "pos_x": 1447,1424 "pos_y": 1981425 }, {1426 "pos_x": 1455,1427 "pos_y": 2201428 }, {1429 "pos_x": 1463,1430 "pos_y": 2171431 }, {1432 "pos_x": 1469,1433 "pos_y": 2121434 }, {1435 "pos_x": 1472,1436 "pos_y": 2051437 }, {1438 "pos_x": 1473,1439 "pos_y": 1941440 }, {1441 "pos_x": 1473,1442 "pos_y": 1891443 }, {1444 "pos_x": 1452,1445 "pos_y": 2131446 }]1447}, {1448 "index": 48,1449 "particles": [{1450 "pos_x": 1443,1451 "pos_y": 2021452 }, {1453 "pos_x": 1426,1454 "pos_y": 2021455 }, {1456 "pos_x": 1401,1457 "pos_y": 2021458 }, {1459 "pos_x": 1382,1460 "pos_y": 2031461 }, {1462 "pos_x": 1356,1463 "pos_y": 2041464 }, {1465 "pos_x": 1356,1466 "pos_y": 2191467 }, {1468 "pos_x": 1392,1469 "pos_y": 2201470 }, {1471 "pos_x": 1424,1472 "pos_y": 2211473 }, {1474 "pos_x": 1454,1475 "pos_y": 2201476 }, {1477 "pos_x": 1448,1478 "pos_y": 2001479 }, {1480 "pos_x": 1440,1481 "pos_y": 2221482 }, {1483 "pos_x": 1355,1484 "pos_y": 2141485 }]1486}, {1487 "index": 49,1488 "particles": [{1489 "pos_x": 1392,1490 "pos_y": 1891491 }, {1492 "pos_x": 1383,1493 "pos_y": 1971494 }, {1495 "pos_x": 1383,1496 "pos_y": 2031497 }, {1498 "pos_x": 1368,1499 "pos_y": 2091500 }, {1501 "pos_x": 1355,1502 "pos_y": 2041503 }, {1504 "pos_x": 1358,1505 "pos_y": 1941506 }, {1507 "pos_x": 1360,1508 "pos_y": 1891509 }, {1510 "pos_x": 1355,1511 "pos_y": 2141512 }]1513}, {1514 "index": 50,1515 "particles": [{1516 "pos_x": 1383,1517 "pos_y": 2211518 }, {1519 "pos_x": 1387,1520 "pos_y": 2301521 }, {1522 "pos_x": 1388,1523 "pos_y": 2541524 }, {1525 "pos_x": 1381,1526 "pos_y": 2531527 }, {1528 "pos_x": 1371,1529 "pos_y": 2481530 }, {1531 "pos_x": 1364,1532 "pos_y": 2421533 }, {1534 "pos_x": 1358,1535 "pos_y": 2331536 }, {1537 "pos_x": 1355,1538 "pos_y": 2211539 }, {1540 "pos_x": 1369,1541 "pos_y": 2221542 }]1543}, {1544 "index": 51,1545 "particles": [{1546 "pos_x": 1467,1547 "pos_y": 2531548 }, {1549 "pos_x": 1469,1550 "pos_y": 2351551 }, {1552 "pos_x": 1453,1553 "pos_y": 2351554 }, {1555 "pos_x": 1450,1556 "pos_y": 2521557 }, {1558 "pos_x": 1432,1559 "pos_y": 2541560 }, {1561 "pos_x": 1413,1562 "pos_y": 2541563 }, {1564 "pos_x": 1388,1565 "pos_y": 2531566 }, {1567 "pos_x": 1399,1568 "pos_y": 2361569 }, {1570 "pos_x": 1426,1571 "pos_y": 2371572 }, {1573 "pos_x": 1468,1574 "pos_y": 2451575 }, {1576 "pos_x": 1386,1577 "pos_y": 2341578 }, {1579 "pos_x": 1378,1580 "pos_y": 2451581 }]1582}, {1583 "index": 52,1584 "particles": [{1585 "pos_x": 1484,1586 "pos_y": 2531587 }, {1588 "pos_x": 1484,1589 "pos_y": 2341590 }, {1591 "pos_x": 1511,1592 "pos_y": 2351593 }, {1594 "pos_x": 1518,1595 "pos_y": 2531596 }, {1597 "pos_x": 1501,1598 "pos_y": 2521599 }, {1600 "pos_x": 1484,1601 "pos_y": 2441602 }, {1603 "pos_x": 1531,1604 "pos_y": 2371605 }, {1606 "pos_x": 1545,1607 "pos_y": 2521608 }, {1609 "pos_x": 1555,1610 "pos_y": 2351611 }, {1612 "pos_x": 1567,1613 "pos_y": 2531614 }, {1615 "pos_x": 1583,1616 "pos_y": 2331617 }, {1618 "pos_x": 1593,1619 "pos_y": 2411620 }, {1621 "pos_x": 1595,1622 "pos_y": 2351623 }, {1624 "pos_x": 1588,1625 "pos_y": 2491626 }, {1627 "pos_x": 1577,1628 "pos_y": 2551629 }]1630}, {1631 "index": 53,1632 "particles": [{1633 "pos_x": 1567,1634 "pos_y": 2021635 }, {1636 "pos_x": 1582,1637 "pos_y": 2041638 }, {1639 "pos_x": 1593,1640 "pos_y": 2131641 }, {1642 "pos_x": 1597,1643 "pos_y": 2231644 }, {1645 "pos_x": 1597,1646 "pos_y": 2341647 }, {1648 "pos_x": 1596,1649 "pos_y": 2371650 }, {1651 "pos_x": 1570,1652 "pos_y": 2341653 }, {1654 "pos_x": 1583,1655 "pos_y": 2351656 }, {1657 "pos_x": 1567,1658 "pos_y": 2151659 }]1660}, {1661 "index": 54,1662 "particles": [{1663 "pos_x": 1567,1664 "pos_y": 2361665 }, {1666 "pos_x": 1574,1667 "pos_y": 2241668 }, {1669 "pos_x": 1580,1670 "pos_y": 2321671 }]1672}, {1673 "index": 55,1674 "particles": [{1675 "pos_x": 1505,1676 "pos_y": 2191677 }, {1678 "pos_x": 1515,1679 "pos_y": 2031680 }, {1681 "pos_x": 1530,1682 "pos_y": 2201683 }, {1684 "pos_x": 1546,1685 "pos_y": 2201686 }, {1687 "pos_x": 1565,1688 "pos_y": 2201689 }, {1690 "pos_x": 1571,1691 "pos_y": 2221692 }, {1693 "pos_x": 1564,1694 "pos_y": 2021695 }, {1696 "pos_x": 1545,1697 "pos_y": 2031698 }, {1699 "pos_x": 1504,1700 "pos_y": 2011701 }, {1702 "pos_x": 1505,1703 "pos_y": 2131704 }, {1705 "pos_x": 1569,1706 "pos_y": 2111707 }]1708}, {1709 "index": 56,1710 "particles": [{1711 "pos_x": 1515,1712 "pos_y": 2021713 }, {1714 "pos_x": 1491,1715 "pos_y": 1751716 }, {1717 "pos_x": 1484,1718 "pos_y": 1821719 }, {1720 "pos_x": 1483,1721 "pos_y": 1951722 }, {1723 "pos_x": 1486,1724 "pos_y": 2091725 }, {1726 "pos_x": 1493,1727 "pos_y": 2171728 }, {1729 "pos_x": 1505,1730 "pos_y": 2211731 }, {1732 "pos_x": 1501,1733 "pos_y": 1881734 }, {1735 "pos_x": 1509,1736 "pos_y": 1981737 }]1738}, {1739 "index": 57,1740 "particles": [{1741 "pos_x": 1509,1742 "pos_y": 1941743 }, {1744 "pos_x": 1520,1745 "pos_y": 1701746 }, {1747 "pos_x": 1508,1748 "pos_y": 1701749 }, {1750 "pos_x": 1498,1751 "pos_y": 1721752 }, {1753 "pos_x": 1490,1754 "pos_y": 1741755 }, {1756 "pos_x": 1516,1757 "pos_y": 1811758 }, {1759 "pos_x": 1506,1760 "pos_y": 1891761 }]1762}, {1763 "index": 58,1764 "particles": [{1765 "pos_x": 1510,1766 "pos_y": 1871767 }, {1768 "pos_x": 1531,1769 "pos_y": 1881770 }, {1771 "pos_x": 1539,1772 "pos_y": 1711773 }, {1774 "pos_x": 1518,1775 "pos_y": 1691776 }, {1777 "pos_x": 1553,1778 "pos_y": 1711779 }, {1780 "pos_x": 1566,1781 "pos_y": 1691782 }, {1783 "pos_x": 1568,1784 "pos_y": 1871785 }, {1786 "pos_x": 1551,1787 "pos_y": 1871788 }, {1789 "pos_x": 1589,1790 "pos_y": 1711791 }, {1792 "pos_x": 1588,1793 "pos_y": 1871794 }, {1795 "pos_x": 1590,1796 "pos_y": 1791797 }, {1798 "pos_x": 1500,1799 "pos_y": 1791800 }]...

Full Screen

Full Screen

snow.js

Source:snow.js Github

copy

Full Screen

1window.onload = function()2{3snow(1);4}5function snow(id)6{7 var pos_x = Math.random()*(99 - 1)+1;8 pos_x = Math.floor(pos_x);9 if(pos_x >= 1 & pos_x <= 10){var q = -10;var png_sh = 1;}10 if(pos_x > 10 & pos_x <= 20){var q = 10;var png_sh = 3;}11 if(pos_x > 20 & pos_x <= 30){var q = -10;var png_sh = 0;}12 if(pos_x > 30 & pos_x <= 40){var q = 10;var png_sh = 2;}13 if(pos_x > 40 & pos_x <= 50){var q = -10;var png_sh = 1;}14 if(pos_x > 50 & pos_x <= 60){var q = 10;var png_sh = 3;}15 if(pos_x > 60 & pos_x <= 70){var q = -10;var png_sh = 0;}16 if(pos_x > 70 & pos_x <= 80){var q = 10;var png_sh = 2;}17 if(pos_x > 80 & pos_x <= 90){var q = -10;var png_sh = 1;}18 if(pos_x > 90 & pos_x <= 99){var q = 10;var png_sh = 3;}19 var end_x = pos_x+q;20 var img="<img id='snow_"+id+"' style='left:"+pos_x+"%; top:-10%; position:fixed;' src='/snow/show_"+png_sh+".png'/>";21 $("#snow").append(img);22 move_show(id,end_x);23 id++;24 setTimeout("snow("+id+");",100);25}26function move_show(id,end_x)27{28 $("#snow_"+id).animate({top:"150%",left:""+end_x+"%"},20000,function()29 {30 $("#snow_"+id).empty().remove();31 }); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.pos_x(2);3wpt.pos_y(3);4wpt.pos_z(4);5wpt.pos_t(5);6wpt.pos_x(6);7wpt.pos_y(7);8wpt.pos_z(8);9wpt.pos_t(9);10wpt.pos_x(10);11wpt.pos_y(11);12wpt.pos_z(12);13wpt.pos_t(13);14wpt.pos_x(14);15wpt.pos_y(15);16wpt.pos_z(16);17wpt.pos_t(17);18wpt.pos_x(18);19wpt.pos_y(19);20wpt.pos_z(20);21wpt.pos_t(21);22wpt.pos_x(22);23wpt.pos_y(23);24wpt.pos_z(24);25wpt.pos_t(25);26wpt.pos_x(26);27wpt.pos_y(27);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest(options);5var runTest = function() {6 wpt.runTest(url, function(err, data) {7 if (err) return console.error(err);8 console.log('Test submitted to WebPageTest for %s', url);9 console.log('Test ID: %s', data.data.testId);10 console.log('View test at %s', data.data.userUrl);11 wpt.waitForTestCompletion(data.data.testId, function(err, data) {12 if (err) return console.error(err);13 console.log('Test completed for %s', url);14 console.log('View test at %s', data.data.userUrl);15 wpt.getTestResults(data.data.testId, function(err, data) {16 if (err) return console.error(err);17 console.log('Test results for %s', url);18 console.log('SpeedIndex: %d', data.data.average.firstView.SpeedIndex);19 console.log('Load Time: %d', data.data.average.firstView.loadTime);20 console.log('TTFB: %d', data.data.average.firstView.TTFB);21 console.log('Bytes In: %d', data.data.average.firstView.bytesIn);22 console.log('Bytes Out: %d', data.data.average.firstView.bytesOut);23 console.log('Requests: %d', data.data.average.firstView.requests);24 console.log('Fully Loaded: %d', data.data.average.firstView.fullyLoaded);25 console.log('Doc Complete: %d', data.data.average.firstView.docTime);26 console.log('Dom Elements: %d', data.data.average.firstView.domElements);27 console.log('Title: %s', data.data.average.firstView.title);28 console.log('Status Code: %d', data.data.average.firstView.statusCode);29 console.log('Start Render: %d', data.data.average.firstView.render);30 console.log('SpeedIndex: %d', data.data.average.firstView.SpeedIndex);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful