Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[*] Game over notice was added.

  • Loading branch information...
commit 3ba7406cfbcdb6b6ceb5a78d7107de14c4bb7234 1 parent 6105c4b
@Andrew8xx8 authored
Showing with 19 additions and 0 deletions.
  1. +18 −0 js/controller.js
  2. +1 −0  js/player.js
View
18 js/controller.js
@@ -58,6 +58,24 @@ TextGalactic.Controller = atom.Class(
}));
},
+ gameOver: function () {
+ var ctx = this.ctx;
+
+ ctx.fillStyle = "#fff";
+ ctx.font = "normal normal " + (TextGalactic.Settings.font_size + 15) + "px courier";
+ ctx.fillText(
+ "Game over",
+ Math.round(this.activeScene.resources.rectangle.to.x / 2) - 110,
+ Math.round(this.activeScene.resources.rectangle.to.y / 2)
+ );
+ ctx.font = "normal normal " + (TextGalactic.Settings.font_size) + "px courier";
+ ctx.fillText(
+ "You score: " + this.score,
+ Math.round(this.activeScene.resources.rectangle.to.x / 2) - 100,
+ Math.round(this.activeScene.resources.rectangle.to.y / 2) + (TextGalactic.Settings.font_size + 15)
+ );
+ },
+
drawScore: function () {
var ctx = this.ctx;
ctx.fillStyle = "#000";
View
1  js/player.js
@@ -42,6 +42,7 @@ TextGalactic.Player = atom.Class(
if (this.health < 0) {
this.destroy();
+ this.options.controller.gameOver();
}
return this;
Please sign in to comment.
Something went wrong with that request. Please try again.