| 33 | |
| 34 | // update() |
| 35 | public update(): void{ |
| 36 | // If no egg was destroyed, we go towards the player but we stay on the roof |
| 37 | if(this.anEggWasDestroyed == false){ |
| 38 | this.goTowards(this.getGlobalPosition().plus(new Pos(6, 4)), this.getQuest().getGame().getPlayer().getGlobalPosition().plus(new Pos(1, 0)), 0, new Pos(2, 0), true); |
| 39 | } |
| 40 | // Else, we go down on the player |
| 41 | else{ |
| 42 | this.goTowards(this.getGlobalPosition().plus(new Pos(6, 4)), this.getQuest().getGame().getPlayer().getGlobalPosition().plus(new Pos(1, 0)), 0, new Pos(4, 4)); |
| 43 | } |
| 44 | |
| 45 | // Call the mother classe update |
| 46 | super.update(); |
| 47 | } |
| 48 | |
| 49 | // Public methods |
| 50 | public eggDestroyed(): void{ |