+ if (!longpanel) {
+ this.anchor = new Phaser.Point(0.5, 0.5);
+ this.tilePosition = new Phaser.Point(-64, -64);
+ this.openvector = Phaser.Point.multiply(vector, new Phaser.Point(56, 56));
+ }
+ else {
+ this.width *= 2;
+ this.anchor = new Phaser.Point(0.75, 0.5);
+ this.tilePosition = new Phaser.Point(0, -64);
+ 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);
+ }
+
+ update() {
+ if ((this.opentween) && (game.time.now > 5000)) {
+ console.log(game.time.now, "Opening door.");
+ this.opentween.start();
+ this.opentween = null;
+ }
+ else if ((this.closetween) && (game.time.now > 10000)) {
+ console.log(game.time.now, "Closing door.");
+ this.closetween.start();
+ this.closetween = null;
+ }