mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-24 17:31:54 +00:00
checkout
This commit is contained in:
parent
d5dc17922d
commit
35fad1f5b5
1 changed files with 25 additions and 10 deletions
|
@ -217,21 +217,29 @@ const factory = createLayer(id, () => {
|
||||||
});
|
});
|
||||||
const graphicContainer = new Graphics();
|
const graphicContainer = new Graphics();
|
||||||
let spriteContainer = new Container();
|
let spriteContainer = new Container();
|
||||||
const movingBlocks = new Container();
|
let movingBlocks = new Container();
|
||||||
|
resetContainers();
|
||||||
graphicContainer.zIndex = 1;
|
app.stage.addChild(graphicContainer);
|
||||||
movingBlocks.zIndex = 2;
|
|
||||||
app.stage.addChild(graphicContainer, spriteContainer, movingBlocks);
|
|
||||||
app.stage.sortableChildren = true;
|
app.stage.sortableChildren = true;
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
|
||||||
|
function resetContainers() {
|
||||||
|
spriteContainer.destroy({ children: true });
|
||||||
|
movingBlocks.destroy({ children: true });
|
||||||
|
spriteContainer = new Container();
|
||||||
|
movingBlocks = new Container();
|
||||||
|
graphicContainer.zIndex = 1;
|
||||||
|
/*graphicContainer.position.x = 0.5
|
||||||
|
graphicContainer.position.y = 0.5
|
||||||
|
movingBlocks.position.x = 0.5
|
||||||
|
movingBlocks.position.y = 0.5*/
|
||||||
|
movingBlocks.zIndex = 2;
|
||||||
|
app.stage.addChild(spriteContainer, movingBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
globalBus.on("onLoad", async () => {
|
globalBus.on("onLoad", async () => {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
spriteContainer.destroy({
|
resetContainers();
|
||||||
children: true
|
|
||||||
});
|
|
||||||
spriteContainer = new Container();
|
|
||||||
app.stage.addChild(spriteContainer);
|
|
||||||
for (const y of components.value.keys()) {
|
for (const y of components.value.keys()) {
|
||||||
for (const x of components.value[y].keys()) {
|
for (const x of components.value[y].keys()) {
|
||||||
const data = components.value[y][x];
|
const data = components.value[y][x];
|
||||||
|
@ -287,6 +295,13 @@ const factory = createLayer(id, () => {
|
||||||
if (compBehind.type === "conveyor") {
|
if (compBehind.type === "conveyor") {
|
||||||
// push it to the next conveyor, kill it from the
|
// push it to the next conveyor, kill it from the
|
||||||
// curent conveyor
|
// curent conveyor
|
||||||
|
// too many packages
|
||||||
|
if (
|
||||||
|
compBehind.nextPackages.length +
|
||||||
|
compBehind.packages.length >=
|
||||||
|
1
|
||||||
|
)
|
||||||
|
continue;
|
||||||
block.lastX += dirAmt;
|
block.lastX += dirAmt;
|
||||||
compBehind.nextPackages.push(block);
|
compBehind.nextPackages.push(block);
|
||||||
compData.packages.splice(key, 1);
|
compData.packages.splice(key, 1);
|
||||||
|
|
Loading…
Reference in a new issue