Skip to content

Commit 31d2d39

Browse files
committed
Merge pull request phaserjs#557 from alvinsight/1.2
Examples ready to be released !
2 parents c8e6358 + 726c423 commit 31d2d39

15 files changed

Lines changed: 348 additions & 900 deletions

build/phaser.js

Lines changed: 290 additions & 878 deletions
Large diffs are not rendered by default.

examples/_site/examples.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,22 @@
708708
"file": "load+polygon+2.js",
709709
"title": "load polygon 2"
710710
},
711+
{
712+
"file": "lock+constraint.js",
713+
"title": "lock constraint"
714+
},
711715
{
712716
"file": "postbroadphase+callback.js",
713717
"title": "postbroadphase callback"
714718
},
719+
{
720+
"file": "prismatic+constraint.js",
721+
"title": "prismatic constraint"
722+
},
723+
{
724+
"file": "revolute+constraint.js",
725+
"title": "revolute constraint"
726+
},
715727
{
716728
"file": "springs.js",
717729
"title": "springs"

examples/animation/change texture on click.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ function changeMummy() {
3434

3535
function render() {
3636

37-
game.debug.spriteBounds(bot);
37+
game.debug.body(bot);
3838

3939
}

examples/arcade physics/sprite vs group.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ function create() {
1616

1717
game.stage.backgroundColor = '#2d2d2d';
1818

19-
game.physics.enable(game.world, Phaser.Physics.ARCADE);
20-
2119
// This example will check Sprite vs. Group collision
2220

2321
sprite = game.add.sprite(32, 200, 'phaser');
2422
sprite.name = 'phaser-dude';
23+
24+
game.physics.enable(sprite, Phaser.Physics.ARCADE);
2525

2626
group = game.add.group();
2727
group.enableBody = true;
2828
group.physicsBodyType = Phaser.Physics.ARCADE;
2929

3030
for (var i = 0; i < 50; i++)
3131
{
32-
var c = group.create(game.rnd.integerInRange(100, 770), game.rnd.integerInRange(0, 570), 'veggies', game.rnd.integerInRange(0, 36));
32+
var c = group.create(game.rnd.integerInRange(100, 770), game.rnd.integerInRange(0, 570), 'veggies', game.rnd.integerInRange(0, 35));
3333
c.name = 'veg' + i;
3434
c.body.immovable = true;
3535
}

examples/basics/03 - move an image.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function create() {
1919
// and assign it to a variable
2020
var image = game.add.sprite(0, 0, 'einstein');
2121

22-
image.physicsEnabled = true;
22+
game.physics.enable(image, Phaser.Physics.ARCADE);
2323

24-
image.body.moveRight(150);
24+
image.body.velocity.x=150;
2525

2626
}

examples/camera/basic follow.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ function create() {
2424
game.add.sprite(game.world.randomX, game.world.randomY, 'ufo');
2525
}
2626

27+
game.physics.startSystem(Phaser.Physics.P2JS);
28+
2729
fixed = game.add.sprite(300, 320, 'player');
2830
fixed.fixedToCamera = true;
2931
fixed.cameraOffset.x = 300;
3032
fixed.cameraOffset.y = 300;
3133

3234
player = game.add.sprite(150, 320, 'player');
3335

34-
player.physicsEnabled = true;
36+
game.physics.p2.enable(player);
3537

3638
cursors = game.input.keyboard.createCursorKeys();
3739

examples/debug/debug physics.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ function create() {
2020
sprite = game.add.sprite(0, 0, 'sprite');
2121
sprite.alpha = 0.5 ;
2222
sprite.x = game.width / 2 ;
23-
sprite.physicsEnabled = true;
2423

2524
// create sprite B
2625
otherSprite = game.add.sprite(0, 0, 'otherSprite');
2726
otherSprite.alpha = 0.5 ;
2827
otherSprite.x = (game.width / 2) + 150 ;
2928
otherSprite.y = (game.height / 2) + 150 ;
30-
otherSprite.physicsEnabled = true;
31-
otherSprite.body.immovable = true ;
29+
30+
31+
32+
game.physics.enable([sprite,otherSprite], Phaser.Physics.ARCADE);
33+
34+
3235
}
3336

3437
function update()

examples/geometry/circle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function create() {
1212

1313
function render () {
1414

15-
game.debug.circle(circle,'#cfffff');
15+
game.debug.geom(circle,'#cfffff');
1616
game.debug.text('Diameter : '+circle.diameter,50,200);
1717
game.debug.text('Circumference : '+circle.circumference(),50,230);
1818

examples/input/follow mouse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var sprite;
1212
function create() {
1313

1414
sprite = game.add.sprite(game.world.centerX, game.world.centerY, 'ball');
15+
game.physics.enable(sprite, Phaser.Physics.ARCADE);
1516

1617
}
1718

@@ -21,7 +22,7 @@ function update() {
2122
if (game.input.mousePointer.isDown)
2223
{
2324
// 400 is the speed it will move towards the mouse
24-
game.physics.moveToPointer(sprite, 400);
25+
game.physics.arcade.moveToPointer(sprite, 400);
2526

2627
// if it's overlapping the mouse, don't move any more
2728
if (Phaser.Rectangle.contains(sprite.body, game.input.x, game.input.y))

examples/input/keyboard hotkeys.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function create() {
1717

1818
game.stage.backgroundColor = '#736357';
1919

20+
game.add.text(0,0,'Press one, two or three !',{});
21+
2022
// Here we create 3 hotkeys, keys 1-3 and bind them all to their own functions
2123

2224
key1 = game.input.keyboard.addKey(Phaser.Keyboard.ONE);

0 commit comments

Comments
 (0)