瀏覽代碼

Correctly position entities when spawning a filtered set

master
Fen Dweller 3 年之前
父節點
當前提交
45f971d9d0
共有 1 個檔案被更改,包括 14 行新增1 行删除
  1. +14
    -1
      macrovision.js

+ 14
- 1
macrovision.js 查看文件

@@ -5699,13 +5699,26 @@ function spawnAll() {
const category = document.querySelector("#category-picker").value;
const maker = availableEntities[category][element.value];
const entity = maker.constructor();


if (config.lockYAxis) {
yOffset = getVerticalOffset();
} else {
// Snap to the ground if it's visible.
if (config.groundSnap && pos2pix({x: 0, y: 0}).y < canvasHeight + 50) {
yOffset = -config.y;
} else {
yOffset = config.height.toNumber("meters") / 2;
}
}
displayEntity(
entity,
entity.view,
-worldWidth * 0.45 +
config.x +
(worldWidth * 0.9 * index) / (count - 1),
config.y
config.y + yOffset
);
index += 1;
return entityIndex - 1;


Loading…
取消
儲存