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, "x":0,
"y":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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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],
"height":16,
"width":16,
"x":32,
"y":16
},
{ {
"data":[0, 0, 0, 0, 0, 139, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0, "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 0, 0,
@ -751,39 +817,6 @@
"x":1300, "x":1300,
"y":3000 "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, "gid":301,
"height":200, "height":200,
@ -814,8 +847,111 @@
"type":"", "type":"",
"visible":true, "visible":true,
"width":200, "width":200,
"x":4400, "x":4300,
"y":400 "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, "opacity":1,
"type":"objectgroup", "type":"objectgroup",
@ -881,7 +1017,7 @@
"y":0 "y":0
}], }],
"nextlayerid":6, "nextlayerid":6,
"nextobjectid":23, "nextobjectid":28,
"orientation":"orthogonal", "orientation":"orthogonal",
"renderorder":"right-down", "renderorder":"right-down",
"tiledversion":"1.11.2", "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"?> <?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> <editorsettings>
<export target="../assets/NNDungeon.json" format="json"/> <export target="../assets/NNDungeon.json" format="json"/>
</editorsettings> </editorsettings>
@ -367,6 +367,9 @@
<tileset firstgid="201" name="99boy-tiles" tilewidth="100" tileheight="100" tilecount="100" columns="10"> <tileset firstgid="201" name="99boy-tiles" tilewidth="100" tileheight="100" tilecount="100" columns="10">
<image source="../assets/99boy-tiles.png" width="1000" height="1000"/> <image source="../assets/99boy-tiles.png" width="1000" height="1000"/>
</tileset> </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"> <layer id="1" name="main" width="16" height="9">
<data encoding="csv"> <data encoding="csv">
<chunk x="0" y="0" width="16" height="16"> <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, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,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>
<chunk x="48" y="0" width="16" height="16"> <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, 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 0,10,0,10,88,89,0,0,0,0,0,0,0,0,0,0
</chunk> </chunk>
<chunk x="16" y="16" width="16" height="16"> <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,0,0,0,0,0,0,0,0,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, 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,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,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 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>
<chunk x="48" y="16" width="16" height="16"> <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, 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"/> <property name="speed" type="int" value="350"/>
</properties> </properties>
</object> </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> <properties>
<property name="NNBoss" type="bool" value="true"/> <property name="NNBoss" type="bool" value="true"/>
<property name="garbage" type="bool" value="true"/> <property name="garbage" type="bool" value="true"/>
<property name="health" type="int" value="3"/> <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> </properties>
</object> </object>
</objectgroup> </objectgroup>

View File

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

View File

