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

Method init

code/main/Smoke.ts:80–105  ·  view source on GitHub ↗
(weMustBeWaitingAtFirst: boolean = true)

Source from the content-addressed store, hash-verified

78
79 // Private methods
80 private init(weMustBeWaitingAtFirst: boolean = true): void{
81 // Inverted
82 this.inverted = Random.flipACoin();
83
84 // Step
85 this.xGap = Random.upTo(this.width-1);
86
87 // At first we're not waiting
88 if(Random.flipACoin() && weMustBeWaitingAtFirst == false){
89 // Y position
90 this.yGap = -Random.upTo(this.height-1);
91
92 // Waiting stuff
93 this.weAreWaiting = false;
94 }
95 // At first we are waiting
96 else{
97 // Y position
98 this.yGap = 0;
99
100 // Waiting stuff
101 this.weAreWaiting = true;
102 this.chosenWaitingTime = Random.between(this.minWaitingTime, this.maxWaitingTime); // We choose the waiting time
103 this.currentWaitingTime = 0; // We begin at 0
104 }
105 }
106}

Callers 2

constructorMethod · 0.95
moveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected