(pos: Pos)
| 427 | } |
| 428 | |
| 429 | public testNewGlobalPosition(pos: Pos): boolean{ |
| 430 | var oldPosition: Pos = this.globalPosition; |
| 431 | |
| 432 | this.globalPosition = pos; |
| 433 | |
| 434 | // If there's a collision, restore the old position and return false |
| 435 | if(this.checkCollision()){ |
| 436 | this.globalPosition = oldPosition; |
| 437 | return false; |
| 438 | } |
| 439 | // Else, restore the old position and return true |
| 440 | this.globalPosition = oldPosition; |
| 441 | return true; |
| 442 | } |
| 443 | |
| 444 | public update(): void{ |
| 445 | // We handle berserk mode |
no test coverage detected