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

Method update

code/main/Bridge.ts:51–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 }
50
51 public update(): void{
52 if(this.getQuestEnded() == false){
53 // Test if the player won the quest, if so, end the quest and return
54 if(this.thePlayerWon()){
55 this.endQuest(true);
56 return;
57 }
58
59 // Test if the player is dead, if so, end the quest and return
60 if(this.getGame().getPlayer().shouldDie()){
61 this.endQuest(false);
62 return;
63 }
64
65 // Update entities
66 this.updateEntities();
67 }
68
69 // Draw
70 this.preDraw();
71 this.getRenderArea().drawArray(Database.getAscii("places/quests/bridge/bridge"), this.getRealQuestPosition().x, this.getRealQuestPosition().y + 17);
72 this.drawEntities();
73 this.drawAroundQuest();
74 if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping");
75 else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose");
76 else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping");
77 this.postDraw();
78 }
79
80 // Private methods
81 private addBridgeFloor(): void{

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected