How to use scheduleUpdate method in Best

Best JavaScript code snippet using best

GameLayer.js

Source:GameLayer.js Github

copy

Full Screen

...5 6 this.background = new Background(0);7 this.background.setPosition(new cc.Point(0,0));8 this.addChild(this.background);9 this.background.scheduleUpdate();10 11 //this.createGround();12 this.createBlocks();13 //this.createTraps();14 this.createGate();15 16 /*this.Trap= new Trap(200,180);17 this.addChild(this.Trap);18 this.Trap.scheduleUpdate();*/19 this.jumper = new Jumper( 690, 160, 1313, 643, 0 );20 this.jumper.setBlocks( this.blocks );21 //this.jumper.setTraps(this.traps);22 this.jumper.setGates(this.gates);23 var followAction = cc.Follow.create(this.jumper, cc.rect(0, 0, 1313,643));24 this.runAction(followAction);25 this.addChild( this.jumper );26 27 this.scheduleOnce(function() {28 this.jumper.scheduleUpdate();29 }, 1);30 31 this.setKeyboardEnabled( true );32 this.scheduleUpdate();33 return true;34 35 },36 37 /*createGround: function() {38 this.blocks = [];39 for(var i=1;i<5;i++)40 {41 var Block1 = new Block( i*132, 0, 132, 43);42 this.blocks.push( Block1 );43 }44 this.blocks.forEach( function( b ) {45 this.addChild( b );46 }, this );47 },*/48 createBlocks: function() {49 this.blocks = [];50 for(var i=0;i<10;i++)51 {52 var Block1 = new Block( i*132, 0, 172, 39, 3);53 this.blocks.push( Block1 );54 }55 56 var Block1 = new Block( 360, 275, 172, 39, 4);57 this.blocks.push( Block1 );58 59 this.blocks.forEach( function( b ) {60 this.addChild( b );61 }, this );62 },63 64 createTraps: function(){65 this.traps =[];66 var Trap1 = new Trap(100,178,3,0,300,0);67 Trap1.scheduleUpdate();68 this.traps.push(Trap1);69 70 var Trap1 = new Trap(400,39,1,0,100,4);71 Trap1.scheduleUpdate();72 this.traps.push(Trap1);73 74 this.traps.forEach( function( b ) {75 this.addChild( b );76 }, this );77 },78 79 createGate: function(){80 this.gates =[];81 /*var gate1 = new Gate(1030,930);82 gate1.scheduleUpdate();83 this.gates.push(gate1);*/84 var gate1 = new Gate(650,35);85 gate1.scheduleUpdate();86 this.gates.push(gate1);87 88 this.gates.forEach( function( b ) {89 this.addChild( b ,99);90 }, this );91 },92 onKeyDown: function( e ) {93 this.jumper.handleKeyDown( e );94 },95 onKeyUp: function( e ) {96 this.jumper.handleKeyUp( e );97 }98});99var GameLayer1 = cc.LayerColor.extend({100 init: function() {101 this._super( new cc.Color4B( 127, 127, 127, 255 ) );102 this.setPosition( new cc.Point( 0, 0 ) );103 104 this.background = new Background(1);105 this.background.setPosition(new cc.Point(0,0));106 this.addChild(this.background);107 this.background.scheduleUpdate();108 109 //this.createGround();110 this.createBlocks();111 this.createTraps();112 this.createGate();113 114 /*this.Trap= new Trap(200,180);115 this.addChild(this.Trap);116 this.Trap.scheduleUpdate();*/117 this.jumper = new Jumper( 50, 160, 1258, 1150, 1 );118 this.jumper.setBlocks( this.blocks );119 this.jumper.setTraps(this.traps);120 this.jumper.setGates(this.gates);121 var followAction = cc.Follow.create(this.jumper, cc.rect(0, 0, 1258,1150));122 this.runAction(followAction);123 this.addChild( this.jumper );124 125 this.scheduleOnce(function() {126 this.jumper.scheduleUpdate();127 }, 1);128 129 this.setKeyboardEnabled( true );130 this.scheduleUpdate();131 return true;132 133 },134 135 /*createGround: function() {136 this.blocks = [];137 for(var i=1;i<5;i++)138 {139 var Block1 = new Block( i*132, 0, 132, 43);140 this.blocks.push( Block1 );141 }142 this.blocks.forEach( function( b ) {143 this.addChild( b );144 }, this );145 },*/146 createBlocks: function() {147 this.blocks = [];148 for(var i=1;i<9;i++)149 {150 var Block1 = new Block( i*132, 0, 132, 43, 0);151 this.blocks.push( Block1 );152 }153 var Block1 = new Block( 0, 0, 132, 43,0);154 this.blocks.push( Block1 );155 var Block1 = new Block( 200, 98, 132, 43, 0 );156 this.blocks.push( Block1 );157 var Block1 = new Block( 400, 200, 132, 43, 0 );158 this.blocks.push( Block1 );159 160 var Block1 = new Block( 600, 302, 132, 43, 0 );161 this.blocks.push( Block1 );162 163 var Block1 = new Block( 800, 400, 132, 43, 0 );164 this.blocks.push( Block1 );165 166 var Block1 = new Block( 600, 500, 132, 43, 0 );167 this.blocks.push( Block1 );168 169 var Block1 = new Block( 400, 600, 132, 43, 0 );170 this.blocks.push( Block1 );171 172 var Block1 = new Block( 200, 700, 132, 43, 0 );173 this.blocks.push( Block1 );174 175 var Block1 = new Block( 0, 800, 132, 43, 0 );176 this.blocks.push( Block1 );177 178 var Block1 = new Block( 200, 900, 66, 43, 0 );179 this.blocks.push( Block1 );180 181 var Block1 = new Block( 400, 900, 66, 43, 0 );182 this.blocks.push( Block1 );183 184 var Block1 = new Block( 600, 900, 66, 43, 0 );185 this.blocks.push( Block1 );186 187 var Block1 = new Block( 800, 900, 132, 43, 0 );188 this.blocks.push( Block1 );189 190 var Block1 = new Block( 1000, 900, 132, 43, 0 );191 this.blocks.push( Block1 );192 193 this.blocks.forEach( function( b ) {194 this.addChild( b );195 }, this );196 },197 198 createTraps: function(){199 this.traps =[];200 var Trap1 = new Trap(200,178,5,0,500,0);201 Trap1.scheduleUpdate();202 this.traps.push(Trap1);203 204 var Trap1 = new Trap(400,280,5,0,500,0);205 Trap1.scheduleUpdate();206 this.traps.push(Trap1);207 208 var Trap1 = new Trap(800,430,7,0,300,0);209 Trap1.scheduleUpdate();210 this.traps.push(Trap1);211 212 var Trap1 = new Trap(300,700,0,5,500,0);213 Trap1.scheduleUpdate();214 this.traps.push(Trap1);215 216 var Trap1 = new Trap(500,600,0,5,270,0);217 Trap1.scheduleUpdate();218 this.traps.push(Trap1);219 220 var Trap1 = new Trap(400,700,5,0,500,0);221 Trap1.scheduleUpdate();222 this.traps.push(Trap1);223 224 var Trap1 = new Trap(400,900,5,0,500,0);225 Trap1.scheduleUpdate();226 this.traps.push(Trap1);227 228 this.traps.forEach( function( b ) {229 this.addChild( b );230 }, this );231 },232 233 createGate: function(){234 this.gates =[];235 /*var gate1 = new Gate(1030,930);236 gate1.scheduleUpdate();237 this.gates.push(gate1);*/238 var gate1 = new Gate(1030,935);239 gate1.scheduleUpdate();240 this.gates.push(gate1);241 242 this.gates.forEach( function( b ) {243 this.addChild( b ,99);244 }, this );245 },246 onKeyDown: function( e ) {247 this.jumper.handleKeyDown( e );248 },249 onKeyUp: function( e ) {250 this.jumper.handleKeyUp( e );251 }252});253var GameLayer2 = cc.LayerColor.extend({254 init: function() {255 this._super( new cc.Color4B( 127, 127, 127, 255 ) );256 this.setPosition( new cc.Point( 0, 0 ) );257 258 this.background = new Background(2);259 this.background.setPosition(new cc.Point(0,0));260 this.addChild(this.background);261 this.background.scheduleUpdate();262 263 /*this.Trap= new Trap(200,180);264 this.addChild(this.Trap);265 this.Trap.scheduleUpdate();*/266 this.jumper = new Jumper( 50, 160, 1188, 2700, 2 );267 268 this.createBlocks();269 this.createTraps();270 this.createConnect();271 this.createGate();272 273 274 this.jumper.setBlocks( this.blocks );275 this.jumper.setTraps(this.traps);276 this.jumper.setGates(this.gates);277 this.jumper.setConnects(this.connects);278 var followAction = cc.Follow.create(this.jumper, cc.rect(0, 0, 1188,2700));279 this.runAction(followAction);280 this.addChild( this.jumper );281 this.scheduleOnce(function() {282 this.jumper.scheduleUpdate();283 }, 1);284 285 this.setKeyboardEnabled( true );286 this.scheduleUpdate();287 return true;288 289 },290 291 /*createGround: function() {292 this.blocks = [];293 for(var i=1;i<5;i++)294 {295 var Block1 = new Block( i*132, 0, 132, 43);296 this.blocks.push( Block1 );297 }298 this.blocks.forEach( function( b ) {299 this.addChild( b );300 }, this );301 },*/302 createBlocks: function() {303 this.blocks = [];304 for(var i=1;i<9;i++)305 {306 var Block1 = new Block( i*132, 0, 132, 43, 0);307 this.blocks.push( Block1 );308 }309 var Block1 = new Block( 0, 0, 132, 43,0);310 this.blocks.push( Block1 );311 var Block1 = new Block( 200, 98, 132, 43, 0 );312 this.blocks.push( Block1 );313 var Block1 = new Block( 400, 200, 132, 43, 0 );314 this.blocks.push( Block1 );315 316 var Block1 = new Block( 600, 302, 132, 43, 0 );317 this.blocks.push( Block1 );318 319 var Block1 = new Block( 800, 400, 132, 43, 0 );320 this.blocks.push( Block1 );321 322 var Block1 = new Block( 600, 500, 132, 43, 0 );323 this.blocks.push( Block1 );324 325 var Block1 = new Block( 400, 600, 132, 43, 0 );326 this.blocks.push( Block1 );327 328 var Block1 = new Block( 200, 700, 132, 43, 0 );329 this.blocks.push( Block1 );330 331 var Block1 = new Block( 0, 800, 132, 43, 0 );332 this.blocks.push( Block1 );333 334 var Block1 = new Block( 200, 900, 66, 43, 0 );335 this.blocks.push( Block1 );336 337 var Block1 = new Block( 400, 900, 66, 43, 0 );338 this.blocks.push( Block1 );339 340 var Block1 = new Block( 600, 900, 66, 43, 0 );341 this.blocks.push( Block1 );342 343 var Block1 = new Block( 800, 900, 132, 43, 0 );344 this.blocks.push( Block1 );345 346 var Block1 = new Block( 1000, 900, 132, 43, 0 );347 this.blocks.push( Block1 );348 349 var Block1 = new Block( 800, 1000, 132, 43, 0 );350 this.blocks.push( Block1 );351 352 var Block1 = new Block( 700, 1100, 66, 43, 0 );353 this.blocks.push( Block1 );354 355 var Block1 = new Block( 500, 1100, 66, 43, 0 );356 this.blocks.push( Block1 );357 358 var Block1 = new Block( 300, 1100, 66, 43, 0 );359 this.blocks.push( Block1 );360 361 var Block1 = new Block( 100, 1200, 132, 43, 0 );362 this.blocks.push( Block1 );363 364 var Block1 = new Block( 300, 1300, 66, 43, 0 );365 this.blocks.push( Block1 );366 367 var Block1 = new Block( 400, 1400, 66, 43, 0 );368 this.blocks.push( Block1 );369 370 var Block1 = new Block( 500, 1300, 66, 43, 0 );371 this.blocks.push( Block1 );372 373 var Block1 = new Block( 600, 1400, 66, 43, 0 );374 this.blocks.push( Block1 );375 376 var Block1 = new Block( 700, 1300, 66, 43, 0 );377 this.blocks.push( Block1 );378 379 var Block1 = new Block( 800, 1400, 66, 43, 0 );380 this.blocks.push( Block1 );381 382 var Block1 = new Block( 900, 1500, 132, 43, 0 );383 this.blocks.push( Block1 );384 385 var Block1 = new Block( 1000, 1600, 132, 43, 0 );386 this.blocks.push( Block1 );387 388 var Block1 = new Block( 900, 1700, 132, 43, 0 );389 this.blocks.push( Block1 );390 391 var Block1 = new Block( 900, 1700, 132, 43, 0 );392 this.blocks.push( Block1 );393 394 var Block1 = new Block( 768, 1700, 132, 43, 0 );395 this.blocks.push( Block1 );396 397 var Block1 = new Block( 636, 1700, 132, 43, 0 );398 this.blocks.push( Block1 );399 400 var Block1 = new Block( 504, 1700, 132, 43, 0 );401 this.blocks.push( Block1 );402 403 var Block1 = new Block( 372, 1700, 132, 43, 0 );404 this.blocks.push( Block1 );405 406 var Block1 = new Block( 240, 1700, 132, 43, 0 );407 this.blocks.push( Block1 );408 409 var Block1 = new Block( 0, 1700, 132, 43, 0 );410 this.blocks.push( Block1 );411 412 var Block1 = new Block( 0, 1867, 132, 43, 0 );413 this.blocks.push( Block1 );414 this.blocks.forEach( function( b ) {415 this.addChild( b );416 }, this );417 },418 419 createTraps: function(){420 this.traps =[];421 var Trap1 = new Trap(200,178,5,0,500,0);422 Trap1.scheduleUpdate();423 this.traps.push(Trap1);424 425 var Trap1 = new Trap(400,280,5,0,500,0);426 Trap1.scheduleUpdate();427 this.traps.push(Trap1);428 429 var Trap1 = new Trap(800,430,7,0,300,0);430 Trap1.scheduleUpdate();431 this.traps.push(Trap1);432 433 var Trap1 = new Trap(300,700,0,5,500,0);434 Trap1.scheduleUpdate();435 this.traps.push(Trap1);436 437 var Trap1 = new Trap(500,600,0,5,270,0);438 Trap1.scheduleUpdate();439 this.traps.push(Trap1);440 441 var Trap1 = new Trap(400,700,5,0,500,0);442 Trap1.scheduleUpdate();443 this.traps.push(Trap1);444 445 var Trap1 = new Trap(400,900,5,0,500,0);446 Trap1.scheduleUpdate();447 this.traps.push(Trap1);448 449 var Trap1 = new Trap(400,1100,4,0,500,0);450 Trap1.scheduleUpdate();451 this.traps.push(Trap1);452 453 var Trap1 = new Trap(300,1400,7,0,500,0);454 Trap1.scheduleUpdate();455 this.traps.push(Trap1);456 457 var Trap1 = new Trap(900,1780,0,5,500,0);458 Trap1.scheduleUpdate();459 this.traps.push(Trap1);460 461 var Trap1 = new Trap(800,1780,0,5,500,0);462 Trap1.scheduleUpdate();463 this.traps.push(Trap1);464 465 var Trap1 = new Trap(700,1780,0,5,500,0);466 Trap1.scheduleUpdate();467 this.traps.push(Trap1);468 469 var Trap1 = new Trap(600,1780,0,5,500,0);470 Trap1.scheduleUpdate();471 this.traps.push(Trap1);472 473 var Trap1 = new Trap(400,1780,7,0,500,0);474 Trap1.scheduleUpdate();475 this.traps.push(Trap1);476 477 this.traps.forEach( function( b ) {478 this.addChild( b );479 }, this );480 },481 482 createGate: function(){483 this.gates =[];484 var gate1 = new Gate(0,1735);485 gate1.scheduleUpdate();486 this.gates.push(gate1);487 /*var gate1 = new Gate(0,35);488 gate1.scheduleUpdate();489 this.gates.push(gate1);*/490 491 this.gates.forEach( function( b ) {492 this.addChild( b,99 );493 }, this );494 },495 496 createConnect: function(){497 this.connects =[];498 var connect1 = new Connect(66,1750,22,167);499 connect1.scheduleUpdate();500 this.connects.push(connect1);501 /*var gate1 = new Gate(0,35);502 gate1.scheduleUpdate();503 this.gates.push(gate1);*/504 505 this.connects.forEach( function( b ) {506 this.addChild( b );507 }, this );508 },509 onKeyDown: function( e ) {510 this.jumper.handleKeyDown( e );511 },512 onKeyUp: function( e ) {513 this.jumper.handleKeyUp( e );514 }515});516var GameLayer3 = cc.LayerColor.extend({517 init: function() {518 this._super( new cc.Color4B( 127, 127, 127, 255 ) );519 this.setPosition( new cc.Point( 0, 0 ) );520 521 this.background = new Background(3);522 this.background.setPosition(new cc.Point(0,0));523 this.addChild(this.background);524 this.background.scheduleUpdate();525 526 //this.createGround();527 this.createBlocks();528 this.createTraps();529 this.createGate();530 531 /*this.Trap= new Trap(200,180);532 this.addChild(this.Trap);533 this.Trap.scheduleUpdate();*/534 this.jumper = new Jumper( 50, 160, 1874, 1400, 3 );535 this.jumper.setBlocks( this.blocks );536 this.jumper.setTraps(this.traps);537 this.jumper.setGates(this.gates);538 var followAction = cc.Follow.create(this.jumper, cc.rect(0, 0, 1874,1400));539 this.runAction(followAction);540 this.addChild( this.jumper );541 542 this.scheduleOnce(function() {543 this.jumper.scheduleUpdate();544 }, 1);545 546 this.setKeyboardEnabled( true );547 this.scheduleUpdate();548 return true;549 550 },551 552 /*createGround: function() {553 this.blocks = [];554 for(var i=1;i<5;i++)555 {556 var Block1 = new Block( i*132, 0, 132, 43);557 this.blocks.push( Block1 );558 }559 this.blocks.forEach( function( b ) {560 this.addChild( b );561 }, this );562 },*/563 createBlocks: function() {564 this.blocks = [];565 for(var i=0;i<5;i++)566 {567 if(i!=2)568 {569 var Block1 = new Block( i*289, 0, 289, 103, 1);570 this.blocks.push( Block1 );571 }572 }573 574 var Block1 = new Block( 1700, 0, 289, 103, 1 );575 this.blocks.push( Block1 );576 577 var Block1 = new Block( 200, 150, 237, 45, 2 );578 this.blocks.push( Block1 );579 var Block1 = new Block( 500, 250, 66, 43, 2 );580 this.blocks.push( Block1 );581 582 var Block1 = new Block( 400, 355, 66, 43, 2 );583 this.blocks.push( Block1 );584 585 var Block1 = new Block( 300, 460, 66, 43, 2 );586 this.blocks.push( Block1 );587 588 var Block1 = new Block( 0, 550, 237, 45, 2 );589 this.blocks.push( Block1 );590 591 var Block1 = new Block( 0, 650, 66, 45, 2 );592 this.blocks.push( Block1 );593 594 var Block1 = new Block( 100, 750, 66, 45, 2 );595 this.blocks.push( Block1 );596 597 var Block1 = new Block( 200, 850, 66, 45, 2 );598 this.blocks.push( Block1 );599 600 var Block1 = new Block( 300, 950, 237, 45, 2 );601 this.blocks.push( Block1 );602 603 var Block1 = new Block( 650, 950, 237, 45, 2 );604 this.blocks.push( Block1 );605 606 var Block1 = new Block( 887, 950, 237, 45, 2 );607 this.blocks.push( Block1 );608 609 var Block1 = new Block(1124, 950, 237, 45, 2 );610 this.blocks.push( Block1 );611 612 var Block1 = new Block(1361, 950, 237, 45, 2 );613 this.blocks.push( Block1 );614 615 var Block1 = new Block(1598, 950, 237, 45, 2 );616 this.blocks.push( Block1 );617 618 var Block1 = new Block(1808, 850, 66, 45, 2 );619 this.blocks.push( Block1 );620 621 var Block1 = new Block(1708, 750, 166, 45, 2 );622 this.blocks.push( Block1 );623 624 var Block1 = new Block(1600, 750, 166, 45, 2 );625 this.blocks.push( Block1 );626 627 var Block1 = new Block(1400, 750, 237, 45, 2 );628 this.blocks.push( Block1 );629 630 var Block1 = new Block(1200, 750, 237, 45, 2 );631 this.blocks.push( Block1 );632 633 var Block1 = new Block(1000, 750, 237, 45, 2 );634 this.blocks.push( Block1 );635 636 var Block1 = new Block(900, 650, 66, 45, 2 );637 this.blocks.push( Block1 );638 639 var Block1 = new Block(800, 545, 66, 45, 2 );640 this.blocks.push( Block1 );641 642 var Block1 = new Block(900, 440, 66, 45, 2 );643 this.blocks.push( Block1 );644 645 var Block1 = new Block(800, 335, 66, 45, 2 );646 this.blocks.push( Block1 );647 648 var Block1 = new Block(900, 250, 66, 45, 2 );649 this.blocks.push( Block1 );650 651 var Block1 = new Block(800, 150, 66, 45, 2 );652 this.blocks.push( Block1 );653 654 var Block1 = new Block(1000, 100, 237, 45, 2 );655 this.blocks.push( Block1 );656 657 var Block1 = new Block(1400, 150, 66, 45, 2 );658 this.blocks.push( Block1 );659 660 var Block1 = new Block(1300, 250, 66, 45, 2 );661 this.blocks.push( Block1 );662 663 var Block1 = new Block(1400, 350, 66, 45, 2 );664 this.blocks.push( Block1 );665 666 var Block1 = new Block(1300, 450, 66, 45, 2 );667 this.blocks.push( Block1 );668 669 var Block1 = new Block(1200, 545, 237, 45, 2 );670 this.blocks.push( Block1 );671 672 var Block1 = new Block(1400, 545, 237, 45, 2 );673 this.blocks.push( Block1 );674 675 var Block1 = new Block(1500, 545, 237, 45, 2 );676 this.blocks.push( Block1 );677 678 var Block1 = new Block(1600, 545, 66, 45, 2 );679 this.blocks.push( Block1 );680 681 var Block1 = new Block(1800, 550, 66, 45, 2 );682 this.blocks.push( Block1 );683 684 var Block1 = new Block(1700, 450, 66, 45, 2 );685 this.blocks.push( Block1 );686 687 var Block1 = new Block(1800, 350, 66, 45, 2 );688 this.blocks.push( Block1 );689 690 var Block1 = new Block(1700, 250, 66, 45, 2 );691 this.blocks.push( Block1 );692 693 var Block1 = new Block(1800, 150, 66, 45, 2 );694 this.blocks.push( Block1 );695 this.blocks.forEach( function( b ) {696 this.addChild( b );697 }, this );698 },699 700 createTraps: function(){701 this.traps =[];702 var Trap1 = new Trap(220,195,1,0,220,1);703 Trap1.scheduleUpdate();704 this.traps.push(Trap1);705 706 var Trap1 = new Trap(220,195,2,0,220,5);707 Trap1.scheduleUpdate();708 this.traps.push(Trap1);709 710 var Trap1 = new Trap(400,330,5,0,400,0);711 Trap1.scheduleUpdate();712 this.traps.push(Trap1);713 714 var Trap1 = new Trap(300,435,5,0,400,0);715 Trap1.scheduleUpdate();716 this.traps.push(Trap1);717 718 var Trap1 = new Trap(0,595,2,0,220,1);719 Trap1.scheduleUpdate();720 this.traps.push(Trap1);721 722 var Trap1 = new Trap(0,695,5,0,500,0);723 Trap1.scheduleUpdate();724 this.traps.push(Trap1);725 726 var Trap1 = new Trap(130,840,0,5,400,0);727 Trap1.scheduleUpdate();728 this.traps.push(Trap1);729 730 var Trap1 = new Trap(230,940,0,6,400,0);731 Trap1.scheduleUpdate();732 this.traps.push(Trap1);733 734 var Trap1 = new Trap(300,995,2,0,220,2);735 Trap1.scheduleUpdate();736 this.traps.push(Trap1);737 738 var Trap1 = new Trap(900,1050,3,0,800,3);739 Trap1.scheduleUpdate();740 this.traps.push(Trap1);741 742 var Trap1 = new Trap(700,995,3,0,600,5);743 Trap1.scheduleUpdate();744 this.traps.push(Trap1);745 746 var Trap1 = new Trap(1400,995,2,0,400,2);747 Trap1.scheduleUpdate();748 this.traps.push(Trap1);749 750 var Trap1 = new Trap(1300,995,3,0,400,5);751 Trap1.scheduleUpdate();752 this.traps.push(Trap1);753 754 var Trap1 = new Trap(1000,795,3,0,970,5);755 Trap1.scheduleUpdate();756 this.traps.push(Trap1);757 758 var Trap1 = new Trap(1060,595,0,3,300,0);759 Trap1.scheduleUpdate();760 this.traps.push(Trap1);761 762 var Trap1 = new Trap(1190,595,0,3,300,0);763 Trap1.scheduleUpdate();764 this.traps.push(Trap1);765 766 var Trap1 = new Trap(1320,595,0,3,300,0);767 Trap1.scheduleUpdate();768 this.traps.push(Trap1);769 770 var Trap1 = new Trap(1450,595,0,3,300,0);771 Trap1.scheduleUpdate();772 this.traps.push(Trap1);773 774 var Trap1 = new Trap(1580,595,0,3,300,0);775 Trap1.scheduleUpdate();776 this.traps.push(Trap1);777 778 var Trap1 = new Trap(700,630,7,0,700,0);779 Trap1.scheduleUpdate();780 this.traps.push(Trap1);781 782 var Trap1 = new Trap(700,525,3,0,400,0);783 Trap1.scheduleUpdate();784 this.traps.push(Trap1);785 786 var Trap1 = new Trap(1100,145,0.5,0,30,4);787 Trap1.scheduleUpdate();788 this.traps.push(Trap1);789 790 var Trap1 = new Trap(1250,295,5,0,500,0);791 Trap1.scheduleUpdate();792 this.traps.push(Trap1);793 794 var Trap1 = new Trap(1250,495,5,0,500,0);795 Trap1.scheduleUpdate();796 this.traps.push(Trap1);797 798 var Trap1 = new Trap(1500,630,7,0,500,0);799 Trap1.scheduleUpdate();800 this.traps.push(Trap1);801 802 this.traps.forEach( function( b ) {803 this.addChild( b );804 }, this );805 },806 807 createGate: function(){808 this.gates =[];809 /*var gate1 = new Gate(1030,930);810 gate1.scheduleUpdate();811 this.gates.push(gate1);*/812 var gate1 = new Gate(1750,90);813 gate1.scheduleUpdate();814 this.gates.push(gate1);815 816 this.gates.forEach( function( b ) {817 this.addChild( b ,99);818 }, this );819 },820 onKeyDown: function( e ) {821 this.jumper.handleKeyDown( e );822 },823 onKeyUp: function( e ) {824 this.jumper.handleKeyUp( e );825 }826});827var StartScene = cc.Scene.extend({...

