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

Method update

code/main/Developer.ts:70–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 }
69
70 public update(): void{
71 if(this.getQuestEnded() == false){
72 // Test if the player won the quest, if so, end the quest and return
73 if(this.thePlayerWon()){
74 this.endQuest(true);
75 return;
76 }
77
78 // Test if the player is dead, if so, end the quest and return
79 if(this.getGame().getPlayer().shouldDie()){
80 this.endQuest(false);
81 return;
82 }
83
84 // Update entities
85 this.updateEntities();
86 }
87
88 // Draw
89 this.preDraw();
90 this.drawEntities();
91 this.drawAroundQuest();
92 if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping");
93 else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose");
94 else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping");
95 this.postDraw();
96 }
97
98 // Private methods
99 private addDeveloperEntity(pos: Pos): void{

Callers

nothing calls this directly

Calls 14

thePlayerWonMethod · 0.95
endQuestMethod · 0.95
getQuestEndedMethod · 0.80
getPlayerMethod · 0.80
updateEntitiesMethod · 0.80
preDrawMethod · 0.80
drawEntitiesMethod · 0.80
drawAroundQuestMethod · 0.80
addExitQuestButtonMethod · 0.80
bindMethod · 0.80
getQuestEndedAndWeWonMethod · 0.80
postDrawMethod · 0.80

Tested by

no test coverage detected