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

Method constructor

code/main/PondLolligator.ts:21–40  ·  view source on GitHub ↗
(pondLines: PondLine[], pondLineIndex: number)

Source from the content-addressed store, hash-verified

19
20 // Constructor
21 constructor(pondLines: PondLine[], pondLineIndex: number){
22 // Set from the parameters
23 this.pondLines = pondLines;
24 this.pondLineIndex = pondLineIndex;
25
26 // Set the orientation (randomly)
27 this.isLeft = Random.flipACoin();
28
29 // Set the position (depending on the orientation)
30 if(this.isLeft == false) // If the lolligator is looking right
31 this.x = this.pondLines[this.pondLineIndex].getX1();
32 else
33 this.x = this.pondLines[this.pondLineIndex].getX2() - this.width;
34
35 // At first, we're not fully visible
36 this.visibleType = PondLolligatorVisibleType.NOT_FULLY_VISIBLE_YET;
37
38 // Set isUsed for the pond lines we use
39 this.setIsUsedForPondLines(true);
40 }
41
42 // Public methods
43 public draw(renderArea: RenderArea, x: number, y: number): void{

Callers

nothing calls this directly

Calls 3

setIsUsedForPondLinesMethod · 0.95
getX1Method · 0.80
getX2Method · 0.80

Tested by

no test coverage detected