diff --git a/moonlight/gfx/ui/gameover.png b/moonlight/gfx/ui/gameover.png new file mode 100644 index 0000000..a339b6a Binary files /dev/null and b/moonlight/gfx/ui/gameover.png differ diff --git a/moonlight/src/AISprite.js b/moonlight/src/AISprite.js index cfa6871..d375f51 100644 --- a/moonlight/src/AISprite.js +++ b/moonlight/src/AISprite.js @@ -524,6 +524,11 @@ var AISprite = function(game, x, y, key, frame) { this.action_chaseplayer = function() { + if ( game.physics.arcade.overlap(this, player) ) { + game.state.start('endscreen'); + return; + } + if ( this.path.length > 0 && this.path_index >= this.path.length && hasState(this, STATE_RUNNINGTOREPORT) ) { @@ -761,8 +766,6 @@ var AISprite = function(game, x, y, key, frame) { { if ( this.ready_to_update == false ) 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 ( this.awareness_effect.alive == false ) { diff --git a/moonlight/src/GameStates.js b/moonlight/src/GameStates.js index 222f404..cd9d581 100644 --- a/moonlight/src/GameStates.js +++ b/moonlight/src/GameStates.js @@ -466,6 +466,34 @@ GameState.prototype.update = function() 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) { } @@ -565,7 +593,8 @@ var EndScreen = function(game) { EndScreen.prototype.create = function() { - this.scoreText = this.game.add.text( - 320, 240, 'GAME OVER', - { font: '32px Arial', fill: '#ffffff' }); + this.gameOverText = game.add.image((640/2), + (480/2), + 'gameover'); + this.gameOverText.anchor.setTo(0.5, 0.5); } diff --git a/moonlight/src/Settings.js b/moonlight/src/Settings.js index 01ce69f..28f1cf7 100644 --- a/moonlight/src/Settings.js +++ b/moonlight/src/Settings.js @@ -147,6 +147,10 @@ var moonlightSettings = { } ], 'images': [ + { + 'name': 'gameover', + 'path': 'gfx/ui/gameover.png' + }, { 'name': 'hud', 'path': 'gfx/ui/hud.png'