Close #11 : Guards catching you will trigger the end game screen

This commit is contained in:
2014-07-12 23:33:24 -07:00
parent 6d5c49a370
commit 1ded2f42e5
4 changed files with 41 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -524,6 +524,11 @@ var AISprite = function(game, x, y, key, frame) {
this.action_chaseplayer = function() this.action_chaseplayer = function()
{ {
if ( game.physics.arcade.overlap(this, player) ) {
game.state.start('endscreen');
return;
}
if ( this.path.length > 0 && if ( this.path.length > 0 &&
this.path_index >= this.path.length && this.path_index >= this.path.length &&
hasState(this, STATE_RUNNINGTOREPORT) ) { hasState(this, STATE_RUNNINGTOREPORT) ) {
@@ -761,8 +766,6 @@ var AISprite = function(game, x, y, key, frame) {
{ {
if ( this.ready_to_update == false ) if ( this.ready_to_update == false )
return; return;
// if ( hasState(this, STATE_CONVERSING) == true && game.tweens.isTweening(this) )
// throw "WHY THE FUCK AM I STILL TWEENING";
if ( isSet(this.awareness_effect) ) { if ( isSet(this.awareness_effect) ) {
if ( this.awareness_effect.alive == false ) { if ( this.awareness_effect.alive == false ) {

View File

@@ -466,6 +466,34 @@ GameState.prototype.update = function()
this.scoreText.setText("" + player.score); this.scoreText.setText("" + player.score);
} }
GameState.prototype.shutdown = function()
{
this.aiSprites.setAll('ready_to_update', false);
this.aiSprites.destroy();
this.aiSprites = null;
this.uigroup.destroy();
this.uigroup = null;
this.recentlyStolenGroup.destroy();
this.clock = null;
this.clockTimer.stop();
this.bubble_group.destroy();
this.effectSprites.destroy();
this.shadowTextureColor = null;
this.staticSounds.forEach(function(x) {
x.sound.stop();
game.sound.remove(x);
}, this);
this.map_collision_layers.forEach(function(x) {
x.destroy();
}, this);
this.map.destroy();
pathfinder_grid = null;
pathfinder = null;
this.shadowSprite.destroy();
this.staticLights.destroy();
this.staticSounds.destroy();
}
var Boot = function(game) { var Boot = function(game) {
} }
@@ -565,7 +593,8 @@ var EndScreen = function(game) {
EndScreen.prototype.create = function() EndScreen.prototype.create = function()
{ {
this.scoreText = this.game.add.text( this.gameOverText = game.add.image((640/2),
320, 240, 'GAME OVER', (480/2),
{ font: '32px Arial', fill: '#ffffff' }); 'gameover');
this.gameOverText.anchor.setTo(0.5, 0.5);
} }

View File

@@ -147,6 +147,10 @@ var moonlightSettings = {
} }
], ],
'images': [ 'images': [
{
'name': 'gameover',
'path': 'gfx/ui/gameover.png'
},
{ {
'name': 'hud', 'name': 'hud',
'path': 'gfx/ui/hud.png' 'path': 'gfx/ui/hud.png'