5SWO57MM5QKEXDPNI7DOBBW6A6PLTP4PEHHJQ7QOGWLINJ6GIOUQC
EMED7UWAGESRTWJJWVXRL27O4XMBGZDDAU4LNVF3MQAYKFKRDNXQC
TQ57VE45BHV7MOZ6GKTYZEAMAOTXLPQ3ROCWJ2FUCITQWOYVMUIAC
YJ3YEICSBUHMDVJB6W3ZOOVWLTAXRDCIKOGNN6HRP6N3HWQTDGVAC
THNMNMVRZQVPZTEXHIK6WGYN3QDEFPKFOVOCB5HTWCYC5BOBYQ5AC
AAKN4XJLZ2GARZMUFYX3CJZKYHTRRZDYNTFRLMY7VPAY7K6W4N3QC
26RDNOXGRCW2E2AOUTKMARJZEGCTVB5K27YXFQFGIAFJ3PP4LWDAC
FOSCN7AFGTTDRJRLAIIRMI2D5JYXXCKMYMCKOAVVT6WV2PAGUJOQC
2U4FPBRH4POPKCDYHCAI6JBOM4T3T36EBTCHJUAEE2RSAWNTQ6FQC
FXYPURO7GWFOWZMZ4HP7SMLAXSZMQAON6D6LTGSKPYST52RJYXIAC
3ZWCUXFJKMBK2E7LB3CD6CAMLA365TY2UM4YOY5LJMIUU7A5EP2AC
4TYJCGT4MTCAH7GSJJWFQPPHZNAUQZDEIZYT365EYTMXS7D2MTNAC
HGXJZUEJA2SU6AATVCYBQXOKYF3ATULY375NL5ZZWRBWJYDHKJ4QC
MVMGDCF5YC4OJC2OACVZCDJATCYQPLWX3P2PCOHIR7AHFKTMALUAC
QU7JVYXAGGNN4754FJAT7HFTSFHLLIWWNIVYBMCBQJVSLTB5RNIQC
2EGPRWETVM2XPSRMGYM25Y46RXPW7IOCN6MDIV6POCPHNOEGSMHAC
T6RGFAV3VFISSGKMFKK544MGGXCURAO4ARG22R5O75UBUKPHFM5AC
VQJBTLNEKPLH62WALLZABSTLHLEMS4SFVEVFUOXJ4EFABHISYF5QC
const keyboard = new KeyboardState();
this.app.ticker.add((delta) => {
keyboard.update();
if (keyboard.down.Right) {
this.actionStage.x -= 10 * delta;
}
if (keyboard.down.Left) {
this.actionStage.x += 10 * delta;
}
if (keyboard.down.Up) {
this.actionStage.y += 10 * delta;
}
if (keyboard.down.Down) {
this.actionStage.y -= 10 * delta;
}
});
this.keyboard = new KeyboardState();
this.app.ticker.add(() => {
this.keyboard.update();
})
// add an invisible layer to the entire fixedCameraStage so we can pan and zoom
// Register mouse drag to use for panning
registerDraggable({
source: this.backdropStage,
// dragging backdrop stage should move action stage in the reverse direction -- we're dragging the backdrop, not an entity
target: this.actionStage,
});
// populate the backdrop layer with something that captures mouse events
// Register keyboard to use for panning
this.app.ticker.add((delta) => {
if (this.keyboard.down.Right) {
this.actionStage.x -= 10 * delta;
}
if (this.keyboard.down.Left) {
this.actionStage.x += 10 * delta;
}
if (this.keyboard.down.Up) {
this.actionStage.y += 10 * delta;
}
if (this.keyboard.down.Down) {
this.actionStage.y -= 10 * delta;
}
});
chunksContainer.x = this.app.screen.width/2;
chunksContainer.y = this.app.screen.height/2;
})
for (let i = -3; i <= 3; i++) {
for (let j = -3; j <= 3; j++) {
chunksContainer.addChild(
new RenderedChunk(
new Chunk(this.randomSeed, new Vector2(i, j)),
chunksContainer.x = this.app.screen.width / 2;
chunksContainer.y = this.app.screen.height / 2;
});
// let preloadedZLevelDown = new RenderedZLevel(
// new ZLevel(this.randomSeed, -1),
// this.config.onFocusedNodeChange
// )
let goingZDirection = 0;
this.app.ticker.add((delta) => {
if (this.keyboard.justUp[">"]) {
goingZDirection = 0;
chunksContainer.alpha = 1;
}
if (this.keyboard.justUp["<"]) {
goingZDirection = 0;
chunksContainer.alpha = 1;
}
if (this.keyboard.justDown[">"]) {
if (goingZDirection != -1) {
chunksContainer.alpha = 1;
goingZDirection = -1;
}
}
if (this.keyboard.justDown["<"]) {
if (goingZDirection != 1) {
chunksContainer.alpha = 1;
goingZDirection = 1;
}
}
if (this.keyboard.down[">"]) {
// phase out the current z level and go to another one
chunksContainer.alpha -= 0.1;
chunksContainer.width *= 1.03;
chunksContainer.height *= 1.03;
// this.actionStage.removeChild(chunksContainer);
if (chunksContainer.alpha <= 0) {
this.actionStage.removeChild(chunksContainer);
zLevel = new RenderedZLevel(
new ZLevel(this.randomSeed, zLevel.zLevel.z - 1),
).container
);
);
// zLevel = preloadedZLevelDown;
// preloadedZLevelDown = new RenderedZLevel(
// new ZLevel(this.randomSeed, preloadedZLevelDown.zLevel.z - 1),
// this.config.onFocusedNodeChange
// );
chunksContainer = zLevel.container;
this.actionStage.addChild(chunksContainer);
chunksContainer.x = this.app.screen.width/2;
chunksContainer.y = this.app.screen.height/2;
}
}
if (this.keyboard.down["<"]) {
// phase out the current z level and go to another one
chunksContainer.alpha -= 0.1;
chunksContainer.width *= 1/1.03;
chunksContainer.height *= 1/1.03;
// this.actionStage.removeChild(chunksContainer);
if (chunksContainer.alpha <= 0) {
this.actionStage.removeChild(chunksContainer);
zLevel = new RenderedZLevel(
new ZLevel(this.randomSeed, zLevel.zLevel.z + 1),
this.config.onFocusedNodeChange
);
// zLevel = preloadedZLevelDown;
// preloadedZLevelDown = new RenderedZLevel(
// new ZLevel(this.randomSeed, preloadedZLevelDown.zLevel.z - 1),
// this.config.onFocusedNodeChange
// );
chunksContainer = zLevel.container;
this.actionStage.addChild(chunksContainer);
chunksContainer.x = this.app.screen.width/2;
chunksContainer.y = this.app.screen.height/2;
}
}
});