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

Method update

code/main/Forest.ts:67–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 }
66
67 public update(): void{
68 if(this.getQuestEnded() == false){
69 // Test if the player won the quest, if so, end the quest and return
70 if(this.thePlayerWon()){
71 this.endQuest(true);
72 return;
73 }
74
75 // Test if the player is dead, if so, end the quest and return
76 if(this.getGame().getPlayer().shouldDie()){
77 this.endQuest(false);
78 return;
79 }
80
81 // Monsters handling
82 this.monstersHandling();
83
84 // Update entities
85 this.updateEntities();
86 }
87
88 // Draw
89 this.preDraw();
90 this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x, this.getRealQuestPosition().y);
91 this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x + 98, this.getRealQuestPosition().y);
92 this.getRenderArea().drawArray(Database.getAscii("places/quests/forest/background"), this.getRealQuestPosition().x + 98*2, this.getRealQuestPosition().y);
93 this.drawEntities();
94 this.drawAroundQuest();
95 if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping");
96 else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose");
97 else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping");
98 this.postDraw();
99 }
100
101 // Private methods
102 private addGround(): void{

Callers

nothing calls this directly

Calls 15

thePlayerWonMethod · 0.95
endQuestMethod · 0.95
monstersHandlingMethod · 0.95
getQuestEndedMethod · 0.80
getPlayerMethod · 0.80
updateEntitiesMethod · 0.80
preDrawMethod · 0.80
drawArrayMethod · 0.80
getAsciiMethod · 0.80
getRealQuestPositionMethod · 0.80
drawEntitiesMethod · 0.80
drawAroundQuestMethod · 0.80

Tested by

no test coverage detected