Skip to content

Commit b2c49ef

Browse files
committed
Merging previous changes back in again.
1 parent f6af6fe commit b2c49ef

7 files changed

Lines changed: 268 additions & 809 deletions

File tree

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ Significant API changes:
5656
* Tilemap.createFromObjects can now turn a bunch of Tiled objects into Sprites in one single call, and copies across all properties as well.
5757
* Tween.onStartCallback and onCompleteCallback have been removed to avoid confusion. You should use the onStart, onLoop and onComplete events instead.
5858
* Button.forceOut default value has changed from true to false, so Buttons will revert to an Up state (if set) when pressed and released.
59-
* Body.drag has been removed. Please use the new Body.friction value instead (which is a number value, not a Point object)
6059
* The way the collision process callback works has changed significantly and now works as originally intended.
6160
* The World level quadtree is no longer created, they are now built and ripped down each time you collide a Group, this helps collision accuracy.
6261
* Bodies are no longer added to a world quadtree, so have had all of their quadtree properties removed such as skipQuadtree, quadTreeIndex, etc.
62+
* Body.drag has been removed. Please use the new Body.friction value instead (which is a number value, not a Point object)
63+
* Body.embedded and Body.wasTouching have been removed as they are no longer required.
64+
* Body.customSeparateX/Y have been removed as you should now use Body.customSeparateCallback.
65+
* Body.maxVelocity defaults have been removed from 10,000 to 2000.
66+
* Body.friction is new and has a default value of 0.1 - you may need to set this to zero depending on the type of game you're making.
67+
* Body.customSeparateCallback allows you to set your own callback when two Bodies need to separate rather than using the built-in method.
6368

6469

6570
New features:
@@ -87,12 +92,14 @@ New features:
8792
* Groups now have an 'alive' property, which can be useful when iterating through child groups with functions like forEachAlive.
8893
* Added a new Project Template "Full Screen Mobile" which you can find in the resources folder. Contains html / css / layout needed for a deployed Phaser game.
8994
* Body.speed - the current speed of the body.
95+
* Body.angle - the current angle the Body is facing based on its velocity. This is not the same as the Sprite angle that may own the body.
9096
* Body.friction - This now replaces Body.drag and provides for a much smoother friction experience.
9197
* Body.minBounceVelocity - If a Body has bounce set, this threshold controls if it should rebound or not. Use it to stop 'jittering' on bounds/tiles with super-low velocities.
9298
* QuadTree.populate - you can pass it a Group and it'll automatically insert all of the children ready for inspection.
9399
* Input.setMoveCallback allows you to set a callback that will be fired each time the activePointer receives a DOM move event.
94100
* Math.distancePow(x1,y1,x2,y2,power) returns the distance between two coordinates at the given power.
95101
* Physics.collideArray(obj, array) for when you want to collide an object against a number of sprites that aren't all in the same Group.
102+
* Physics.overlapArray(obj, array) for when you want to overlap test an object against a number of sprites that aren't all in the same Group.
96103
* Math.reverseAngle - reverses an angle (in radians).
97104
* Math.normalizeAngle - normalises an angle, now in radians only.
98105
* Math.normalizeLatitude - Normalizes a latitude to the [-90,90] range.

examples/tilemaps/sci fly.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
33

