}
}
+class Door extends Phaser.TileSprite {
+ constructor(x, y, name, vector, longpanel) {
+ super(game, x, y, 64, 64, 'objects');
+ this.tilePosition = new Phaser.Point(-64, -64);
+ console.log("New door:", this);
+ }
+}
+
class Player extends Phaser.Sprite {
constructor(x, y) {
super(game, x, y, 'player');
constructor() {
this.player = this.clara = this.carlos = this.saiki = this.peter = this.bianca = null;
this.gameinterface = new GameInterface(game, game.stage);
+ //this.doors = game.add.group(game.world, "doors");
this.last_menuselect = 0;
}
createObject(object) {
switch (object.type) {
case 'spawnpoint': this.createCharacter(object); break;
+ case 'door': this.createDoor(object); break;
case '': console.error("Object type is empty:", object); break;
default: console.error("Unknown object type:", object);
}
console.log(newChar);
}
+ createDoor(object) {
+ var vector;
+ switch (object.rotation) {
+ case undefined:
+ case 0: vector = new Phaser.Point( -1, 0); break;
+ case 90: vector = new Phaser.Point( 0, -1); break;
+ case 180: vector = new Phaser.Point( 1, 0); break;
+ case 270: vector = new Phaser.Point( 0, 1); break;
+ default: console.error("Invalid rotation:", object.rotation);
+ }
+ this.doors.add(new Door(object.x, object.y, object.name, vector, object.properties.longpanel));
+ }
+
callMenu(menuitem) {
console.log("Menu callback received:", menuitem);
this.last_menuselect = game.time.now;
map.setCollisionBetween(1, 100, true, this.layer_walls);
this.layer_furniture = map.createLayer('furniture');
map.setCollisionBetween(1, 100, true, this.layer_furniture);
+
+ // FIXME: Don't create a group here like this, it's too ugly! Now I have it here due to the display order.
+ logic.doors = game.add.group(game.world, "doors");
+
map.objects['objects'].forEach(function(o) { logic.createObject(o); });
console.log(map.objects);