Update NNDungeon with new boss tiles, enemy configurations, and player data adjustments

- Added boss-tiles sprite sheet with 200x200 dimensions
- Updated enemy object configurations with new GID ranges and properties
- Modified player initialization and health/score tracking
- Adjusted enemy behavior for boss encounters
- Updated tilemap and JSON files with new tileset definitions and object properties
- Fixed various position and size parameters for objects in the dungeon
This commit is contained in:
Brian Fertig 2025-07-29 21:16:38 -06:00
parent 6507bda4d1
commit 1a7ed865c8
10 changed files with 407 additions and 130 deletions

View File

@ -260,6 +260,50 @@
"x":0,
"y":0
},
{
"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, 0, 0, 0, 0, 0, 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,
0, 50, 93, 94, 10, 0, 20, 0, 0, 20, 30, 10, 93, 94, 50, 0,
0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 40, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0,
0, 88, 89, 0, 0, 0, 0, 0, 0, 0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data":[0, 0, 0, 0, 0, 139, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0,
@ -751,39 +817,6 @@
"x":1300,
"y":3000
},
{
"gid":241,
"height":100,
"id":21,
"name":"",
"properties":[
{
"name":"NNBoss",
"type":"bool",
"value":true
},
{
"name":"garbage",
"type":"bool",
"value":true
},
{
"name":"health",
"type":"int",
"value":3
},
{
"name":"patrolY",
"type":"int",
"value":350
}],
"rotation":0,
"type":"",
"visible":true,
"width":100,
"x":6050.49833041819,
"y":346.500238511687
},
{
"gid":301,
"height":200,
@ -814,8 +847,111 @@
"type":"",
"visible":true,
"width":200,
"x":4400,
"y":400
"x":4300,
"y":300
},
{
"gid":217,
"height":100,
"id":23,
"name":"",
"properties":[
{
"name":"fastShot",
"type":"bool",
"value":true
},
{
"name":"garbage",
"type":"bool",
"value":true
},
{
"name":"patrolX",
"type":"int",
"value":-1000
},
{
"name":"speed",
"type":"int",
"value":75
}],
"rotation":0,
"type":"",
"visible":true,
"width":100,
"x":5700,
"y":1200
},
{
"gid":213,
"height":100,
"id":24,
"name":"",
"properties":[
{
"name":"fire",
"type":"int",
"value":300
},
{
"name":"patrolY",
"type":"int",
"value":-400
}],
"rotation":0,
"type":"",
"visible":true,
"width":100,
"x":6200,
"y":1300
},
{
"gid":201,
"height":100,
"id":25,
"name":"",
"properties":[
{
"name":"fire",
"type":"int",
"value":800
},
{
"name":"patrolX",
"type":"int",
"value":-700
}],
"rotation":0,
"type":"",
"visible":true,
"width":100,
"x":4100,
"y":1600
},
{
"gid":213,
"height":100,
"id":26,
"name":"",
"properties":[
{
"name":"fire",
"type":"int",
"value":500
},
{
"name":"patrolY",
"type":"int",
"value":300
}],
"rotation":0,
"type":"",
"visible":true,
"width":100,
"x":3500,
"y":1300
}],
"opacity":1,
"type":"objectgroup",
@ -881,7 +1017,7 @@
"y":0
}],
"nextlayerid":6,
"nextobjectid":23,
"nextobjectid":28,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.11.2",