44
function preload() {
55

6-
game.load.tilemap('level3', 'assets/maps/cybernoid.json', null, Phaser.Tilemap.TILED_JSON);
7-
game.load.image('tiles', 'assets/maps/cybernoid.png', 16, 16);
6+
game.load.tilemap('level3', 'assets/tilemaps/maps/cybernoid.json', null, Phaser.Tilemap.TILED_JSON);
7+
game.load.image('tiles', 'assets/tilemaps/tiles/cybernoid.png', 16, 16);
88
game.load.image('phaser', 'assets/sprites/phaser-ship.png');
99
game.load.image('chunk', 'assets/sprites/chunk.png');
1010

@@ -29,13 +29,12 @@ function create() {
2929
// Basically this sets EVERY SINGLE tile to fully collide on all faces
3030
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
3131

32-
// layer.debug = true;
32+
layer.debug = true;
3333

3434
layer.resizeWorld();
3535

3636
sprite = game.add.sprite(450, 80, 'phaser');
3737
sprite.anchor.setTo(0.5, 0.5);
38-
sprite.angle = 5;
3938

4039
game.camera.follow(sprite);
4140
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
@@ -47,7 +46,7 @@ function create() {
4746
emitter.makeParticles('chunk');
4847
emitter.minRotation = 0;
4948
emitter.maxRotation = 0;
50-
emitter.gravity = 5;
49+
emitter.gravity = 150;
5150
emitter.bounce.setTo(0.5, 0.5);
5251

5352
game.input.onDown.add(particleBurst, this);

examples/wip/2ball.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ function create() {
2828
var bg = game.add.sprite(0, 0, bmd);
2929
bg.body.moves = false;
3030

31-
test7();
31+
test4();
3232

3333
}
3434

3535
function test7() {
3636

3737
game.physics.gravity.y = 200;
3838

39-
sprite = game.add.sprite(300, 300, 'gameboy', 0);
39+
sprite = game.add.sprite(0, 300, 'gameboy', 0);
4040
sprite.name = 'red';
4141
sprite.body.collideWorldBounds = true;
4242
sprite.body.bounce.setTo(0.8, 0.8);
@@ -119,7 +119,7 @@ function stop5() {
119119

120120
function test4() {
121121

122-
game.physics.gravity.y = 50;
122+
game.physics.gravity.y = 150;
123123

124124
sprite = game.add.sprite(300, 0, 'gameboy', 0);
125125
sprite.name = 'red';
@@ -242,15 +242,15 @@ function update() {
242242

243243
// game.physics.collide(group, group);
244244

245-
// if (sprite3)
246-
// {
247-
// game.physics.collideArray(sprite, [sprite2, sprite3]);
248-
// game.physics.collide(sprite2, sprite3);
249-
// }
250-
// else
251-
// {
252-
// game.physics.collide(sprite, sprite2);
253-
// }
245+
if (sprite3)
246+
{
247+
game.physics.collideArray(sprite, [sprite2, sprite3]);
248+
game.physics.collide(sprite2, sprite3);
249+
}
250+
else
251+
{
252+
game.physics.collide(sprite, sprite2);
253+
}
254254

255255

256256
if (sprite)

examples/wip/multiball.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ function create() {
2323
bg.body.moves = false;
2424

2525
game.physics.gravity.y = 250;
26+
// game.physics.gravity.x = 250;
2627

2728
sprites = game.add.group();
2829

29-
for (var i = 0; i < 40; i++)
30+
for (var i = 0; i < 20; i++)
3031
{
3132
var s = sprites.create(game.rnd.integerInRange(100, 700), game.rnd.integerInRange(32, 200), 'ball');
3233
s.body.velocity.x = game.rnd.integerInRange(-400, 400);

examples/wip/sci-fly2.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
33

44
function preload() {
55

6-
game.load.tilemap('level3', 'assets/maps/cybernoid.json', null, Phaser.Tilemap.TILED_JSON);
7-
game.load.image('tiles', 'assets/maps/cybernoid.png', 16, 16);
6+
game.load.tilemap('level3', 'assets/tilemaps/maps/cybernoid.json', null, Phaser.Tilemap.TILED_JSON);
7+
game.load.image('tiles', 'assets/tilemaps/tiles/cybernoid.png', 16, 16);
88
game.load.image('phaser', 'assets/sprites/phaser-ship.png');
99
game.load.image('chunk', 'assets/sprites/chunk.png');
1010

@@ -29,7 +29,7 @@ function create() {
2929
// Basically this sets EVERY SINGLE tile to fully collide on all faces
3030
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
3131

32-
// layer.debug = true;
32+
layer.debug = true;
3333

3434
layer.resizeWorld();
3535

@@ -47,7 +47,7 @@ function create() {
4747
emitter.makeParticles('chunk');
4848
emitter.minRotation = 0;
4949
emitter.maxRotation = 0;
50-
emitter.gravity = 5;
50+
emitter.gravity = 150;
5151
emitter.bounce.setTo(0.5, 0.5);
5252

5353
game.input.onDown.add(particleBurst, this);

0 commit comments

Comments
 (0)