Skip to content

Commit 8c7468d

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents a9cbf23 + 1485f34 commit 8c7468d

3 files changed

Lines changed: 71 additions & 8 deletions

File tree

src/cameras/2d/Camera.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ var Camera = new Class({
428428
var cullW = cameraW + objectW;
429429
var cullH = cameraH + objectH;
430430

431-
if (tx > -objectW || ty > -objectH || tx < cullW || ty < cullH ||
432-
tw > -objectW || th > -objectH || tw < cullW || th < cullH)
431+
if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH &&
432+
tw > -objectW && th > -objectH && tw < cullW && th < cullH)
433433
{
434434
culledObjects.push(object);
435435
}
@@ -753,7 +753,7 @@ var Camera = new Class({
753753

754754
/**
755755
* Set the rotation of this Camera. This causes everything it renders to appear rotated.
756-
*
756+
*
757757
* Rotating a camera does not rotate the viewport itself, it is applied during rendering.
758758
*
759759
* @method Phaser.Cameras.Scene2D.Camera#setAngle
@@ -774,7 +774,7 @@ var Camera = new Class({
774774

775775
/**
776776
* Sets the background color for this Camera.
777-
*
777+
*
778778
* By default a Camera has a transparent background but it can be given a solid color, with any level
779779
* of transparency, via this method.
780780
*
@@ -845,7 +845,7 @@ var Camera = new Class({
845845

846846
/**
847847
* Set the position of the Camera viewport within the game.
848-
*
848+
*
849849
* This does not change where the camera is 'looking'. See `setScroll` to control that.
850850
*
851851
* @method Phaser.Cameras.Scene2D.Camera#setPosition
@@ -868,7 +868,7 @@ var Camera = new Class({
868868

869869
/**
870870
* Set the rotation of this Camera. This causes everything it renders to appear rotated.
871-
*
871+
*
872872
* Rotating a camera does not rotate the viewport itself, it is applied during rendering.
873873
*
874874
* @method Phaser.Cameras.Scene2D.Camera#setRotation
@@ -926,7 +926,7 @@ var Camera = new Class({
926926
* Set the position of where the Camera is looking within the game.
927927
* You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly.
928928
* Use this method, or the scroll properties, to move your camera around the game world.
929-
*
929+
*
930930
* This does not change where the camera viewport is placed. See `setPosition` to control that.
931931
*
932932
* @method Phaser.Cameras.Scene2D.Camera#setScroll
@@ -978,7 +978,7 @@ var Camera = new Class({
978978
* If you're trying to change where the Camera is looking at in your game, then see
979979
* the method `Camera.setScroll` instead. This method is for changing the viewport
980980
* itself, not what the camera can see.
981-
*
981+
*
982982
* By default a Camera is the same size as the game, but can be made smaller via this method,
983983
* allowing you to create mini-cam style effects by creating and positioning a smaller Camera
984984
* viewport within your game.

src/physics/arcade/Body.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,60 @@ var Body = new Class({
15931593
return this;
15941594
},
15951595

1596+
/**
1597+
* Enables or disables drag.
1598+
*
1599+
* @method Phaser.Physics.Arcade.Body#setAllowDrag
1600+
* @since 3.9.0
1601+
* @see Phaser.Physics.Arcade.Body#allowDrag
1602+
*
1603+
* @param {boolean} val - The value of `allowDrag`.
1604+
*
1605+
* @return {Phaser.Physics.Arcade.Body} This Body object.
1606+
*/
1607+
setAllowDrag: function (val)
1608+
{
1609+
this.allowDrag = val;
1610+
1611+
return this;
1612+
},
1613+
1614+
/**
1615+
* Enables or disables gravity's effect on this Body.
1616+
*
1617+
* @method Phaser.Physics.Arcade.Body#setAllowGravity
1618+
* @since 3.9.0
1619+
* @see Phaser.Physics.Arcade.Body#allowGravity
1620+
*
1621+
* @param {boolean} val - The value of `allowGravity`.
1622+
*
1623+
* @return {Phaser.Physics.Arcade.Body} This Body object.
1624+
*/
1625+
setAllowGravity: function (val)
1626+
{
1627+
this.allowGravity = val;
1628+
1629+
return this;
1630+
},
1631+
1632+
/**
1633+
* Enables or disables rotation.
1634+
*
1635+
* @method Phaser.Physics.Arcade.Body#setAllowRotation
1636+
* @since 3.9.0
1637+
* @see Phaser.Physics.Arcade.Body#allowRotation
1638+
*
1639+
* @param {boolean} val - The value of `allowRotation`.
1640+
*
1641+
* @return {Phaser.Physics.Arcade.Body} This Body object.
1642+
*/
1643+
setAllowRotation: function (val)
1644+
{
1645+
this.allowRotation = val;
1646+
1647+
return this;
1648+
},
1649+
15961650
/**
15971651
* Sets the Body's drag.
15981652
*

src/physics/arcade/PhysicsGroup.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ var Group = require('../../gameobjects/group/Group');
1717
* @property {boolean} [collideWorldBounds=false] - Sets {@link Phaser.Physics.Arcade.Body#collideWorldBounds}.
1818
* @property {number} [accelerationX=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.x}.
1919
* @property {number} [accelerationY=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.y}.
20+
* @property {boolean} [allowDrag=true] - Sets {@link Phaser.Physics.Arcade.Body#allowDrag}.
21+
* @property {boolean} [allowGravity=true] - Sets {@link Phaser.Physics.Arcade.Body#allowGravity}.
22+
* @property {boolean} [allowRotation=true] - Sets {@link Phaser.Physics.Arcade.Body#allowRotation}.
2023
* @property {number} [bounceX=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.x}.
2124
* @property {number} [bounceY=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.y}.
2225
* @property {number} [dragX=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.x}.
@@ -40,6 +43,9 @@ var Group = require('../../gameobjects/group/Group');
4043
* @property {boolean} setCollideWorldBounds - [description]
4144
* @property {number} setAccelerationX - [description]
4245
* @property {number} setAccelerationY - [description]
46+
* @property {boolean} setAllowDrag - [description]
47+
* @property {boolean} setAllowGravity - [description]
48+
* @property {boolean} setAllowRotation - [description]
4349
* @property {number} setBounceX - [description]
4450
* @property {number} setBounceY - [description]
4551
* @property {number} setDragX - [description]
@@ -133,6 +139,9 @@ var PhysicsGroup = new Class({
133139
setCollideWorldBounds: GetFastValue(config, 'collideWorldBounds', false),
134140
setAccelerationX: GetFastValue(config, 'accelerationX', 0),
135141
setAccelerationY: GetFastValue(config, 'accelerationY', 0),
142+
setAllowDrag: GetFastValue(config, 'allowDrag', true),
143+
setAllowGravity: GetFastValue(config, 'allowGravity', true),
144+
setAllowRotation: GetFastValue(config, 'allowRotation', true),
136145
setBounceX: GetFastValue(config, 'bounceX', 0),
137146
setBounceY: GetFastValue(config, 'bounceY', 0),
138147
setDragX: GetFastValue(config, 'dragX', 0),

0 commit comments

Comments
 (0)