X-Git-Url: http://git.megabrutal.com/?p=wgj58.git;a=blobdiff_plain;f=wgj58.js;h=fcfa0f408c164a3c93d727d140415489ed860db5;hp=8fe220f63a39ac710d93b8402fe35192e682dfe9;hb=d988949db6969ebd6c45a95001b6f2169bf967a3;hpb=d9b347a8804fedc728550ae5372306a670b5b6a8 diff --git a/wgj58.js b/wgj58.js index 8fe220f..fcfa0f4 100644 --- a/wgj58.js +++ b/wgj58.js @@ -55,11 +55,12 @@ class Door extends Phaser.TileSprite { this.openvector = Phaser.Point.multiply(vector, new Phaser.Point(116, 116)); } this.rotation = rotation * (Math.PI / 180); - console.log("Calculated vector:", this.openvector); this.closetween = game.add.tween(this).to({ x: this.position.x, y: this.position.y }, 1000, Phaser.Easing.Sinusoidal.InOut, false, 0, 0, false); this.openposition = Phaser.Point.add(this.position, this.openvector); this.opentween = game.add.tween(this).to({ x: this.openposition.x, y: this.openposition.y }, 1000, Phaser.Easing.Sinusoidal.InOut, false, 0, 0, false); this.isOpen = false; + game.physics.arcade.enable(this); + this.body.immovable = true; } open() { @@ -75,6 +76,10 @@ class Door extends Phaser.TileSprite { this.isOpen = false; } } + + update() { + game.debug.body(this); + } } class Player extends Phaser.Sprite { @@ -501,7 +506,6 @@ class GameLogic { } openDoor(doorname) { - console.log("Opening doors."); this.doors.children.forEach(function(o) { if (o.name == doorname) o.open(); }); } @@ -548,6 +552,7 @@ class GamePlay extends Phaser.State { game.world.setBounds(0, 0, 800, 600); game.stage.backgroundColor = '#000000'; game.physics.startSystem(Phaser.Physics.ARCADE); + console.log("Debug enabled:", !game.debug.isDisabled); var map = game.add.tilemap('gamemap'); map.addTilesetImage('tileset', 'tileset'); @@ -574,6 +579,7 @@ class GamePlay extends Phaser.State { game.physics.arcade.collide(logic.player, this.layer_walls); game.physics.arcade.collide(logic.player, this.layer_furniture); + game.physics.arcade.collide(logic.player, logic.doors); logic.update(); }