===================================================================
--- original.js
+++ change.js
@@ -14,16 +14,12 @@
self.velocity = 0;
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
- if (self.y > 2732 - birdGraphics.height / 2) {
- self.y = 2732 - birdGraphics.height / 2;
- self.velocity = 0;
+ if (self.y > 2732 - birdGraphics.height / 2 || self.y < birdGraphics.height / 2) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
- if (self.y < birdGraphics.height / 2) {
- self.y = birdGraphics.height / 2;
- self.velocity = 0;
- }
};
self.flap = function () {
self.velocity = self.lift;
};
@@ -120,8 +116,12 @@
rod.y = 2732;
game.addChild(rod);
}
bird.update();
+ if (bird.y > 2732 - bird.height / 2 || bird.y < bird.height / 2) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].update();
if (bird.intersects(obstacles[i])) {
LK.effects.flashScreen(0xff0000, 1000);