Add stage map tile rendering path
This commit is contained in:
@@ -37,6 +37,7 @@ stage_01.map
|
||||
- 玩家出生点。
|
||||
- 摄像机边界。
|
||||
- 平台碰撞世界。
|
||||
- tileset 定义和 tile entry。
|
||||
- 场景视觉层。
|
||||
- battle zone。
|
||||
- enemy spawn point。
|
||||
@@ -49,18 +50,32 @@ world <width> <height>
|
||||
camera <x> <y> <width> <height>
|
||||
player_spawn <x> <y>
|
||||
collision <x> <y> <width> <height>
|
||||
tileset <id> <texture> <tile_w> <tile_h> <r> <g> <b> <a>
|
||||
layer <id> <BackgroundFar|BackgroundMid|LevelVisual|PropsBack|PropsFront> <parallax>
|
||||
rect <x> <y> <width> <height> <r> <g> <b> <a>
|
||||
rect_sprite <x> <y> <width> <height> <r> <g> <b> <a> <texture>
|
||||
rect_sprite_src <x> <y> <width> <height> <r> <g> <b> <a> <texture> <sx> <sy> <sw> <sh>
|
||||
tile_rect <tileset> <x> <y> <columns> <rows> <tile_index> <r> <g> <b>
|
||||
endlayer
|
||||
battle_zone <id> <trigger_x> <trigger_y> <trigger_w> <trigger_h> <camera_x> <camera_y> <camera_w> <camera_h>
|
||||
spawn <id> <x> <y>
|
||||
endbattle_zone
|
||||
```
|
||||
|
||||
## Tile 约定
|
||||
|
||||
`tileset` 定义 tile 图片来源、单格尺寸和 fallback 色。图片不存在时,`StageRenderer` 会按 tile fallback 色绘制,不阻断场景启动。
|
||||
|
||||
`tile_rect` 只能写在 `layer` 内,用于批量铺同一种 tile:
|
||||
|
||||
- `columns` / `rows` 是重复格数。
|
||||
- `tile_index` 当前表示 tileset 第一行的横向 tile 序号。
|
||||
- `r g b` 是该批 tile 的灰盒 fallback 色,alpha 固定为 `1.0`。
|
||||
|
||||
当前 `stage_01.map` 已把 `level_visual` 地面和平台从长色块替换为 `tile_rect`,碰撞仍由 `collision` 独立定义。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 给 `.map` 增加 tileset/tile entry。
|
||||
- 增加重复 block、空 layer、battle zone 无 spawn、tile 引用不存在等错误日志。
|
||||
- 把 `tile_rect` 扩展成可表达 tile row/column 或 tile id。
|
||||
- 增加空 layer、battle zone 无 spawn、tile texture 不存在等更严格错误日志。
|
||||
- 保留 `whitebox_level.cpp` 作为 fallback,不再把主地图写死在 C++。
|
||||
|
||||
@@ -31,6 +31,8 @@ UI
|
||||
- 支持色块占位。
|
||||
- 支持普通 PNG texture path。
|
||||
- 支持 source rect。
|
||||
- 支持 `.map` tile entry 绘制。
|
||||
- 支持 tileset 图片缺失时按 tile fallback 色绘制。
|
||||
- 资源缺失时回退色块,不阻断场景运行。
|
||||
|
||||
## 约束
|
||||
@@ -41,6 +43,6 @@ UI
|
||||
|
||||
## 下一步
|
||||
|
||||
- 增加 tile entry 绘制路径。
|
||||
- 把 `level_visual` 长色块逐步替换为 tile。
|
||||
- 给 tile entry 增加 tile id 或二维 source index。
|
||||
- 把正式 tileset 素材接入 `stage_01.map`。
|
||||
- 如果引擎提供统一 Texture cache,再迁移当前局部贴图缓存。
|
||||
|
||||
Reference in New Issue
Block a user