()
| 125 | } |
| 126 | |
| 127 | public update(): void{ |
| 128 | if(this.getQuestEnded() == false){ |
| 129 | // Test if the player won the quest, if so, end the quest and return |
| 130 | if(this.thePlayerWon()){ |
| 131 | this.endQuest(true); |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | // Test if the player is dead, if so, end the quest and return |
| 136 | if(this.getGame().getPlayer().shouldDie()){ |
| 137 | this.endQuest(false); |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | // Move the player horizontally |
| 142 | this.moveHorizontally(); |
| 143 | |
| 144 | // Update entities |
| 145 | this.updateEntities(); |
| 146 | |
| 147 | // Calculate the new global drawing offset |
| 148 | this.calcNewGlobalDrawingOffset(); |
| 149 | } |
| 150 | |
| 151 | // Draw |
| 152 | this.preDraw(); |
| 153 | this.getRenderArea().drawArray(Database.getPartOfAscii("places/quests/theHole/background", -this.getGlobalDrawingOffset().y, -this.getGlobalDrawingOffset().y + 35), this.getRealQuestPosition().x, this.getRealQuestPosition().y); |
| 154 | this.drawEntities(); |
| 155 | this.drawAroundQuest(); |
| 156 | if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping"); |
| 157 | else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose"); |
| 158 | else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping"); |
| 159 | this.postDraw(); |
| 160 | } |
| 161 | |
| 162 | // Private methods |
| 163 | private addChest(chest: Chest): void{ |
nothing calls this directly
no test coverage detected