From b03c6231e1531d7ce4cf662c50a66a9f9f6f1351 Mon Sep 17 00:00:00 2001 From: alvinsight Date: Fri, 21 Feb 2014 17:58:52 +0000 Subject: [PATCH] And some more examples updated :) --- examples/groups/bring a group to top.js | 4 ++-- examples/groups/call all.js | 4 ++-- examples/groups/remove.js | 2 +- examples/groups/replace.js | 4 ++-- examples/input/drop limitation.js | 2 +- examples/input/game scale.js | 12 ++++++++---- examples/input/motion lock - horizontal.js | 2 +- examples/input/motion lock - vertical.js | 2 +- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/examples/groups/bring a group to top.js b/examples/groups/bring a group to top.js index 687c07f2..bff5bdf4 100644 --- a/examples/groups/bring a group to top.js +++ b/examples/groups/bring a group to top.js @@ -34,7 +34,7 @@ function create() { var tempSprite = game.add.sprite(game.world.randomX, game.world.randomY, 'atari1'); tempSprite.name = 'atari' + i; - tempSprite.input.start(i, true); + tempSprite.inputEnabled = true; tempSprite.input.enableDrag(false, true); group1.add(tempSprite); @@ -44,7 +44,7 @@ function create() { var tempSprite=game.add.sprite(game.world.randomX, game.world.randomY, 'sonic'); tempSprite.name = 'sonic' + i; - tempSprite.input.start(10 + i, true); + tempSprite.inputEnabled = true; tempSprite.input.enableDrag(false, true); group2.add(tempSprite); diff --git a/examples/groups/call all.js b/examples/groups/call all.js index 250d6fa0..8123997f 100644 --- a/examples/groups/call all.js +++ b/examples/groups/call all.js @@ -19,12 +19,12 @@ function create() { item = game.add.sprite(290, 98 * (i + 1), 'item', i); // Enable input. - item.input.start(0, true); + item.inputEnabled = true; item.events.onInputUp.add(kill); // An item besides the left one. item = game.add.sprite(388, 98 * (i + 1), 'item', i + 3); - item.input.start(0, true); + item.inputEnabled = true; item.events.onInputUp.add(kill); } diff --git a/examples/groups/remove.js b/examples/groups/remove.js index 85ed08dd..4b88e350 100644 --- a/examples/groups/remove.js +++ b/examples/groups/remove.js @@ -23,7 +23,7 @@ function create() { // Directly create sprites from the group. item = items.create(90, 90 * i, 'item', i); // Enable input detection, then it's possible be dragged. - item.input.start(0,true); + item.inputEnabled = true; // Make this item draggable. item.input.enableDrag(); // Then we make it snap to 90x90 grids. diff --git a/examples/groups/replace.js b/examples/groups/replace.js index 8fac9595..23de93ce 100644 --- a/examples/groups/replace.js +++ b/examples/groups/replace.js @@ -25,12 +25,12 @@ function create() { // Directly create sprites from the left group. item = left.create(290, 98 * (i + 1), 'item', i); // Enable input. - item.input.start(0, false, true); + item.inputEnabled = true; item.events.onInputUp.add(select); // Add another to the right group. item = right.create(388, 98 * (i + 1), 'item', i + 3); // Enable input. - item.input.start(0,true); + item.inputEnabled = true; item.events.onInputUp.add(select); } } diff --git a/examples/input/drop limitation.js b/examples/input/drop limitation.js index 76a0c615..0fbc3533 100644 --- a/examples/input/drop limitation.js +++ b/examples/input/drop limitation.js @@ -18,7 +18,7 @@ function create() { item = game.add.sprite(90, 90 * i, 'item', i); // Enable input detection, then it's possible be dragged. - item.input.start(0,true); + item.inputEnabled = true; // Make this item draggable. item.input.enableDrag(); diff --git a/examples/input/game scale.js b/examples/input/game scale.js index 0e6542e5..b750015a 100644 --- a/examples/input/game scale.js +++ b/examples/input/game scale.js @@ -14,6 +14,8 @@ function preload() { } +var cursors; + function create() { //We increase the size of our game world @@ -25,26 +27,28 @@ function create() { game.add.sprite(game.world.randomX, game.world.randomY, 'melon'); } + cursors = game.input.keyboard.createCursorKeys(); + } function update() { //This allows us to move the game camera using the keyboard - if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + if (cursors.left.isDown) { game.camera.x -= 4; } - else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + else if (cursors.right.isDown) { game.camera.x += 4; } - if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) + if (cursors.up.isDown) { game.camera.y -= 4; } - else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) + else if (cursors.down.isDown) { game.camera.y += 4; } diff --git a/examples/input/motion lock - horizontal.js b/examples/input/motion lock - horizontal.js index 1e2a82f2..fff81273 100644 --- a/examples/input/motion lock - horizontal.js +++ b/examples/input/motion lock - horizontal.js @@ -18,7 +18,7 @@ function create() { // Enable Input detection. Sprites have this disabled by default, // so you have to start it if you want to interact with them. - sprite.input.start(0,true); + sprite.inputEnabled = true; // This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false) // or if it will snap to the center (true) diff --git a/examples/input/motion lock - vertical.js b/examples/input/motion lock - vertical.js index 045bbc64..ea5692c3 100644 --- a/examples/input/motion lock - vertical.js +++ b/examples/input/motion lock - vertical.js @@ -18,7 +18,7 @@ function create() { // Enable Input detection. Sprites have this disabled by default, // so you have to start it if you want to interact with them. - sprite.input.start(0,true); + sprite.inputEnabled = true; // This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false) // or if it will snap to the center (true)