Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

nope

  • Loading branch information...
commit 67e1f1ed22b66d764eac60d5533974a0224cb5a6 1 parent e701047
unknown authored
Showing with 20 additions and 1 deletion.
  1. +14 −0 hugs.js
  2. +6 −1 jsGame/jsGame.Text.js
View
14 hugs.js
@@ -21,6 +21,13 @@ function initialize(){
var won = false;
var lost = false;
var gameOverBg;
+ var timerText = jsGame.Text(360,595);
+ timerText.layer = 6;
+ timerText.color = "rgb(255,255,255)";
+ timerText.text = "";
+ timerText.shadow = true;
+ timerText.font = "30pt arial bold";
+ game.add(timerText);
// SFX
var deathcry = jsGame.Sound.load('./assets/deathcry.mp3');
@@ -473,6 +480,8 @@ function initialize(){
if (candidate.state === 'dead')
game.numEnemiesAlive--;
}
+
+ timerText.text = Math.max(0,Math.floor(game.levelTimeLimit - game.timer));
if(gameOverBg)
{
gameOverBg.fade += game.elapsed * 0.25;
@@ -570,6 +579,8 @@ function initialize(){
if(won)
{
enemy.fuzzies = Math.min(enemy.fuzzies + 5, 100);
+ enemy.targetX = player.x;
+ enemy.targetY = player.y;
}
else
{
@@ -654,6 +665,9 @@ function initialize(){
if(dx*dx+dy*dy <= 35*35 && enemy.attackTimer <= 0){
enemy.fightTarget.health -= 10;
enemy.fuzzies -= 5;
+
+
+
//alert(enemy.fightTarget.health);
enemy.attackTimer = 1.5;
if(Math.random() > 0.5)
View
7 jsGame/jsGame.Text.js
@@ -3,10 +3,15 @@ jsGame.Text = jsGame.extend(jsGame.Sprite, function(self){
self.text = "";
self.font = "";
- self.color = ""
+ self.color = "";
+ self.shadow = false;
self.render = function(context, camera){
context.font = self.font;
+ context.fillStyle = "rgb(0,0,0)";
+ context.fillText(self.text,
+ self.x - camera.scroll.x * self.parallax.x + 1,
+ self.y - camera.scroll.y * self.parallax.y + 2);
context.fillStyle = self.color;
context.fillText(self.text,
self.x - camera.scroll.x * self.parallax.x,
Please sign in to comment.
Something went wrong with that request. Please try again.