Added Camera.alpha property

This commit is contained in:
Richard Davey 2018-06-25 16:11:09 +01:00
parent d20188b75d
commit 6dff47b71d

View file

@ -313,6 +313,16 @@ var Camera = new Class({
*/ */
this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
/**
* The Camera alpha value.
*
* @name Phaser.Cameras.Scene2D.Camera#alpha
* @type {number}
* @default 1
* @since 3.11.0
*/
this.alpha = 1;
/** /**
* The Camera Fade effect handler. * The Camera Fade effect handler.
* To fade this camera see the `Camera.fade` methods. * To fade this camera see the `Camera.fade` methods.
@ -1317,10 +1327,23 @@ var Camera = new Class({
}, },
/** /**
* Set the world bounds for this Camera. * Set the bounds of the Camera. The bounds are an axis-aligned rectangle.
* *
* A Camera bounds controls where the camera can scroll to within the world. It does not limit * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the
* rendering of the camera, or placement of the viewport within your game. * edges and into blank space. It does not limit the placement of Game Objects, or where
* the Camera viewport can be positioned.
*
* Temporarily disable the bounds by changing the boolean `Camera.useBounds`.
*
* Clear the bounds entirely by calling `Camera.removeBounds`.
*
* If you set bounds that are smaller than the viewport it will stop the Camera from being
* able to scroll. The bounds can be positioned where-ever you wish. By default they are from
* 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of
* the Camera bounds. However, you can position them anywhere. So if you wanted a game world
* that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y
* to be -1024, -1024, with a width and height of 2048. Depending on your game you may find
* it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle.
* *
* @method Phaser.Cameras.Scene2D.Camera#setBounds * @method Phaser.Cameras.Scene2D.Camera#setBounds
* @since 3.0.0 * @since 3.0.0
@ -1343,6 +1366,11 @@ var Camera = new Class({
{ {
this.centerToBounds(); this.centerToBounds();
} }
else
{
this.scrollX = this.clampX(this.scrollX);
this.scrollY = this.clampY(this.scrollY);
}
return this; return this;
}, },