From 260480f5b61e2745d542673638efb5d194a10ff4 Mon Sep 17 00:00:00 2001 From: Michael Stanton Date: Sat, 22 Nov 2014 12:27:16 +0100 Subject: [PATCH] Can't exit level unless all coins are collected. --- .../boilerplate-master/data/map/area01.tmx | 4 +-- .../boilerplate-master/js/entities/HUD.js | 15 ++++++--- .../js/entities/entities.js | 2 +- .../boilerplate-master/js/game.js | 31 +++++++++++++++++++ 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/melonjs-tutorial/boilerplate-master/data/map/area01.tmx b/melonjs-tutorial/boilerplate-master/data/map/area01.tmx index 1d1e48e..ef82c20 100644 --- a/melonjs-tutorial/boilerplate-master/data/map/area01.tmx +++ b/melonjs-tutorial/boilerplate-master/data/map/area01.tmx @@ -30,7 +30,7 @@ - CAAAAAgAAAAAAAAAAAAAACkAAAAtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAIAAAABgAAACkAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAACAAAAAgAAAAIAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAACAAAAAgAAAAIAAAABgAAAAYAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAApAAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAABg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AAAAAAAAAAAAAAAAACNAAAAjQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAAjQAAAI0AAACNAAAA diff --git a/melonjs-tutorial/boilerplate-master/js/entities/HUD.js b/melonjs-tutorial/boilerplate-master/js/entities/HUD.js index 74a9063..222872f 100755 --- a/melonjs-tutorial/boilerplate-master/js/entities/HUD.js +++ b/melonjs-tutorial/boilerplate-master/js/entities/HUD.js @@ -23,8 +23,8 @@ game.HUD.Container = me.Container.extend({ // give a name this.name = "HUD"; - // add our child score object at the top left corner - this.addChild(new game.HUD.ScoreItem(430, 440)); + // add our child score object at the lower right corner + this.addChild(new game.HUD.ScoreItem(230, 440)); } }); @@ -51,6 +51,8 @@ game.HUD.ScoreItem = me.Renderable.extend({ // local copy of the lives this.lives = -1; + this.coinsNotCollected = -1; + // make sure we use screen coordinates this.floating = true; }, @@ -62,9 +64,11 @@ game.HUD.ScoreItem = me.Renderable.extend({ // we don't do anything fancy here, so just // return true if the score has been updated if (this.score !== game.data.score || - this.lives !== game.data.lives) { + this.lives !== game.data.lives || + this.coinsNotCollected != game.data.coinsNotCollected) { this.score = game.data.score; this.lives = game.data.lives; + this.coinsNotCollected = game.data.coinsNotCollected; return true; } return false; @@ -74,8 +78,9 @@ game.HUD.ScoreItem = me.Renderable.extend({ * draw the score */ draw : function (context) { - this.font.draw(context, game.data.score, this.pos.x + 200, this.pos.y); - this.font.draw(context, game.data.lives, this.pos.x, this.pos.y); + this.font.draw(context, game.data.coinsNotCollected, this.pos.x, this.pos.y); + this.font.draw(context, game.data.score, this.pos.x + 400, this.pos.y); + this.font.draw(context, game.data.lives, this.pos.x + 200, this.pos.y); } }); diff --git a/melonjs-tutorial/boilerplate-master/js/entities/entities.js b/melonjs-tutorial/boilerplate-master/js/entities/entities.js index f69c5f6..2c4e6b4 100755 --- a/melonjs-tutorial/boilerplate-master/js/entities/entities.js +++ b/melonjs-tutorial/boilerplate-master/js/entities/entities.js @@ -76,7 +76,6 @@ game.PlayerEntity = me.Entity.extend({ this.die(); } } else if (response.b.body.collisionType == me.collision.types.ACTION_OBJECT) { - // b is a LevelEntity. Indicate our new respawn point. game.data.current_level = response.b.nextlevel; } }, @@ -106,6 +105,7 @@ game.CoinEntity = me.CollectableEntity.extend({ onCollision: function() { game.data.score += 3; + game.data.coinsNotCollected--; me.audio.play("cling"); diff --git a/melonjs-tutorial/boilerplate-master/js/game.js b/melonjs-tutorial/boilerplate-master/js/game.js index 0358a77..9c1fa2a 100755 --- a/melonjs-tutorial/boilerplate-master/js/game.js +++ b/melonjs-tutorial/boilerplate-master/js/game.js @@ -8,6 +8,8 @@ var game = { score : 0, // number of lives lives : 3, + // This is programmatically determined on level loads. + coinsNotCollected : 0, // current level current_level: "area03", // reset function @@ -15,6 +17,7 @@ var game = { this.score = 0; this.lives = 3; this.current_level = "area01"; + this.coinsNotCollected = 0; } }, @@ -40,6 +43,14 @@ var game = { // Set a callback to run when loading is complete. me.loader.onload = this.loaded.bind(this); + // Set a callback for level loads too. + me.game.onLevelLoaded = this.levelLoaded.bind(this); + + // We need to prevent level collisions if you don't have enough + // coins. + this.oldShouldCollide = me.collision.shouldCollide; + me.collision.shouldCollide = this.shouldCollide.bind(this); + // Load the resources. me.loader.preload(game.resources); @@ -65,5 +76,25 @@ var game = { // Start the game. me.state.change(me.state.MENU); + }, + + "levelLoaded" : function(levelName) { + // Discover the number of coins that need to be collected to successfully + // exit the level. + var coins = me.game.world.getChildByName("CoinEntity"); + game.data.coinsNotCollected = coins.length; + }, + + "shouldCollide" : function(a, b) { + var answer = this.oldShouldCollide(a, b); + if (answer === true) { + // Do additional checks + if (a.name === "mainplayer" && b.name == "me.levelentity") { + if (game.data.coinsNotCollected > 0) { + return false; + } + } + } + return answer; } };