BIN
assets/heart-upgrade.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 KiB

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="9" tilewidth="100" tileheight="100" infinite="1" nextlayerid="6" nextobjectid="22">
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="9" tilewidth="100" tileheight="100" infinite="1" nextlayerid="6" nextobjectid="28">
<editorsettings>
<export target="../assets/NNDungeon.json" format="json"/>
</editorsettings>
@ -367,6 +367,9 @@
<tileset firstgid="201" name="99boy-tiles" tilewidth="100" tileheight="100" tilecount="100" columns="10">
<image source="../assets/99boy-tiles.png" width="1000" height="1000"/>
</tileset>
<tileset firstgid="301" name="boss-tiles" tilewidth="200" tileheight="200" tilecount="25" columns="5">
<image source="../assets/boss-tiles.png" width="1000" height="1000"/>
</tileset>
<layer id="1" name="main" width="16" height="9">
<data encoding="csv">
<chunk x="0" y="0" width="16" height="16">
@ -570,6 +573,42 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="16" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,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,
0,50,93,94,10,0,20,0,0,20,30,10,93,94,50,0,
0,0,0,0,0,0,0,79,0,0,0,0,40,0,0,0,
0,0,0,0,0,0,0,0,0,100,0,0,0,0,0,0,
0,0,0,0,0,0,0,90,0,0,0,0,0,0,0,0,
0,88,89,0,0,0,0,0,0,0,0,0,0,40,0,0
</chunk>
<chunk x="32" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,69,0,69,0,10,0,0,10,0,69,0,69,0,0,
0,69,0,0,0,109,0,0,0,0,0,0,0,0,69,0,
0,0,0,0,0,119,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,0,
0,69,0,0,0,0,0,0,0,0,119,0,0,0,69,0
</chunk>
<chunk x="48" y="0" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -608,7 +647,7 @@
0,10,0,10,88,89,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="16" y="16" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,98,99,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,81,82,0,0,0,0,0,0,0,
@ -624,6 +663,24 @@
0,0,0,0,0,0,10,80,0,10,0,0,0,0,0,0,
0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,100,0,0,0
</chunk>
<chunk x="32" y="16" width="16" height="16">
0,0,69,0,69,0,10,0,0,10,0,69,0,69,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="48" y="16" width="16" height="16">
0,0,0,0,0,139,0,0,0,0,0,0,0,160,0,0,
@ -770,12 +827,38 @@
<property name="speed" type="int" value="350"/>
</properties>
</object>
<object id="21" gid="241" x="4500" y="300" width="100" height="100">
<object id="22" gid="301" x="4300" y="300" width="200" height="200">
<properties>
<property name="NNBoss" type="bool" value="true"/>
<property name="garbage" type="bool" value="true"/>
<property name="health" type="int" value="3"/>
<property name="patrolY" type="int" value="350"/>
<property name="patrolY" type="int" value="400"/>
</properties>
</object>
<object id="23" gid="217" x="5700" y="1200" width="100" height="100">
<properties>
<property name="fastShot" type="bool" value="true"/>
<property name="garbage" type="bool" value="true"/>
<property name="patrolX" type="int" value="-1000"/>
<property name="speed" type="int" value="75"/>
</properties>
</object>
<object id="24" gid="213" x="6200" y="1300" width="100" height="100">
<properties>
<property name="fire" type="int" value="300"/>
<property name="patrolY" type="int" value="-400"/>
</properties>
</object>
<object id="25" gid="201" x="4100" y="1600" width="100" height="100">
<properties>
<property name="fire" type="int" value="800"/>
<property name="patrolX" type="int" value="-700"/>
</properties>
</object>
<object id="26" gid="213" x="3500" y="1300" width="100" height="100">
<properties>
<property name="fire" type="int" value="500"/>
<property name="patrolY" type="int" value="300"/>
</properties>
</object>
</objectgroup>

View File

