()
| 87 | } |
| 88 | |
| 89 | public update(): void{ |
| 90 | if(this.getQuestEnded() == false){ |
| 91 | // Possibly add a bird |
| 92 | if(this.currentBirdTime >= this.nextBirdAt){ |
| 93 | this.currentBirdTime = 0; |
| 94 | this.setNextBirdAt(); |
| 95 | this.addBird(); |
| 96 | } |
| 97 | else this.currentBirdTime += 1; |
| 98 | |
| 99 | // Test if the player won the quest, if so, end the quest and return |
| 100 | if(this.thePlayerWon()){ |
| 101 | this.endQuest(true); |
| 102 | return; |
| 103 | } |
| 104 | |
| 105 | // Test if the player is dead, if so, end the quest and return |
| 106 | if(this.getGame().getPlayer().shouldDie()){ |
| 107 | this.endQuest(false); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | // Update entities |
| 112 | this.updateEntities(); |
| 113 | } |
| 114 | |
| 115 | // Draw |
| 116 | this.preDraw(); |
| 117 | this.getRenderArea().drawArray(Database.getAscii("places/quests/desert/background"), this.getRealQuestPosition().x, this.getRealQuestPosition().y + 21); |
| 118 | this.drawEntities(); |
| 119 | this.drawAroundQuest(); |
| 120 | if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping"); |
| 121 | else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose"); |
| 122 | else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping"); |
| 123 | this.postDraw(); |
| 124 | } |
| 125 | |
| 126 | // Private methods |
| 127 | private addBird(): void{ |
nothing calls this directly
no test coverage detected