Skip to content

Commit 74d52dd

Browse files
committed
Merge pull request phaserjs#2443 from drhayes/dev
Add a "shakeIntensity" property to Camera.
2 parents 6bc93de + fb709fe commit 74d52dd

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

src/core/Camera.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Phaser.Camera = function (game, id, x, y, width, height) {
4848
* The Camera is bound to this Rectangle and cannot move outside of it. By default it is enabled and set to the size of the World.
4949
* The Rectangle can be located anywhere in the world and updated as often as you like. If you don't wish the Camera to be bound
5050
* at all then set this to null. The values can be anything and are in World coordinates, with 0,0 being the top-left of the world.
51-
*
51+
*
5252
* @property {Phaser.Rectangle} bounds - The Rectangle in which the Camera is bounded. Set to null to allow for movement anywhere.
5353
*/
5454
this.bounds = new Phaser.Rectangle(x, y, width, height);
@@ -271,10 +271,10 @@ Phaser.Camera.prototype = {
271271
*
272272
* You can set the follow type and a linear interpolation value.
273273
* Use low lerp values (such as 0.1) to automatically smooth the camera motion.
274-
*
274+
*
275275
* If you find you're getting a slight "jitter" effect when following a Sprite it's probably to do with sub-pixel rendering of the Sprite position.
276276
* This can be disabled by setting `game.renderer.renderSession.roundPixels = true` to force full pixel rendering.
277-
*
277+
*
278278
* @method Phaser.Camera#follow
279279
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text} target - The object you want the camera to track. Set to null to not follow anything.
280280
* @param {number} [style] - Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
@@ -439,7 +439,7 @@ Phaser.Camera.prototype = {
439439
},
440440

441441
/**
442-
* This creates a camera fade effect. It works by filling the game with the
442+
* This creates a camera fade effect. It works by filling the game with the
443443
* color specified, over the duration given, ending with a solid fill.
444444
*
445445
* You can use this for things such as transitioning to a new scene.
@@ -908,3 +908,25 @@ Object.defineProperty(Phaser.Camera.prototype, "height", {
908908
}
909909

910910
});
911+
912+
913+
/**
914+
* The Cameras shake intensity.
915+
* @name Phaser.Camera#shakeIntensity
916+
* @property {number} shakeIntensity - Gets or sets the cameras shake intensity.
917+
*/
918+
Object.defineProperty(Phaser.Camera.prototype, "shakeIntensity", {
919+
920+
get: function () {
921+
922+
return this._shake.intensity;
923+
924+
},
925+
926+
set: function (value) {
927+
928+
this._shake.intensity = value;
929+
930+
}
931+
932+
});

0 commit comments

Comments
 (0)