Skip to content

Commit ee1a1cd

Browse files
committed
Merge pull request phaserjs#468 from alvinsight/1.2
Examples updated :)
2 parents 1448562 + b03c623 commit ee1a1cd

14 files changed

Lines changed: 34 additions & 21 deletions

examples/basics/03 - move an image.js

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

22-
image.body.velocity.x=50;
22+
image.physicsEnabled = true;
23+
24+
image.body.moveRight(150);
2325

2426
}

examples/camera/basic follow.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function create() {
3131

3232
player = game.add.sprite(150, 320, 'player');
3333

34+
player.physicsEnabled = true;
35+
3436
cursors = game.input.keyboard.createCursorKeys();
3537

3638
game.camera.follow(player);
@@ -39,15 +41,15 @@ function create() {
3941

4042
function update() {
4143

42-
player.body.velocity.setTo(0, 0);
44+
player.body.setZeroVelocity();
4345

4446
if (cursors.up.isDown)
4547
{
46-
player.body.velocity.y = -200;
48+
player.body.moveUp(200)
4749
}
4850
else if (cursors.down.isDown)
4951
{
50-
player.body.velocity.y = 200;
52+
player.body.moveDown(200);
5153
}
5254

5355
if (cursors.left.isDown)
@@ -56,7 +58,7 @@ function update() {
5658
}
5759
else if (cursors.right.isDown)
5860
{
59-
player.body.velocity.x = 200;
61+
player.body.moveRight(200);
6062
}
6163

6264
}

examples/camera/camera cull.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function update() {
4242

4343
function render() {
4444

45-
game.debug.renderSpriteCorners(s, true, true);
45+
game.debug.renderSpriteBounds(s);
4646
game.debug.renderSpriteInfo(s, 20, 32);
4747

4848
}

examples/display/fullscreen.js

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

2727
function gofull() {
2828

29-
game.stage.scale.startFullScreen();
29+
game.scale.startFullScreen();
3030

3131
}
3232

examples/groups/bring a group to top.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function create() {
3434
var tempSprite = game.add.sprite(game.world.randomX, game.world.randomY, 'atari1');
3535

3636
tempSprite.name = 'atari' + i;
37-
tempSprite.input.start(i, true);
37+
tempSprite.inputEnabled = true;
3838
tempSprite.input.enableDrag(false, true);
3939

4040
group1.add(tempSprite);
@@ -44,7 +44,7 @@ function create() {
4444
var tempSprite=game.add.sprite(game.world.randomX, game.world.randomY, 'sonic');
4545

4646
tempSprite.name = 'sonic' + i;
47-
tempSprite.input.start(10 + i, true);
47+
tempSprite.inputEnabled = true;
4848
tempSprite.input.enableDrag(false, true);
4949

5050
group2.add(tempSprite);

examples/groups/call all.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ function create() {
1919
item = game.add.sprite(290, 98 * (i + 1), 'item', i);
2020

2121
// Enable input.
22-
item.input.start(0, true);
22+
item.inputEnabled = true;
2323
item.events.onInputUp.add(kill);
2424

2525
// An item besides the left one.
2626
item = game.add.sprite(388, 98 * (i + 1), 'item', i + 3);
27-
item.input.start(0, true);
27+
item.inputEnabled = true;
2828
item.events.onInputUp.add(kill);
2929
}
3030

examples/groups/depth sort.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function create() {
3535
// The player
3636
sprite = group.create(300, 200, 'phaser');
3737

38+
sprite.physicsEnabled = true;
39+
3840
// Some trees
3941
for (var i = 0; i < 50; i++)
4042
{

examples/groups/remove.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function create() {
2323
// Directly create sprites from the group.
2424
item = items.create(90, 90 * i, 'item', i);
2525
// Enable input detection, then it's possible be dragged.
26-
item.input.start(0,true);
26+
item.inputEnabled = true;
2727
// Make this item draggable.
2828
item.input.enableDrag();
2929
// Then we make it snap to 90x90 grids.

examples/groups/replace.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ function create() {
2525
// Directly create sprites from the left group.
2626
item = left.create(290, 98 * (i + 1), 'item', i);
2727
// Enable input.
28-
item.input.start(0, false, true);
28+
item.inputEnabled = true;
2929
item.events.onInputUp.add(select);
3030
// Add another to the right group.
3131
item = right.create(388, 98 * (i + 1), 'item', i + 3);
3232
// Enable input.
33-
item.input.start(0,true);
33+
item.inputEnabled = true;
3434
item.events.onInputUp.add(select);
3535
}
3636
}

examples/input/drop limitation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function create() {
1818
item = game.add.sprite(90, 90 * i, 'item', i);
1919

2020
// Enable input detection, then it's possible be dragged.
21-
item.input.start(0,true);
21+
item.inputEnabled = true;
2222

2323
// Make this item draggable.
2424
item.input.enableDrag();

0 commit comments

Comments
 (0)