@ -7,6 +7,7 @@
"expandedProjectPaths": [
"."
],
"file.lastUsedOpenFilter": "All Files (*)",
"fileStates": {
"": {
"scaleInDock": 1,
@ -14,19 +15,22 @@
},
"NNDungeon.tmx": {
"expandedObjectLayers": [
5,
3
3,
5
],
"scale": 0.33,
"selectedLayer": 0,
"scale": 0.5,
"selectedLayer": 1,
"viewCenter": {
"x": 3200,
"y": 2401.5151515151515
"x": 2369,
"y": 1644
}
},
"NNDungeon.tmx#99boy-tiles": {
"scaleInDock": 1
},
"NNDungeon.tmx#boss-tiles": {
"scaleInDock": 1
},
"NNDungeon.tmx#dungeon-tiles": {
"scaleInDock": 0.33
},
@ -42,11 +46,11 @@
"scaleInDock": 1
},
"gulch.tmx": {
"scale": 0.125,
"selectedLayer": 0,
"scale": 0.5,
"selectedLayer": 3,
"viewCenter": {
"x": 3480,
"y": 2396
"x": 5589,
"y": 1076
}
},
"gulch.tmx#99boy-tiles": {
@ -68,20 +72,19 @@
"map.tileWidth": 100,
"map.width": 16,
"openFiles": [
"gulch.tmx",
"NNDungeon.tmx",
"gluch.tmx"
],
"project": "Tile-Project-Legends.tiled-project",
"property.type": "bool",
"recentFiles": [
"gluch.tmx",
"NNDungeon.tmx",
"gulch.tmx"
],
"project": "Tile-Project-Legends.tiled-project",
"property.type": "int",
"recentFiles": [
"NNDungeon.tmx",
"gulch.tmx",
"gluch.tmx"
],
"tileset.embedInMap": true,
"tileset.tileSize": {
"height": 100,
"width": 100
"height": 200,
"width": 200
}
}

View File

@ -27,11 +27,13 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
this.garbage = false;
this.onPause = false;
this.health = 1;
this.takingDamage = false;
this.boss = false;
// Create animations
this.anims.create({
key: 'walk99',
frames: this.anims.generateFrameNumbers('99boy-tiles', { start: frame, end: frame+1 }),
frames: this.anims.generateFrameNumbers(texture, { start: frame, end: frame+1 }),
frameRate: 5,
repeat: -1
});
@ -101,7 +103,60 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
// Example: Enemy taking damage
takeDamage() {
if (this.takingDamage === true) {
return;
}
this.takingDamage = true;
// Set takingDamage back to false after 2000ms
this.scene.time.delayedCall(500, () => {
this.takingDamage = false;
});
if (this.health === 1) {
if (this.boss === true) {
//BOSS DEFEAT
this.shoots = false;
this.garbage = false;
this.onPatrol = false;
this.anims.stop('walk99');
this.onPause = true;
this.setTexture('boss-tiles', 2);
this.scene.tweens.add({
targets: this,
scale: 1.5,
ease: 'Power1',
yoyo: true,
repeat: 2,
duration: 200,
onComplete: () => {
this.setTexture('boss-tiles', 3);
this.scene.tweens.add({
targets: this,
ease: 'Power1',
scale: 1.1,
duration: 200,
onComplete: () => {
this.setTexture('boss-tiles', 4);
this.scene.tweens.add({
targets: this,
ease: 'Power1',
scale: 0,
duration: 2000,
delay: 2000,
onComplete: () => {
this.destroy();
}
});
}
});
}
});
} else {
this.scene.game.playerData.score += 1;
//REGULAR ENEMY DEFEAT
let dropHeart = Math.floor(Math.random() * this.dropHeartOneIn);
if (dropHeart === 1) {
let heart = this.scene.physics.add.image(this.x, this.y, 'heart-full').setScale(.5);
@ -128,6 +183,7 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
this.destroy();
}
});
}
} else {
this.body.setVelocity(0, 0);
this.health --;
@ -141,6 +197,10 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
this.speed += 200;
this.bottleReloadVariance = 1000;
}
if (this.boss === true) {
this.anims.stop('walk99');
this.setTexture('boss-tiles', 2);
}
}
}
@ -231,10 +291,14 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
//
update(time, delta) {
if (this.takingDamage === true) {
this.body.setVelocity(0, 0);
return;
}
if (this.onPatrol === true) {
this.patrol();
}
this.anims.play('walk99', true);
}
const camera = this.scene.cameras.main;

