diff --git a/js/monster.js b/js/monster.js index 1c43166..75b07fd 100644 --- a/js/monster.js +++ b/js/monster.js @@ -6,7 +6,7 @@ var Sprite = require('./Sprite'); var super_draw = that.superior('draw'); var spriteVersion = 1; var eatingStage = 0; - var standardSpeed = 4; + var standardSpeed = 6; that.isEating = false; that.isFull = false; diff --git a/js/skier.js b/js/skier.js index 5f8801b..e8043fb 100644 --- a/js/skier.js +++ b/js/skier.js @@ -127,7 +127,7 @@ var Sprite = require('./Sprite'); return false; } - if (!obs.occupiesZIndex(that.canvasZ)) { + if (!obs.occupiesZIndex(that.mapPosition[2])) { return false; } @@ -175,15 +175,13 @@ var Sprite = require('./Sprite'); that.isMoving = true; that.hasBeenHit = false; that.isJumping = true; - that.canvasZ = 1; - // that.incrementSpeedBy(1); + that.setMapPosition(undefined, undefined, 1); if (cancelableStateTimeout) { clearTimeout(cancelableStateTimeout); } cancelableStateTimeout = setTimeout(function() { - that.canvasZ = 0; + that.setMapPosition(undefined, undefined, 0); that.isJumping = false; - // that.incrementSpeedBy(-1); }, 1000); }; diff --git a/js/sprite.js b/js/sprite.js index 73dd151..ed4fe02 100644 --- a/js/sprite.js +++ b/js/sprite.js @@ -102,6 +102,12 @@ }; this.setMapPosition = function (x, y, z) { + if (typeof x === 'undefined') { + x = that.mapPosition[0]; + } + if (typeof y === 'undefined') { + y = that.mapPosition[1]; + } if (typeof z === 'undefined') { z = that.mapPosition[2]; } @@ -291,22 +297,22 @@ var horizontalIntersect = false; // Test that THIS has a bottom edge inside of the other object - if (other.getTopHitBoxEdge(that.canvasZ) <= that.getBottomHitBoxEdge(that.canvasZ) && other.getBottomHitBoxEdge(that.canvasZ) >= that.getBottomHitBoxEdge(that.canvasZ)) { + if (other.getTopHitBoxEdge(that.mapPosition[2]) <= that.getBottomHitBoxEdge(that.mapPosition[2]) && other.getBottomHitBoxEdge(that.mapPosition[2]) >= that.getBottomHitBoxEdge(that.mapPosition[2])) { verticalIntersect = true; } // Test that THIS has a top edge inside of the other object - if (other.getTopHitBoxEdge(that.canvasZ) <= that.getTopHitBoxEdge(that.canvasZ) && other.getBottomHitBoxEdge(that.canvasZ) >= that.getTopHitBoxEdge(that.canvasZ)) { + if (other.getTopHitBoxEdge(that.mapPosition[2]) <= that.getTopHitBoxEdge(that.mapPosition[2]) && other.getBottomHitBoxEdge(that.mapPosition[2]) >= that.getTopHitBoxEdge(that.mapPosition[2])) { verticalIntersect = true; } // Test that THIS has a right edge inside of the other object - if (other.getLeftHitBoxEdge(that.canvasZ) <= that.getRightHitBoxEdge(that.canvasZ) && other.getRightHitBoxEdge(that.canvasZ) >= that.getRightHitBoxEdge(that.canvasZ)) { + if (other.getLeftHitBoxEdge(that.mapPosition[2]) <= that.getRightHitBoxEdge(that.mapPosition[2]) && other.getRightHitBoxEdge(that.mapPosition[2]) >= that.getRightHitBoxEdge(that.mapPosition[2])) { horizontalIntersect = true; } // Test that THIS has a left edge inside of the other object - if (other.getLeftHitBoxEdge(that.canvasZ) <= that.getLeftHitBoxEdge(that.canvasZ) && other.getRightHitBoxEdge(that.canvasZ) >= that.getLeftHitBoxEdge(that.canvasZ)) { + if (other.getLeftHitBoxEdge(that.mapPosition[2]) <= that.getLeftHitBoxEdge(that.mapPosition[2]) && other.getRightHitBoxEdge(that.mapPosition[2]) >= that.getLeftHitBoxEdge(that.mapPosition[2])) { horizontalIntersect = true; }