diff --git a/data/images/gfx64/tiles.png b/data/images/gfx64/tiles.png index 33e307f..11ac63a 100644 Binary files a/data/images/gfx64/tiles.png and b/data/images/gfx64/tiles.png differ diff --git a/js/app/game-state.js b/js/app/game-state.js index a70fea8..39aa7b2 100644 --- a/js/app/game-state.js +++ b/js/app/game-state.js @@ -49,6 +49,11 @@ state.create = function() { // Sky layer this.addChild(this.tilemap.layers[2]); + + this.backButton = new Kiwi.GameObjects.Sprite(this, this.textures.base, 0, 0); + this.backButton.cellIndex = 24; + this.backButton.input.onUp.add(this.backButtonReleased, this); + this.addChild(this.backButton); // Create collision layer for(var i = 21; i < this.tilemap.tileTypes.length; i++) { @@ -67,6 +72,14 @@ state.create = function() { this.character.input.onUp.add( this.buttonReleased, this ); } +state.backButtonReleased = function(sprite, mouse) { + if ((mouse.x > 48) && (mouse.y > 48)) { + return; + } + this.stageState == 'none' + game.states.switchState('levelSelector'); +} + state.buttonReleased = function(sprite) { if (this.stageState == 'init') { this.activateScene(); @@ -294,7 +307,6 @@ state.checkCollision = function () { if ((this.character.physics.velocity.x == 0) && (this.character.physics.velocity.y == 0)) { if (this.stageState == 'running') { this.stageState = 'stop'; - this.myButton.text = 'Restart' } return; }