diff --git a/assets/NNDungeon.json b/assets/NNDungeon.json index 8daf5ac..371cd5f 100644 --- a/assets/NNDungeon.json +++ b/assets/NNDungeon.json @@ -262,13 +262,13 @@ }, { "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 109, 0, 0, 0, 0, 109, 0, 0, 0, 0, 0, + 0, 10, 0, 0, 69, 119, 0, 0, 0, 0, 119, 69, 50, 0, 10, 0, + 0, 30, 0, 60, 0, 0, 0, 0, 0, 80, 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, 0, 100, 0, 0, 0, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 80, 0, 0, + 0, 0, 60, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 30, 0, + 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 84, 0, 0, 0, 0, 90, 0, 0, 0, 83, 84, 0, 0, @@ -285,12 +285,12 @@ { "data":[0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 83, 84, 0, 0, 0, 83, 84, 0, + 0, 0, 50, 0, 0, 0, 0, 0, 93, 94, 85, 86, 87, 93, 94, 0, + 0, 10, 10, 10, 80, 0, 0, 0, 0, 2147483678, 95, 96, 97, 30, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, + 0, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, + 0, 0, 70, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 139, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 0, 50, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 0, 20, 0, 0, @@ -963,7 +963,29 @@ "draworder":"topdown", "id":4, "name":"zones", - "objects":[], + "objects":[ + { + "height":100, + "id":28, + "name":"gulchExit", + "rotation":0, + "type":"", + "visible":true, + "width":200, + "x":2300, + "y":3500 + }, + { + "height":100, + "id":29, + "name":"bossSave", + "rotation":0, + "type":"", + "visible":true, + "width":200, + "x":2300, + "y":900 + }], "opacity":1, "type":"objectgroup", "visible":true, @@ -1017,7 +1039,7 @@ "y":0 }], "nextlayerid":6, - "nextobjectid":28, + "nextobjectid":30, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.11.2", @@ -1103,8 +1125,8 @@ "properties":[ { "name":"collides", - "type":"string", - "value":"true" + "type":"bool", + "value":true }] }, { diff --git a/assets/player-tiles.png b/assets/player-tiles.png index 8181d4c..82fe640 100644 Binary files a/assets/player-tiles.png and b/assets/player-tiles.png differ diff --git a/assets/proEdgeKey.png b/assets/proEdgeKey.png new file mode 100644 index 0000000..1290320 Binary files /dev/null and b/assets/proEdgeKey.png differ diff --git a/index.html b/index.html index 7915975..c9075a8 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Legends of Coyote Gulch diff --git a/raw/NNDungeon.tmx b/raw/NNDungeon.tmx index c13f1e5..d30afed 100644 --- a/raw/NNDungeon.tmx +++ b/raw/NNDungeon.tmx @@ -1,5 +1,5 @@ - + @@ -42,7 +42,7 @@ - + @@ -576,13 +576,13 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,109,0,0,0,0,109,0,0,0,0,0, +0,10,0,0,69,119,0,0,0,0,119,69,50,0,10,0, +0,30,0,60,0,0,0,0,0,80,80,0,0,0,0,0, +0,0,0,0,10,0,0,100,0,0,0,10,0,0,0,0, +0,0,0,0,0,0,0,80,0,0,0,0,0,80,0,0, +0,0,60,0,0,0,0,0,0,70,0,0,0,0,30,0, +0,10,0,0,0,0,0,0,0,0,0,0,0,0,10,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,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0,0,0,2147483678,95,96,97,30,0,0, +0,0,0,0,0,0,0,0,70,0,0,0,0,0,0,0, +0,10,10,10,0,0,0,0,0,0,0,0,0,129,0,0, +0,0,70,0,0,80,0,0,0,0,0,0,0,139,0,0, +0,0,0,0,0,0,0,0,0,0,0,150,0,50,0,0, +0,0,0,0,0,0,0,0,0,0,0,160,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,120,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,120,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,130,0,20,0,0, @@ -862,7 +862,10 @@ - + + + + diff --git a/raw/Tile-Project-Legends.tiled-session b/raw/Tile-Project-Legends.tiled-session index e4dc453..bcb958b 100644 --- a/raw/Tile-Project-Legends.tiled-session +++ b/raw/Tile-Project-Legends.tiled-session @@ -15,14 +15,14 @@ }, "NNDungeon.tmx": { "expandedObjectLayers": [ - 3, - 5 + 5, + 3 ], "scale": 0.5, - "selectedLayer": 1, + "selectedLayer": 3, "viewCenter": { - "x": 3252, - "y": 2399 + "x": 2689, + "y": 2916 } }, "NNDungeon.tmx#99boy-tiles": { @@ -49,8 +49,8 @@ "scale": 0.5, "selectedLayer": 3, "viewCenter": { - "x": 5589, - "y": 1076 + "x": 4191, + "y": 920 } }, "gulch.tmx#99boy-tiles": { @@ -76,7 +76,7 @@ "gulch.tmx" ], "project": "Tile-Project-Legends.tiled-project", - "property.type": "int", + "property.type": "bool", "recentFiles": [ "NNDungeon.tmx", "gulch.tmx", diff --git a/raw/player-tiles.psd b/raw/player-tiles.psd index a94385c..43a9af1 100644 Binary files a/raw/player-tiles.psd and b/raw/player-tiles.psd differ diff --git a/src/globalState.js b/src/globalState.js index 0720b49..6c6e0e4 100644 --- a/src/globalState.js +++ b/src/globalState.js @@ -8,6 +8,8 @@ export class GlobalState { upgrades: [], startGulchX: 950, startGulchY: 4250, + startNNX: 2400, + startNNY: 3350, }; } @@ -86,6 +88,22 @@ export class GlobalState { this.playerData.startGulchY = value; } + set startNNX(value) { + this.playerData.startNNX = value; + } + + get startNNX() { + return this.playerData.startNNX; + } + + set startNNY(value) { + this.playerData.startNNY = value; + } + + get startNNY() { + return this.playerData.startNNY; + } + // Add safe score increment method (replaces manual score updates) addScore(amount) { if (amount < 0) throw new Error("Cannot add negative score"); diff --git a/src/main.js b/src/main.js index 1a703e9..ef2e459 100644 --- a/src/main.js +++ b/src/main.js @@ -6,9 +6,11 @@ import { GlobalState } from './globalState.js'; const config = { type: Phaser.AUTO, scale: { - mode: Phaser.Scale.EXPAND, + mode: Phaser.Scale.FIT, + autoCenter: Phaser.Scale.CENTER_BOTH, width: 1600, height: 900, + parent: 'game-container' }, physics: { default: 'arcade', @@ -18,10 +20,11 @@ const config = { } }, + backgroundColor: '#000000', scene: [ MenuScene, Gulch, - NNDungeon + NNDungeon, ] }; diff --git a/src/scenes/NNDungeon.js b/src/scenes/NNDungeon.js index 31cd363..8fd9821 100644 --- a/src/scenes/NNDungeon.js +++ b/src/scenes/NNDungeon.js @@ -20,7 +20,9 @@ export class NNDungeon extends Phaser.Scene { preload() { this.load.image('dungeon-tiles', 'assets/dungeon-tiles.png'); this.load.image('heart-full', 'assets/heart-full.png'); - this.load.image('heart-empty', 'assets/heart-empty.png'); + this.load.image('heart-empty', 'assets/heart-empty.png'); + this.load.image('heart-upgrade', 'assets/heart-upgrade.png'); + this.load.image('proEdgeKey', 'assets/proEdgeKey.png'); this.load.tilemapTiledJSON('NNDungeonMap', 'assets/NNDungeon.json'); this.load.spritesheet('player-tiles', 'assets/player-tiles.png', { frameWidth: 100, @@ -60,23 +62,31 @@ export class NNDungeon extends Phaser.Scene { .setCollisionByProperty({ collides: true }); const enemiesLayer = NNDungeonMap.getObjectLayer('enemies'); const interactiveLayer = NNDungeonMap.getObjectLayer('interactive'); - //const zoneLayer = gulchMap.getObjectLayer('zone'); + const zoneLayer = NNDungeonMap.getObjectLayer('zones'); // Show Score this.interface = new Interface(this); this.interface.showScore(); // Add a player - this.player = new Player(this, 2400, 3450); + this.player = new Player(this, this.game.globalState.startNNX, this.game.globalState.startNNY); //this.player = new Player(this, 3550, 350); this.player.healthBars(true, 1, 3); - // zoneLayer.objects.forEach(object => { - // if (object.name === '99Dungeon') { - // const NNDungeon = this.add.rectangle(object.x, object.y, object.width, object.height); - // this.NNDungeon = this.physics.add.existing(NNDungeon); - // } - // }); + // Set the exit back to the gulch + this.game.globalState.startGulchX = 5500; + this.game.globalState.startGulchY = 1600; + + zoneLayer.objects.forEach(object => { + if (object.name === 'gulchExit') { + const Gulch = this.add.rectangle(object.x, object.y, object.width, object.height); + this.Gulch = this.physics.add.existing(Gulch); + } + if (object.name === 'bossSave') { + const bossSave = this.add.rectangle(object.x, object.y, object.width, object.height); + this.bossSave = this.physics.add.existing(bossSave); + } + }); // Add Interactive this.interactive = this.physics.add.group(); @@ -100,7 +110,6 @@ export class NNDungeon extends Phaser.Scene { }); enemiesLayer.objects.forEach(object => { let a99Boy; - console.log(object.gid); if (object.gid > 300) { a99Boy = this.enemies.create(object.x-50, object.y-50, 'boss-tiles', object.gid-301); } else { @@ -165,9 +174,16 @@ export class NNDungeon extends Phaser.Scene { this.physics.add.collider(this.player, this.enemies, (player, enemy) => { player.takeDamage(); }); - // this.physics.add.collider(this.player, this.NNDungeon, (player, zone) => { - // console.log('Hit'); - // }); + this.physics.add.collider(this.player, this.Gulch, (player, zone) => { + this.game.globalState.startNNX = 2400; + this.game.globalState.startNNY = 3350; + this.bgMusic.stop(); + this.scene.start('Gulch'); + }); + this.physics.add.collider(this.player, this.bossSave, (player, zone) => { + this.game.globalState.startNNX = 2350; + this.game.globalState.startNNY = 550; + }); function touchInteractive(player, interactive) { interactive.properties.forEach(prop => { @@ -213,6 +229,67 @@ export class NNDungeon extends Phaser.Scene { heart.destroy(); }); + // Add level heart upgrade + if (this.game.globalState.hasInventory('99-heart') === 0) { + this.upgrade = this.physics.add.image(5600, 500, 'heart-upgrade').setScale(0.2); + this.physics.add.collider(this.player, this.upgrade, (player, upgrade) => { + this.game.globalState.addToInventory('99-heart', 1); + this.player.maxHearts ++; + this.player.numHearts ++; + this.game.globalState.maxHearts = this.player.maxHearts; + this.game.globalState.hearts = this.player.numHearts; + this.player.updateHealth(); + upgrade.destroy(); + }); + } + + // Add Fat Hawk + if (this.game.globalState.hasInventory('fatHawk') === 0) { + this.tiedHawk = this.physics.add.sprite(5950, 300, 'player-tiles', 51); + this.fatHawk = this.physics.add.collider(this.player, this.tiedHawk, (player, upgrade) => { + this.fatHawk.destroy(); + this.anims.create({ + key: 'fatFly', + frames: this.anims.generateFrameNumbers('player-tiles', { start: 48, end: 50 }), + frameRate: 5, + repeat: -1 + }); + this.tiedHawk.setFrame(48); + this.tiedHawk.anims.play('fatFly'); + // Animate the tiedHawk to move to position (5150, 500) + this.tweens.add({ + targets: this.tiedHawk, + x: 6150, + y: 500, + duration: 3000, + ease: 'Linear', + onComplete: () => { + this.tiedHawk.anims.stop(); + this.tiedHawk.setVelocity(0, 0); + this.proEdgeKey = this. physics.add.image(6150, 500, 'proEdgeKey').setScale(.1); + this.tweens.add({ + targets: this.proEdgeKey, + x: 5950, + y: 650, + duration: 1500, + ease: 'Bounce' + }); + this.keyCollider = this.physics.add.collider(this.player, this.proEdgeKey, (player, key) => { + this.keyCollider.destroy(); + this.proEdgeKey.destroy(); + this.game.globalState.addToInventory('fatHawk', 1); + this.game.globalState.addToInventory('proEdgeKey', 1); + this.cameras.main.fade(1500, 0, 0, 0, true); + this.time.delayedCall(1500, () => { + this.bgMusic.stop(); + this.scene.start('Gulch'); + }); + }); + } + }); + }); + } + //this.cameras.main.setScroll(800, 1100); this.cameras.main.setBounds(1600, 2700, 1600, 900);