Skip to content

Commit da5d8c9

Browse files
committed
Updated p2.js to latest build.
1 parent 215632c commit da5d8c9

49 files changed

Lines changed: 2751 additions & 1275 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Updates:
5757
* Updated display/fullscreen example to reflect new full screen change.
5858
* Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :)
5959
* Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
60+
* The tutorials have now been translated into Spanish - thanks feiss :)
61+
* separateY updated to re-implement the 'riding platforms' special condition (thanks cocoademon)
6062

6163

6264
Bug Fixes:

examples/wip/moveToPointer.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
3+
4+
function preload() {
5+
6+
game.load.image('arrow', 'assets/sprites/arrow.png');
7+
8+
}
9+
10+
var sprite;
11+
var tween;
12+
13+
function create() {
14+
15+
sprite = game.add.sprite(32, 32, 'arrow');
16+
17+
sprite.anchor.setTo(0.5, 0.5);
18+
19+
game.input.onDown.add(moveSprite, this);
20+
21+
}
22+
23+
function moveSprite (pointer) {
24+
25+
if (tween && tween.isRunning)
26+
{
27+
tween.stop();
28+
}
29+
30+
sprite.rotation = game.physics.angleToPointer(sprite, pointer);
31+
32+
// 300 = 300 pixels per second = the speed the sprite will move at, regardless of the distance it has to travel
33+
var duration = (game.physics.distanceToPointer(sprite, pointer) / 300) * 1000;
34+
35+
tween = game.add.tween(sprite).to({ x: pointer.x, y: pointer.y }, duration, Phaser.Easing.Linear.None, true);
36+
37+
}
38+

src/physics/advanced/collision/Broadphase.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
var vec2 = require('../math/vec2')
2-
, Nearphase = require('./Nearphase')
3-
, Shape = require('./../shapes/Shape')
42

53
module.exports = Broadphase;
64

@@ -10,6 +8,12 @@ module.exports = Broadphase;
108
* @constructor
119
*/
1210
function Broadphase(){
11+
12+
/**
13+
* The resulting overlapping pairs. Will be filled with results during .getCollisionPairs().
14+
* @property result
15+
* @type {Array}
16+
*/
1317
this.result = [];
1418
};
1519

@@ -23,10 +27,7 @@ Broadphase.prototype.getCollisionPairs = function(world){
2327
throw new Error("getCollisionPairs must be implemented in a subclass!");
2428
};
2529

26-
// Temp things
27-
var dist = vec2.create(),
28-
worldNormal = vec2.create(),
29-
yAxis = vec2.fromValues(0,1);
30+
var dist = vec2.create();
3031

3132
/**
3233
* Check whether the bounding radius of two bodies overlap.

src/physics/advanced/collision/GridBroadphase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ GridBroadphase.prototype.getCollisionPairs = function(world){
104104
}
105105
} else if(si instanceof Plane){
106106
// Put in all bins for now
107-
if(bi.angle === 0){
107+
if(bi.angle == 0){
108108
var y = bi.position[1];
109109
for(var j=0; j!==Nbins && ymin+binsizeY*(j-1)<y; j++){
110110
for(var k=0; k<nx; k++){

0 commit comments

Comments
 (0)