Skip to content

Commit 6dff47b

Browse files
committed
Added Camera.alpha property
1 parent d20188b commit 6dff47b

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

src/cameras/2d/Camera.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,16 @@ var Camera = new Class({
313313
*/
314314
this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
315315

316+
/**
317+
* The Camera alpha value.
318+
*
319+
* @name Phaser.Cameras.Scene2D.Camera#alpha
320+
* @type {number}
321+
* @default 1
322+
* @since 3.11.0
323+
*/
324+
this.alpha = 1;
325+
316326
/**
317327
* The Camera Fade effect handler.
318328
* To fade this camera see the `Camera.fade` methods.
@@ -1317,10 +1327,23 @@ var Camera = new Class({
13171327
},
13181328

13191329
/**
1320-
* Set the world bounds for this Camera.
1321-
*
1322-
* A Camera bounds controls where the camera can scroll to within the world. It does not limit
1323-
* rendering of the camera, or placement of the viewport within your game.
1330+
* Set the bounds of the Camera. The bounds are an axis-aligned rectangle.
1331+
*
1332+
* The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the
1333+
* edges and into blank space. It does not limit the placement of Game Objects, or where
1334+
* the Camera viewport can be positioned.
1335+
*
1336+
* Temporarily disable the bounds by changing the boolean `Camera.useBounds`.
1337+
*
1338+
* Clear the bounds entirely by calling `Camera.removeBounds`.
1339+
*
1340+
* If you set bounds that are smaller than the viewport it will stop the Camera from being
1341+
* able to scroll. The bounds can be positioned where-ever you wish. By default they are from
1342+
* 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of
1343+
* the Camera bounds. However, you can position them anywhere. So if you wanted a game world
1344+
* that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y
1345+
* to be -1024, -1024, with a width and height of 2048. Depending on your game you may find
1346+
* it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle.
13241347
*
13251348
* @method Phaser.Cameras.Scene2D.Camera#setBounds
13261349
* @since 3.0.0
@@ -1343,6 +1366,11 @@ var Camera = new Class({
13431366
{
13441367
this.centerToBounds();
13451368
}
1369+
else
1370+
{
1371+
this.scrollX = this.clampX(this.scrollX);
1372+
this.scrollY = this.clampY(this.scrollY);
1373+
}
13461374

13471375
return this;
13481376
},

0 commit comments

Comments
 (0)