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

Method update

code/main/CastleEntrance.ts:58–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56 }
57
58 public update(): void{
59 if(this.getQuestEnded() == false){
60 // Test if the player won the quest, if so, end the quest and return
61 if(this.thePlayerWon()){
62 this.endQuest(true);
63 return;
64 }
65
66 // Test if the player is dead, if so, end the quest and return
67 if(this.getGame().getPlayer().shouldDie()){
68 this.endQuest(false);
69 return;
70 }
71
72 // Handle monsters
73 this.handleKnights();
74
75 // Update entities
76 this.updateEntities();
77 }
78
79 // Draw
80 this.preDraw();
81 this.getRenderArea().drawArray(Database.getAscii("places/quests/castleEntrance/background"), this.getRealQuestPosition().x, this.getRealQuestPosition().y);
82 this.drawEntities();
83 this.getRenderArea().drawArray(Database.getAscii("places/quests/castleEntrance/front"), this.getRealQuestPosition().x + 104, this.getRealQuestPosition().y);
84 this.drawAroundQuest();
85 if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping");
86 else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose");
87 else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping");
88 this.postDraw();
89 }
90
91 // Private methods
92 private addKnight(x: number = 149): void{

Callers

nothing calls this directly

Calls 15

thePlayerWonMethod · 0.95
endQuestMethod · 0.95
handleKnightsMethod · 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