Permalink
Browse files

Added parallax rate for the mid plane and fixed the player bounding.

  • Loading branch information...
1 parent 6e6a8cb commit e1f85a06c91fb15293199cbb0a6e586b90a1e055 @jasonfield jasonfield committed Feb 11, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 js/game.js
View
@@ -79,7 +79,7 @@ function DrawParallaxBackground(ctx) {
ctx.drawImage(assets.backgroundFar, -backgroundPos, 0);
ctx.drawImage(assets.backgroundFar, -backgroundPos + assets.backgroundFar.width, 0);
- middlePos = cameraPosition % assets.backgroundMid.width;
+ middlePos = cameraPosition * 1.3 % assets.backgroundMid.width;
ctx.drawImage(assets.backgroundMid, -middlePos, 408);
ctx.drawImage(assets.backgroundMid, -middlePos + assets.backgroundMid.width, 408);
}
@@ -92,7 +92,7 @@ function DrawParallaxForeground(ctx) {
}
function DrawPlayer(ctx) {
- ctx.drawImage(assets.character, playerX, playerY);
+ ctx.drawImage(assets.character, playerX - cameraPosition, playerY);
}
function DrawEnemies(ctx) {

0 comments on commit e1f85a0

Please sign in to comment.