diff --git a/src/scenes/gulch.js b/src/scenes/gulch.js index b15159c..53ea1a5 100644 --- a/src/scenes/gulch.js +++ b/src/scenes/gulch.js @@ -50,11 +50,19 @@ export class Gulch extends Phaser.Scene { const objectsLayer = gulchMap.createLayer('objects', gulchTiles, 0, 0) .setCollisionByProperty({ collides: true }); const enemiesLayer = gulchMap.getObjectLayer('enemies'); + const zoneLayer = gulchMap.getObjectLayer('zone'); // Add a player this.player = new Player(this, 950, 3650); 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); + } + }); + // Add Enemies this.enemies = this.physics.add.group({ classType: NNBoy, @@ -87,6 +95,10 @@ export class Gulch extends Phaser.Scene { if (prop.name === 'speed') { a99Boy.speed = prop.value; } + if (prop.name === 'garbage') { + a99Boy.garbage = prop.value; + a99Boy.reloadCalc = 5000; + } }); } }); @@ -104,7 +116,12 @@ export class Gulch extends Phaser.Scene { this.physics.add.collider(this.player, objectsLayer); this.physics.add.collider(this.enemies, mainLayer); this.physics.add.collider(this.enemies, objectsLayer); - this.physics.add.collider(this.player, this.enemies); + 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'); + }); // Collision between bullets and enemies this.physics.add.collider(this.bullets, this.enemies, (bullet, enemy) => {