* change the deadzone settings. * the "deadzone" defines an area within the current camera in which * the followed renderable can move without scrolling the camera. * @see follow * @param w - deadzone width * @param h - deadzone height
(w: number, h: number)
| 453 | * @param h - deadzone height |
| 454 | */ |
| 455 | setDeadzone(w: number, h: number): void { |
| 456 | if (typeof this.deadzone === "undefined") { |
| 457 | this.deadzone = new Rect(0, 0, 0, 0); |
| 458 | } |
| 459 | |
| 460 | // reusing the old code for now... |
| 461 | this.deadzone.pos.set( |
| 462 | ~~((this.width - w) / 2), |
| 463 | ~~((this.height - h) / 2 - h * 0.25), |
| 464 | ); |
| 465 | this.deadzone.resize(w, h); |
| 466 | |
| 467 | this.smoothFollow = false; |
| 468 | |
| 469 | // force a camera update |
| 470 | this.updateTarget(); |
| 471 | |
| 472 | this.smoothFollow = true; |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * resize the camera |