View File

@ -13,7 +13,7 @@ export class Player extends Phaser.GameObjects.Sprite {
this.healthText;
this.healthImages;
this.numHearts = 3;
this.maxHearts = 3;
this.maxHearts = scene.game.playerData.maxHearts;
this.normalVelocityX = 260;
this.inventory = [];
this.facing = 'south';
@ -125,6 +125,8 @@ export class Player extends Phaser.GameObjects.Sprite {
return;
}
let axeAngle = this.body.angle
this.isAttacking = true;
this.pauseMove = true;
@ -152,7 +154,7 @@ export class Player extends Phaser.GameObjects.Sprite {
velocY = 1500;
} else if (this.facing === 'south') {
offsetY = -100;
rotate = 270;
rotate = 9;
velocY = -1500;
}
@ -215,7 +217,7 @@ export class Player extends Phaser.GameObjects.Sprite {
.setShadow(3,3, '#333', 5)
.setScrollFactor(0);
this.updateHealth();
this.livesText = this.scene.add.text(16, 64, 'Lives:', { fontSize: '36px', fill: '#FFF' })
this.livesText = this.scene.add.text(16, 64, 'Score: '+this.scene.game.playerData.score, { fontSize: '36px', fill: '#FFF' })
.setShadow(3,3, '#333', 5)
.setScrollFactor(0);
}
@ -225,6 +227,7 @@ export class Player extends Phaser.GameObjects.Sprite {
if (this.isTakingDamage) {
return;
}
this.isTakingDamage = true;
this.scene.sound.play('player-damage');
this.scene.tweens.add({
@ -271,14 +274,16 @@ export class Player extends Phaser.GameObjects.Sprite {
// Knockback
// Reset taking damage state after a delay
this.scene.time.delayedCall(500, () => {
this.scene.time.delayedCall(1000, () => {
this.isTakingDamage = false;
this.pauseMove = false;
});
}
addHealth(amount) {
if (this.numHearts < 3) {
// this.maxHearts ++;
// this.scene.game.playerData.maxHearts = this.maxHearts;
if (this.numHearts < this.maxHearts) {
this.numHearts += 1;
this.updateHealth();
this.scene.sound.play('health-pickup');
@ -292,13 +297,9 @@ export class Player extends Phaser.GameObjects.Sprite {
if (this.healthImages) {
this.healthImages.destroy(true);
}
if (this.lifeImages) {
this.lifeImages.destroy(true);
}
this.healthImages = this.scene.add.group();
this.lifeImages = this.scene.add.group();
let startX = 170;
let startLivesX = 165
// Add full hearts
for (let i = 0; i < this.numHearts; i++) {
@ -307,16 +308,10 @@ export class Player extends Phaser.GameObjects.Sprite {
}
// Add empty hearts for the remaining slots
for (let i = this.numHearts; i < 3; i++) {
for (let i = this.numHearts; i < this.maxHearts; i++) {
this.healthImages.add(this.scene.add.image(startX, 15, 'heart-empty').setOrigin(0, 0).setScale(.5).setScrollFactor(0));
startX += 48;
}
// Add Lives
for (let i = 0; i < this.numLives; i++) {
this.lifeImages.add(this.scene.add.image(startLivesX, 64, 'life').setOrigin(0, 0).setScale(.5).setScrollFactor(0));
startLivesX += 48;
}
}
addItemToInventory(itemKey) {

View File

@ -14,9 +14,7 @@ export class GlobalState {
}
set hearts(value) {
if (value < 0) {
throw new Error("Hearts cannot be less than 0");
}
if (value < 0) throw new Error("Hearts cannot be less than 0");
this.playerData.hearts = value;
}
@ -25,9 +23,7 @@ export class GlobalState {
}
set maxHearts(value) {
if (value < 0) {
throw new Error("Max hearts cannot be less than 0");
}
if (value < 0) throw new Error("Max hearts cannot be less than 0");
this.playerData.maxHearts = value;
}
@ -36,31 +32,25 @@ export class GlobalState {
}
set score(value) {
if (value < 0) {
throw new Error("Score cannot be less than 0");
}
if (value < 0) throw new Error("Score cannot be less than 0");
this.playerData.score = value;
}
get inventory() {
return [...this.playerData.inventory]; // Return a copy to prevent external modification
return [...this.playerData.inventory]; // Return a copy
}
set inventory(value) {
if (!Array.isArray(value)) {
throw new Error("Inventory must be an array");
}
if (!Array.isArray(value)) throw new Error("Inventory must be an array");
this.playerData.inventory = value;
}
get upgrades() {
return [...this.playerData.upgrades]; // Return a copy to prevent external modification
return [...this.playerData.upgrades]; // Return a copy
}
set upgrades(value) {
if (!Array.isArray(value)) {
throw new Error("Upgrades must be an array");
}
if (!Array.isArray(value)) throw new Error("Upgrades must be an array");
this.playerData.upgrades = value;
}
}

View File

@ -1,9 +1,6 @@
import { MenuScene } from './scenes/MenuScene.js';
import { Gulch } from './scenes/gulch.js';
import { NNDungeon } from './scenes/NNDungeon.js';
// import { L2Scene } from './scenes/L2Scene.js';
// import { L3Scene } from './scenes/L3Scene.js';
const config = {
type: Phaser.AUTO,
@ -21,10 +18,17 @@ const config = {
},
scene: [
//MenuScene,
//Gulch,
MenuScene,
Gulch,
NNDungeon
]
};
new Phaser.Game(config);
const game = new Phaser.Game(config);
game.playerData = {
score: 0,
maxHearts: 3,
startGulchX: 950,
startGulchY: 4250,
}

View File

@ -30,8 +30,8 @@ export class NNDungeon extends Phaser.Scene {
frameHeight: 100
});
this.load.spritesheet('boss-tiles', 'assets/boss-tiles.png', {
frameWidth: 100,
frameHeight: 100
frameWidth: 200,
frameHeight: 200
});
this.load.spritesheet('99Dungeon-tiles', 'assets/dungeon-tiles.png', {
frameWidth: 100,
@ -62,8 +62,8 @@ export class NNDungeon extends Phaser.Scene {
//const zoneLayer = gulchMap.getObjectLayer('zone');
// Add a player
//this.player = new Player(this, 2400, 3450);
this.player = new Player(this, 3550, 350);
this.player = new Player(this, 2400, 3450);
//this.player = new Player(this, 3550, 350);
this.player.healthBars(true, 1, 3);
// zoneLayer.objects.forEach(object => {
@ -95,6 +95,7 @@ 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 {
@ -133,7 +134,7 @@ export class NNDungeon extends Phaser.Scene {
a99Boy.bottleReloadVariance = 500;
}
if (prop.name === 'NNBoss' && prop.value === true) {
a99Boy.tiles = 'boss-tiles'
a99Boy.boss = true;
}
if (prop.name === 'health') {
a99Boy.health = prop.value;

View File

@ -53,7 +53,7 @@ export class Gulch extends Phaser.Scene {
const zoneLayer = gulchMap.getObjectLayer('zone');
// Add a player
this.player = new Player(this, 950, 4250);
this.player = new Player(this, this.game.playerData.startGulchX, this.game.playerData.startGulchY);
this.player.healthBars(true, 1, 3);
zoneLayer.objects.forEach(object => {
@ -69,6 +69,7 @@ export class Gulch extends Phaser.Scene {
runChildUpdate: true
});
enemiesLayer.objects.forEach(object => {
let a99Boy = this.enemies.create(object.x-50, object.y-50, '99boy-tiles', object.gid-101);
if (object.properties) {
object.properties.forEach(prop => {
if (prop.name === 'patrolX') {