Skip to content

Commit

Permalink
Add the moveClone function
Browse files Browse the repository at this point in the history
This places the next clone, in a two man cycle, right under the player to
make it look like the player is jumping off the clone.
  • Loading branch information
sourrust committed Nov 30, 2012
1 parent 4479a84 commit 9087cb2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/components/box2dTwoway.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,16 @@ function(Crafty, b2) {

return movement;
};

moveClone = function(clone, x, y) {
clone.visible = false;

// Needs to be divided by 32 because box2d used 32 as its pixels per
// meter and forces/movement is measured that way in the world.
x /= 32;
y /= 32;

clone.body.SetPosition(new b2.Vec2(x, y + (20 / 32)));
clone.visible = true;
};
});

0 comments on commit 9087cb2

Please sign in to comment.