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() {
this.isOpen = false;
}
}
+
+ update() {
+ game.debug.body(this);
+ }
}
class Player extends Phaser.Sprite {
}
openDoor(doorname) {
- console.log("Opening doors.");
this.doors.children.forEach(function(o) { if (o.name == doorname) o.open(); });
}
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');
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();
}