Skip to content

Commit 7342ce6

Browse files
committed
Velocity is back on track :)
1 parent fb5920f commit 7342ce6

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ function update() {
4242

4343
function render() {
4444

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

4847
}

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

0 commit comments

Comments
 (0)