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

Method update

code/main/TheSea.ts:176–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174 }
175
176 public update(): void{
177 if(this.getQuestEnded() == false){
178 // Test if the player is dead, if so, end the quest (he won!!) and return
179 if(this.getGame().getPlayer().shouldDie()){
180 this.endQuest(true); // true because we always win
181 return;
182 }
183
184 // Add some enemies
185 this.handlePatterns(100, 115);
186
187 // Move the player vertically
188 this.moveVertically();
189
190 // Update entities
191 this.updateEntities();
192
193 // Force scrolling of everything
194 this.globalScrolling();
195 }
196
197 // Draw
198 this.preDraw();
199 this.drawSea();
200 this.drawEntities();
201 this.drawAroundQuest();
202 this.addExitQuestButton(new CallbackCollection(this.endQuest.bind(this, true), this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping");
203 this.postDraw();
204 }
205
206 // Public getters
207 public getDistance(): number{

Callers

nothing calls this directly

Calls 15

endQuestMethod · 0.95
handlePatternsMethod · 0.95
moveVerticallyMethod · 0.95
globalScrollingMethod · 0.95
drawSeaMethod · 0.95
getQuestEndedMethod · 0.80
getPlayerMethod · 0.80
updateEntitiesMethod · 0.80
preDrawMethod · 0.80
drawEntitiesMethod · 0.80
drawAroundQuestMethod · 0.80
addExitQuestButtonMethod · 0.80

Tested by

no test coverage detected