From 7342ce603a271abfe5ded4078f93cb39fc99b0f9 Mon Sep 17 00:00:00 2001 From: alvinsight Date: Fri, 21 Feb 2014 15:53:07 +0000 Subject: [PATCH] Velocity is back on track :) --- examples/basics/03 - move an image.js | 4 +++- examples/camera/basic follow.js | 10 ++++++---- examples/camera/camera cull.js | 3 +-- examples/display/fullscreen.js | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) 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..6d4b9c5d 100644 --- a/examples/camera/camera cull.js +++ b/examples/camera/camera cull.js @@ -42,7 +42,6 @@ function update() { function render() { - game.debug.renderSpriteCorners(s, true, true); - game.debug.renderSpriteInfo(s, 20, 32); + game.debug.renderSpriteBounds(s); } 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(); }