File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ module.exports = function (grunt) {
203203 'src/physics/p2/PointProxy.js' ,
204204 'src/physics/p2/InversePointProxy.js' ,
205205 'src/physics/p2/Body.js' ,
206+ 'src/physics/p2/BodyDebug.js' ,
206207 'src/physics/p2/Spring.js' ,
207208 'src/physics/p2/Material.js' ,
208209 'src/physics/p2/ContactMaterial.js' ,
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ New features:
147147* Group.reverse() reverses the display order of all children in the Group.
148148* Tweens are now bound to their own TweenManager, not always the global game one. So you can create your own managers now (for you clark :)
149149* ScaleManager.fullScreenTarget allows you to change the DOM element that the fullscreen API is called on (feature request #526 )
150+ * Merged Georges p2 BodyDebug and reformatted for jshint pass. Looks awesome :)
150151
151152
152153Updates:
Original file line number Diff line number Diff line change 151151 <script src=" $ path/src/physics/p2/PointProxy.js"></script>
152152 <script src=" $ path/src/physics/p2/InversePointProxy.js"></script>
153153 <script src=" $ path/src/physics/p2/Body.js"></script>
154+ <script src=" $ path/src/physics/p2/BodyDebug.js"></script>
154155 <script src=" $ path/src/physics/p2/Spring.js"></script>
155156 <script src=" $ path/src/physics/p2/Material.js"></script>
156157 <script src=" $ path/src/physics/p2/ContactMaterial.js"></script>
Original file line number Diff line number Diff line change @@ -19,8 +19,11 @@ var start = false;
1919
2020function create ( ) {
2121
22+ // Enable p2 physics
23+ game . physics . startSystem ( Phaser . Physics . P2 ) ;
24+
2225 contra = game . add . sprite ( 400 , 300 , 'contra2' ) ;
23- contra . physicsEnabled = true ;
26+ game . physics . enable ( contra , Phaser . Physics . P2 , true ) ;
2427 contra . body . clearShapes ( ) ;
2528 contra . body . loadPolygon ( 'physicsData' , 'contra2' ) ;
2629
@@ -39,6 +42,6 @@ function update() {
3942
4043function render ( ) {
4144
42- game . debug . physicsBody ( contra . body , '#00ffff' ) ;
45+ // game.debug.physicsBody(contra.body, '#00ffff');
4346
4447}
Original file line number Diff line number Diff line change @@ -998,10 +998,18 @@ Phaser.Physics.P2.Body.prototype = {
998998
999999 } ,
10001000
1001- shapeChanged : function ( ) {
1002- console . log ( 'shapeChanged' , this . debugBody )
1003- //shape has changed, so try to redraw if debug is available
1004- if ( this . debugBody ) this . debugBody . draw ( )
1001+ /**
1002+ * Updates the debug draw if any body shapes change.
1003+ *
1004+ * @method Phaser.Physics.P2.Body#shapeChanged
1005+ */
1006+ shapeChanged : function ( ) {
1007+
1008+ if ( this . debugBody )
1009+ {
1010+ this . debugBody . draw ( ) ;
1011+ }
1012+
10051013 } ,
10061014
10071015 /**
You can’t perform that action at this time.
0 commit comments