mouse.isDown uses 1 = left / 2 = right (LÖVE-style, matching docs and voxel-terrain/cardgame examples); button 0 is skipped and always false. examples/building (+ building-3d, building-tilemap) called mousePressed(0) for left-click placement, so placing buildings never fired while ghost preview, palette keys, rotation and right-click removal still worked. Switch the mousePressed helper and left-click call sites to button 1.
Tilemap 建筑放置示例
演示在多样式 tilemap 上放置建筑:
map模块创建等距(或六角)TileLayer,world.bindTileLayer(layer)直接复用其投影world.setTerrainGid(gid, semantic)让地形语义从 tile GID 懒解析(水域/陆地)eve.BuildingFx按定义visual2d生成 2D 精灵,进入统一 2D 队列按脚点 Y 穿插PlacementSession封装放置 / 拆除 / 旋转 / 鬼影校验
make run/<platform>-debug GAME=examples/building-tilemap
| 输入 | 作用 |
|---|---|
1–3 |
选择建筑(房屋 / 码头 / 塔楼) |
| 鼠标移动 | 鬼影跟随并吸附(等距/六角投影) |
R |
旋转 |
| 左键 | 放置 |
| 右键 | 拆除指针下建筑 |
T |
切换网格叠加 |