()
| 46 | |
| 47 | // update() |
| 48 | public update(): void{ |
| 49 | // If we're not moving |
| 50 | if(this.moving == false){ |
| 51 | // If we're able to move now |
| 52 | if(this.testNewGlobalPosition(this.getGlobalPosition().plus(new Pos(-3, 0)))){ |
| 53 | this.moving = true; // We move |
| 54 | this.getQuestEntityMovement().setOffset(new Pos(-3, 0)); // The movement |
| 55 | } |
| 56 | } |
| 57 | // Else, if we're moving |
| 58 | else{ |
| 59 | // If we're not able to move anymore |
| 60 | if(this.testNewGlobalPosition(this.getGlobalPosition().plus(new Pos(-3, 0))) == false){ |
| 61 | this.moving = false; // We stop moving |
| 62 | this.getQuestEntityMovement().setOffset(new Pos(0, 0)); // The movement |
| 63 | this.currentAsciiNumber = 1; // currentAsciiNumber |
| 64 | this.reDrawAscii(); |
| 65 | } |
| 66 | // Else we're really moving |
| 67 | else{ |
| 68 | // Change the currentAsciiNumber |
| 69 | this.currentAsciiNumber += 1; |
| 70 | if(this.currentAsciiNumber > 5) this.currentAsciiNumber = 1; |
| 71 | this.reDrawAscii(); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Call the mother class update |
| 76 | super.update(); |
| 77 | } |
| 78 | |
| 79 | // willDie() |
| 80 | public willDie(): void{ |
nothing calls this directly
no test coverage detected