MCPcopy Create free account
hub / github.com/melonjs/melonJS / setBounds

Method setBounds

packages/melonjs/src/camera/camera2d.ts:516–522  ·  view source on GitHub ↗

* set the camera boundaries (set to the world limit by default). * the camera is bound to the given coordinates and cannot move/be scrolled outside of it. * @param x - world left limit * @param y - world top limit * @param w - world width limit * @param h - world height limit

(x: number, y: number, w: number, h: number)

Source from the content-addressed store, hash-verified

514 * @param h - world height limit
515 */
516 setBounds(x: number, y: number, w: number, h: number): void {
517 this.smoothFollow = false;
518 this.bounds.setMinMax(x, y, w + x, h + y);
519 this.moveTo(this.pos.x, this.pos.y);
520 this.update();
521 this.smoothFollow = true;
522 }
523
524 /**
525 * set the camera to follow the specified renderable. <br>

Callers 8

resizeMethod · 0.95
_setBoundsMethod · 0.80
camera.spec.jsFile · 0.80
runOneFrameFunction · 0.80
simulateFunction · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
loadLevelFunction · 0.80

Calls 3

moveToMethod · 0.95
updateMethod · 0.95
setMinMaxMethod · 0.45

Tested by 2

runOneFrameFunction · 0.64
simulateFunction · 0.64