Skip to content

Commit b03c623

Browse files
committed
And some more examples updated :)
1 parent 2669f81 commit b03c623

8 files changed

Lines changed: 18 additions & 14 deletions

File tree

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/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();

examples/input/game scale.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ function preload() {
1414

1515
}
1616

17+
var cursors;
18+
1719
function create() {
1820

1921
//We increase the size of our game world
@@ -25,26 +27,28 @@ function create() {
2527
game.add.sprite(game.world.randomX, game.world.randomY, 'melon');
2628
}
2729

30+
cursors = game.input.keyboard.createCursorKeys();
31+
2832
}
2933

3034
function update() {
3135

3236
//This allows us to move the game camera using the keyboard
3337

34-
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
38+
if (cursors.left.isDown)
3539
{
3640
game.camera.x -= 4;
3741
}
38-
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
42+
else if (cursors.right.isDown)
3943
{
4044
game.camera.x += 4;
4145
}
4246

43-
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
47+
if (cursors.up.isDown)
4448
{
4549
game.camera.y -= 4;
4650
}
47-
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
51+
else if (cursors.down.isDown)
4852
{
4953
game.camera.y += 4;
5054
}

examples/input/motion lock - horizontal.js

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

1919
// Enable Input detection. Sprites have this disabled by default,
2020
// so you have to start it if you want to interact with them.
21-
sprite.input.start(0,true);
21+
sprite.inputEnabled = true;
2222

2323
// This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false)
2424
// or if it will snap to the center (true)

examples/input/motion lock - vertical.js

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

1919
// Enable Input detection. Sprites have this disabled by default,
2020
// so you have to start it if you want to interact with them.
21-
sprite.input.start(0,true);
21+
sprite.inputEnabled = true;
2222

2323
// This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false)
2424
// or if it will snap to the center (true)

0 commit comments

Comments
 (0)