@@ -681,7 +681,7 @@ var Body = new Class({
681681 * @type {Phaser.Physics.Arcade.Types.ArcadeBodyCollision }
682682 * @since 3.0.0
683683 */
684- this . blocked = { none : true , up : false , down : false , left : false , right : false } ;
684+ this . blocked = { none : true , up : false , down : false , left : false , right : false , by : null } ;
685685
686686 /**
687687 * Whether this Body is colliding with a tile or the world boundary.
@@ -929,6 +929,7 @@ var Body = new Class({
929929 this . updateCenter ( ) ;
930930 }
931931
932+ blocked . by = null ;
932933 blocked . up = worldBlocked . up ;
933934 blocked . down = worldBlocked . down ;
934935 blocked . left = worldBlocked . left ;
@@ -965,6 +966,8 @@ var Body = new Class({
965966
966967 var velocity = this . velocity ;
967968
969+ // this.newVelocity.set(velocity.x * delta, velocity.y * delta);
970+
968971 this . position . x += this . getMoveX ( velocity . x * delta ) ;
969972 this . position . y += this . getMoveY ( velocity . y * delta ) ;
970973 }
@@ -979,11 +982,11 @@ var Body = new Class({
979982 var bx = ( this . worldBounce ) ? this . worldBounce . x : this . bounce . x ;
980983 var by = ( this . worldBounce ) ? this . worldBounce . y : this . bounce . y ;
981984
985+ // Reverse the velocity for the bounce and flip the delta
986+ velocity . x *= - bx ;
987+
982988 if ( bx !== 0 )
983989 {
984- // Reverse the velocity for the bounce and flip the delta
985- velocity . x *= - bx ;
986-
987990 if ( worldBlocked . left )
988991 {
989992 this . x = worldBounds . x + ( 1 * bx ) ;
@@ -994,11 +997,11 @@ var Body = new Class({
994997 }
995998 }
996999
1000+ // Reverse the velocity for the bounce and flip the delta
1001+ velocity . y *= - by ;
1002+
9971003 if ( by !== 0 )
9981004 {
999- // Reverse the velocity for the bounce and flip the delta
1000- velocity . y *= - by ;
1001-
10021005 if ( worldBlocked . up )
10031006 {
10041007 this . y = worldBounds . y + ( 1 * by ) ;
@@ -1043,12 +1046,6 @@ var Body = new Class({
10431046
10441047 var gameObject = this . gameObject ;
10451048
1046- // var px = gameObject.x + gameObject.scaleX * (this.offset.x - gameObject.displayOriginX);
1047- // var py = gameObject.y + gameObject.scaleY * (this.offset.y - gameObject.displayOriginY);
1048-
1049- // var dx = this.position.x - px;
1050- // var dy = this.position.y - py;
1051-
10521049 if ( this . moves )
10531050 {
10541051 var mx = this . deltaMax . x ;
@@ -1077,10 +1074,10 @@ var Body = new Class({
10771074 dy = my ;
10781075 }
10791076 }
1080- }
10811077
1082- gameObject . x += dx ;
1083- gameObject . y += dy ;
1078+ gameObject . x += dx ;
1079+ gameObject . y += dy ;
1080+ }
10841081
10851082 if ( dx < 0 )
10861083 {
@@ -1801,43 +1798,63 @@ var Body = new Class({
18011798 return this ;
18021799 } ,
18031800
1804- setBlockedUp : function ( )
1801+ setBlockedUp : function ( by )
18051802 {
18061803 var blocked = this . blocked ;
18071804
18081805 blocked . up = true ;
18091806 blocked . none = false ;
18101807
1808+ if ( ! blocked . by )
1809+ {
1810+ blocked . by = by ;
1811+ }
1812+
18111813 return this ;
18121814 } ,
18131815
1814- setBlockedDown : function ( )
1816+ setBlockedDown : function ( by )
18151817 {
18161818 var blocked = this . blocked ;
18171819
18181820 blocked . down = true ;
18191821 blocked . none = false ;
18201822
1823+ if ( ! blocked . by )
1824+ {
1825+ blocked . by = by ;
1826+ }
1827+
18211828 return this ;
18221829 } ,
18231830
1824- setBlockedLeft : function ( )
1831+ setBlockedLeft : function ( by )
18251832 {
18261833 var blocked = this . blocked ;
18271834
18281835 blocked . left = true ;
18291836 blocked . none = false ;
18301837
1838+ if ( ! blocked . by )
1839+ {
1840+ blocked . by = by ;
1841+ }
1842+
18311843 return this ;
18321844 } ,
18331845
1834- setBlockedRight : function ( )
1846+ setBlockedRight : function ( by )
18351847 {
18361848 var blocked = this . blocked ;
18371849
18381850 blocked . right = true ;
18391851 blocked . none = false ;
18401852
1853+ if ( ! blocked . by )
1854+ {
1855+ blocked . by = by ;
1856+ }
1857+
18411858 return this ;
18421859 } ,
18431860
0 commit comments