Full Screen

Full Screen

ReactDevToolsHooksIntegration-test.js

Source:ReactDevToolsHooksIntegration-test.js Github

copy

Full Screen

...171 const fiber = renderer.root._currentFiber().child;172 if (__DEV__) {173 // First render was locked174 expect(renderer.toJSON().children).toEqual(['Loading']);175 scheduleUpdate(fiber); // Re-render176 expect(renderer.toJSON().children).toEqual(['Loading']);177 // Release the lock178 setSuspenseHandler(() => false);179 scheduleUpdate(fiber); // Re-render180 expect(renderer.toJSON().children).toEqual(['Done']);181 scheduleUpdate(fiber); // Re-render182 expect(renderer.toJSON().children).toEqual(['Done']);183 // Lock again184 setSuspenseHandler(() => true);185 scheduleUpdate(fiber); // Re-render186 expect(renderer.toJSON().children).toEqual(['Loading']);187 // Release the lock again188 setSuspenseHandler(() => false);189 scheduleUpdate(fiber); // Re-render190 expect(renderer.toJSON().children).toEqual(['Done']);191 // Ensure it checks specific fibers.192 setSuspenseHandler(f => f === fiber || f === fiber.alternate);193 scheduleUpdate(fiber); // Re-render194 expect(renderer.toJSON().children).toEqual(['Loading']);195 setSuspenseHandler(f => f !== fiber && f !== fiber.alternate);196 scheduleUpdate(fiber); // Re-render197 expect(renderer.toJSON().children).toEqual(['Done']);198 } else {199 expect(renderer.toJSON().children).toEqual(['Done']);200 }201 });202 it('should support overriding suspense in concurrent mode', () => {203 if (__DEV__) {204 // Lock the first render205 setSuspenseHandler(() => true);206 }207 function MyComponent() {208 return 'Done';209 }210 const renderer = ReactTestRenderer.create(211 <div>212 <React.Suspense fallback={'Loading'}>213 <MyComponent />214 </React.Suspense>215 </div>,216 {unstable_isConcurrent: true},217 );218 expect(Scheduler).toFlushAndYield([]);219 // Ensure we timeout any suspense time.220 jest.advanceTimersByTime(1000);221 const fiber = renderer.root._currentFiber().child;222 if (__DEV__) {223 // First render was locked224 expect(renderer.toJSON().children).toEqual(['Loading']);225 scheduleUpdate(fiber); // Re-render226 expect(renderer.toJSON().children).toEqual(['Loading']);227 // Release the lock228 setSuspenseHandler(() => false);229 scheduleUpdate(fiber); // Re-render230 Scheduler.unstable_flushAll();231 expect(renderer.toJSON().children).toEqual(['Done']);232 scheduleUpdate(fiber); // Re-render233 expect(renderer.toJSON().children).toEqual(['Done']);234 // Lock again235 setSuspenseHandler(() => true);236 scheduleUpdate(fiber); // Re-render237 expect(renderer.toJSON().children).toEqual(['Loading']);238 // Release the lock again239 setSuspenseHandler(() => false);240 scheduleUpdate(fiber); // Re-render241 expect(renderer.toJSON().children).toEqual(['Done']);242 // Ensure it checks specific fibers.243 setSuspenseHandler(f => f === fiber || f === fiber.alternate);244 scheduleUpdate(fiber); // Re-render245 expect(renderer.toJSON().children).toEqual(['Loading']);246 setSuspenseHandler(f => f !== fiber && f !== fiber.alternate);247 scheduleUpdate(fiber); // Re-render248 expect(renderer.toJSON().children).toEqual(['Done']);249 } else {250 expect(renderer.toJSON().children).toEqual(['Done']);251 }252 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestBuy = require('./BestBuy.js');2var bestBuy = new BestBuy();3bestBuy.scheduleUpdate();4var schedule = require('node-schedule');5var request = require('request');6var cheerio = require('cheerio');7var fs = require('fs');8var BestBuy = function() {9 this.scheduleUpdate = function() {10 var rule = new schedule.RecurrenceRule();11 rule.minute = 1;12 schedule.scheduleJob(rule, function() {13 console.log('schedule job');14 updateData();15 });16 }17 var updateData = function() {18 if (!error && response.statusCode == 200) {19 var $ = cheerio.load(body);20 var price = $('.priceView-hero-price .priceView-customer-price').text();21 var stock = $('.fulfillment-add-to-cart-button').text();22 console.log('price: ' + price);23 console.log('stock: ' + stock);24 fs.writeFile('data.json', JSON.stringify({25 }), function(err) {26 if (err) {27 return console.log(err);28 }29 console.log('data saved');30 });31 }32 });33 }34}35module.exports = BestBuy;

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestBuy = require('./bestbuy.js');2var bestbuy = new BestBuy();3bestbuy.scheduleUpdate('5555555', 5000);4function BestBuy() {5 this.products = {};6}7BestBuy.prototype.scheduleUpdate = function (id, interval) {8 var product = this.products[id];9 if (product) {10 product.interval = interval;11 } else {12 this.products[id] = {13 };14 }15};16module.exports = BestBuy;17public static void main(String[] args) throws IOException {18 Scanner in = new Scanner(new File("input.txt"));19 PrintWriter writer = new PrintWriter("output.txt");20 int numLines = Integer.parseInt(in.nextLine());21 for (int i = 0; i < numLines; i++) {22 String line = in.nextLine();23 int numSpaces = 0;24 for (int j = 0; j < line.length(); j++) {25 if (line.charAt(j) == ' ') {26 numSpaces++;27 } else {28 break;29 }30 }31 writer.println(numSpaces);32 }33 writer.close();34 in.close();35 }36public class CustomImageView extends FrameLayout {37 private ImageView imageView;38 private boolean isLoaded = false;39 public CustomImageView(Context context) {40 super(context);41 init();42 }43 public CustomImageView(Context context,

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 Best 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