(pos: Pos, force: boolean = false)
| 381 | } |
| 382 | |
| 383 | public setGlobalPosition(pos: Pos, force: boolean = false): boolean{ |
| 384 | var oldPosition: Pos = this.globalPosition; |
| 385 | |
| 386 | this.globalPosition = pos; |
| 387 | |
| 388 | // Check for collisions : restore the old position and return false if the movement would cause a collision |
| 389 | if(force == false && this.checkCollision()){ |
| 390 | this.globalPosition = oldPosition; |
| 391 | return false; |
| 392 | } |
| 393 | |
| 394 | // Return true |
| 395 | return true; |
| 396 | } |
| 397 | |
| 398 | public shouldDie(): boolean{ |
| 399 | // Return true if we are destructible and have 0 hp or we're already dead |
no test coverage detected