@ -27,11 +27,13 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
this.garbage = false; this.garbage = false;
this.onPause = false; this.onPause = false;
this.health = 1; this.health = 1;
this.takingDamage = false;
this.boss = false;
// Create animations // Create animations
this.anims.create({ this.anims.create({
key: 'walk99', 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, frameRate: 5,
repeat: -1 repeat: -1
}); });
@ -101,33 +103,87 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
// Example: Enemy taking damage // Example: Enemy taking damage
takeDamage() { 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.health === 1) {
let dropHeart = Math.floor(Math.random() * this.dropHeartOneIn);
if (dropHeart === 1) { if (this.boss === true) {
let heart = this.scene.physics.add.image(this.x, this.y, 'heart-full').setScale(.5); //BOSS DEFEAT
this.scene.hearts.add(heart); 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({ this.scene.tweens.add({
targets: heart, targets: this,
scale: 0.8, scale: 1.5,
duration: 1000,
ease: 'Power1', ease: 'Power1',
yoyo: true, yoyo: true,
repeat: -1 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);
this.scene.hearts.add(heart);
this.scene.tweens.add({
targets: heart,
scale: 0.8,
duration: 1000,
ease: 'Power1',
yoyo: true,
repeat: -1
});
}
// Create a tween that scales the enemy's body on Y-axis to 10
let variance = Math.floor(Math.random() * 2);
this.scene.sound.play('99boy-defeat-'+variance);
this.scene.tweens.add({
targets: this,
scaleY: .2,
duration: 200, // Duration of the animation in milliseconds
ease: 'Power1',
onComplete: () => {
// Destroy the enemy after the animation completes
this.destroy();
}
}); });
} }
// Create a tween that scales the enemy's body on Y-axis to 10
let variance = Math.floor(Math.random() * 2);
this.scene.sound.play('99boy-defeat-'+variance);
this.scene.tweens.add({
targets: this,
scaleY: .2,
duration: 200, // Duration of the animation in milliseconds
ease: 'Power1',
onComplete: () => {
// Destroy the enemy after the animation completes
this.destroy();
}
});
} else { } else {
this.body.setVelocity(0, 0); this.body.setVelocity(0, 0);
this.health --; this.health --;
@ -141,6 +197,10 @@ export class NNBoy extends Phaser.GameObjects.Sprite {
this.speed += 200; this.speed += 200;
this.bottleReloadVariance = 1000; 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) { update(time, delta) {
if (this.takingDamage === true) {
this.body.setVelocity(0, 0);
return;
}
if (this.onPatrol === true) { if (this.onPatrol === true) {
this.patrol(); this.patrol();
this.anims.play('walk99', true);
} }
this.anims.play('walk99', true);
const camera = this.scene.cameras.main; const camera = this.scene.cameras.main;

View File

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

View File

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

View File

@ -1,9 +1,6 @@
import { MenuScene } from './scenes/MenuScene.js'; import { MenuScene } from './scenes/MenuScene.js';
import { Gulch } from './scenes/gulch.js'; import { Gulch } from './scenes/gulch.js';
import { NNDungeon } from './scenes/NNDungeon.js'; import { NNDungeon } from './scenes/NNDungeon.js';
// import { L2Scene } from './scenes/L2Scene.js';
// import { L3Scene } from './scenes/L3Scene.js';
const config = { const config = {
type: Phaser.AUTO, type: Phaser.AUTO,
@ -21,10 +18,17 @@ const config = {
}, },
scene: [ scene: [
//MenuScene, MenuScene,
//Gulch, Gulch,
NNDungeon 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 frameHeight: 100
}); });
this.load.spritesheet('boss-tiles', 'assets/boss-tiles.png', { this.load.spritesheet('boss-tiles', 'assets/boss-tiles.png', {
frameWidth: 100, frameWidth: 200,
frameHeight: 100 frameHeight: 200
}); });
this.load.spritesheet('99Dungeon-tiles', 'assets/dungeon-tiles.png', { this.load.spritesheet('99Dungeon-tiles', 'assets/dungeon-tiles.png', {
frameWidth: 100, frameWidth: 100,
@ -62,8 +62,8 @@ export class NNDungeon extends Phaser.Scene {
//const zoneLayer = gulchMap.getObjectLayer('zone'); //const zoneLayer = gulchMap.getObjectLayer('zone');
// Add a player // Add a player
//this.player = new Player(this, 2400, 3450); this.player = new Player(this, 2400, 3450);
this.player = new Player(this, 3550, 350); //this.player = new Player(this, 3550, 350);
this.player.healthBars(true, 1, 3); this.player.healthBars(true, 1, 3);
// zoneLayer.objects.forEach(object => { // zoneLayer.objects.forEach(object => {
@ -95,6 +95,7 @@ export class NNDungeon extends Phaser.Scene {
}); });
enemiesLayer.objects.forEach(object => { enemiesLayer.objects.forEach(object => {
let a99Boy; let a99Boy;
console.log(object.gid);
if (object.gid > 300) { if (object.gid > 300) {
a99Boy = this.enemies.create(object.x-50, object.y-50, 'boss-tiles', object.gid-301); a99Boy = this.enemies.create(object.x-50, object.y-50, 'boss-tiles', object.gid-301);
} else { } else {
@ -133,7 +134,7 @@ export class NNDungeon extends Phaser.Scene {
a99Boy.bottleReloadVariance = 500; a99Boy.bottleReloadVariance = 500;
} }
if (prop.name === 'NNBoss' && prop.value === true) { if (prop.name === 'NNBoss' && prop.value === true) {
a99Boy.tiles = 'boss-tiles' a99Boy.boss = true;
} }
if (prop.name === 'health') { if (prop.name === 'health') {
a99Boy.health = prop.value; a99Boy.health = prop.value;

View File

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