MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / handlePatterns

Method handlePatterns

code/main/TheSea.ts:454–470  ·  view source on GitHub ↗
(x1: number, x2: number)

Source from the content-addressed store, hash-verified

452 }
453
454 private handlePatterns(x1: number, x2: number): void{
455 // If the pattern is null or done, we need a new pattern
456 if(this.currentPattern == null || this.currentPattern.isPatternDone()){
457 // If the level is null, we begin with level 0
458 if(this.currentPatternLevel == null)
459 this.currentPatternLevel = new TheSeaPatternLevel_Level0(this);
460 // Else, if the level is done, we get the next level from it
461 else if(this.currentPatternLevel.isLevelDone())
462 this.currentPatternLevel = this.currentPatternLevel.getNextLevel();
463
464 // We get the new pattern from the current level
465 this.currentPattern = this.currentPatternLevel.getPattern(this.distance);
466 }
467
468 // We run the pattern
469 this.currentPattern.run(x1, x2);
470 }
471
472 private moveVertically(): void{
473 var upPressed: boolean = Keyboard.isKeyPressed("up");

Callers 1

updateMethod · 0.95

Calls 5

isPatternDoneMethod · 0.45
isLevelDoneMethod · 0.45
getNextLevelMethod · 0.45
getPatternMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected