diff --git a/examples/basics/03 - move an image.js b/examples/basics/03 - move an image.js index 0cdd9320..a98631a6 100644 --- a/examples/basics/03 - move an image.js +++ b/examples/basics/03 - move an image.js @@ -19,6 +19,8 @@ function create() { // and assign it to a variable var image = game.add.sprite(0, 0, 'einstein'); - image.body.velocity.x=50; + image.physicsEnabled = true; + + image.body.moveRight(150); } diff --git a/examples/camera/basic follow.js b/examples/camera/basic follow.js index bcb21bc7..5a949b48 100644 --- a/examples/camera/basic follow.js +++ b/examples/camera/basic follow.js @@ -31,6 +31,8 @@ function create() { player = game.add.sprite(150, 320, 'player'); + player.physicsEnabled = true; + cursors = game.input.keyboard.createCursorKeys(); game.camera.follow(player); @@ -39,15 +41,15 @@ function create() { function update() { - player.body.velocity.setTo(0, 0); + player.body.setZeroVelocity(); if (cursors.up.isDown) { - player.body.velocity.y = -200; + player.body.moveUp(200) } else if (cursors.down.isDown) { - player.body.velocity.y = 200; + player.body.moveDown(200); } if (cursors.left.isDown) @@ -56,7 +58,7 @@ function update() { } else if (cursors.right.isDown) { - player.body.velocity.x = 200; + player.body.moveRight(200); } } diff --git a/examples/camera/camera cull.js b/examples/camera/camera cull.js index 6060ada2..cb15113a 100644 --- a/examples/camera/camera cull.js +++ b/examples/camera/camera cull.js @@ -42,7 +42,7 @@ function update() { function render() { - game.debug.renderSpriteCorners(s, true, true); + game.debug.renderSpriteBounds(s); game.debug.renderSpriteInfo(s, 20, 32); } diff --git a/examples/display/fullscreen.js b/examples/display/fullscreen.js index d02dd75c..2ff001d7 100644 --- a/examples/display/fullscreen.js +++ b/examples/display/fullscreen.js @@ -26,7 +26,7 @@ function create() { function gofull() { - game.stage.scale.startFullScreen(); + game.scale.startFullScreen(); } 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/depth sort.js b/examples/groups/depth sort.js index 05b74511..2684b533 100644 --- a/examples/groups/depth sort.js +++ b/examples/groups/depth sort.js @@ -35,6 +35,8 @@ function create() { // The player sprite = group.create(300, 200, 'phaser'); + sprite.physicsEnabled = true; + // Some trees for (var i = 0; i < 50; i++) { 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/keyboard justpressed.js b/examples/input/keyboard justpressed.js index 8eb6321e..a4c24e32 100644 --- a/examples/input/keyboard justpressed.js +++ b/examples/input/keyboard justpressed.js @@ -19,10 +19,13 @@ function create() { bullets = game.add.group(); bullets.createMultiple(10, 'bullet'); + bullets.setAll('physicsEnabled',true); bullets.callAll('events.onOutOfBounds.add', 'events.onOutOfBounds', resetBullet, this); sprite = game.add.sprite(400, 550, 'phaser'); + sprite.physicsEnabled = true; + // Stop the following keys from propagating up to the browser game.input.keyboard.addKeyCapture([ Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.SPACEBAR ]); 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)