feat(entities): andamiatge del sistema d'entitats (classes, factory, bus, YAML, placeholders, smoke tests)

This commit is contained in:
JailDesigner committed 2026-04-21 12:35:19 +02:00
1 parent 984cc820c0
commit 96b71b0f65
48 files changed
+1957

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

+18
View File
@@ -0,0 +1,18 @@
name: door
type: interactable
sprite:
path: door.gif
size: [16, 16]
tile_size: [1, 1]
flags:
collides: true
interactable: true
animations:
closed: { frames: [0], fps: 1, loop: true }
opening: { frames: [0], fps: 6, loop: false }
open: { frames: [0], fps: 1, loop: true }
behaviour:
states: [CLOSED, OPENING, OPEN]
initial_state: CLOSED
opens_when: all_sarcophagi_open
on_player_contact_when_open: level_complete
Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

+17
View File
@@ -0,0 +1,17 @@
name: floor_trap
type: static_hazard
sprite:
path: floor_trap.gif
size: [16, 16]
tile_size: [1, 1]
flags:
collides: false
interactable: false
animations:
inactive: { frames: [0], fps: 1, loop: true }
active: { frames: [0], fps: 6, loop: true }
cycle:
active_duration: 0.3
inactive_duration: 2.0
stats:
damage: 1
Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

+18
View File
@@ -0,0 +1,18 @@
name: mummy
type: dynamic_hazard
sprite:
path: mummy.gif
size: [12, 24]
tile_size: [1, 1]
flags:
collides: true
interactable: false
animations:
idle: { frames: [0], fps: 1, loop: true }
walk: { frames: [0], fps: 8, loop: true }
ai:
type: corridor_wanderer
direction_choice: random
stats:
speed: 40
damage: 1
Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

@@ -0,0 +1,17 @@
name: rolling_rock
type: dynamic_hazard
sprite:
path: rolling_rock.gif
size: [16, 16]
tile_size: [1, 1]
flags:
collides: true
interactable: false
animations:
roll: { frames: [0], fps: 10, loop: true }
ai:
type: straight_line
initial_direction: right
stats:
speed: 60
damage: 1
Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

@@ -0,0 +1,19 @@
name: sarcophagus
type: interactable
sprite:
path: sarcophagus.gif
size: [48, 16]
tile_size: [3, 1]
flags:
collides: true
interactable: true
animations:
closed: { frames: [0], fps: 1, loop: true }
opening: { frames: [0], fps: 6, loop: false }
open: { frames: [0], fps: 1, loop: true }
behaviour:
states: [CLOSED, OPENING, OPEN]
initial_state: CLOSED
on_perimeter_complete: OPENING
on_opening_end: OPEN
emits_event_on_open: sarcophagus_opened
Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

+11
View File
@@ -0,0 +1,11 @@
name: torch
type: decoration
sprite:
path: torch.gif
size: [16, 16]
tile_size: [1, 1]
flags:
collides: false
interactable: false
animations:
idle: { frames: [0], fps: 8, loop: true }
Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

+17
View File
@@ -0,0 +1,17 @@
name: wall_trap
type: static_hazard
sprite:
path: wall_trap.gif
size: [16, 16]
tile_size: [1, 1]
flags:
collides: false
interactable: false
animations:
inactive: { frames: [0], fps: 1, loop: true }
active: { frames: [0], fps: 6, loop: true }
cycle:
active_duration: 0.5
inactive_duration: 1.5
stats:
damage: 1
+9
View File
@@ -63,3 +63,12 @@ data: |
YZD...D...D...D...DTY
YZDDBBDDADDDBCDDDDDTY
YRXXXXXXXXXXXXXXXXXGY
# Spawns d'entitats per a aquest nivell. El carregador de Map ignora aquest
# bloc; només EntityLoader::readSpawns el consulta. Fase actual: andamiatge;
# encara no cablejat al GameScene, així que aquests spawns es llegiran com
# a dades però no instanciaran res al joc real fins que hi arribi la fase
# d'integració. `position` és [col, row] en la graella de sarcòfags
# (Map::grid_cols × Map::grid_rows) per a sarcòfags, o [col, row] en la
# graella de tiles de 16 px per a la resta (to be refinat).
entities: []
+44
View File
@@ -0,0 +1,44 @@
# Nivell mínim per al smoke test d'entitats. Conté la geometria reduïda
# per a poder carregar Map sense errors, però el seu propòsit real són
# els spawns de sota: l'smoke verifica que EntityLoader::readSpawns els
# retorna correctament i que EntityManager pot instanciar-los i wire-ar-los.
tileset: data/tilesets/tomb.gif
tile_size: 16
origin: [-8, 0]
geometry:
grid_cols: 2
grid_rows: 2
sarc_w: 48
sarc_h: 16
pitch_x: 64
pitch_y: 32
hud_h: 24
back_wall_h: 24
side_wall_w: 24
legend:
Y: 1
X: 169
data: |
YYYYYYYYYYYYYY
YXXXXXXXXXXXXY
YXXXXXXXXXXXXY
YXXXXXXXXXXXXY
YXXXXXXXXXXXXY
YXXXXXXXXXXXXY
YYYYYYYYYYYYYY
entities:
- type: torch
position: [1, 1]
- type: sarcophagus
position: [0, 0]
- type: sarcophagus
position: [1, 0]
- type: door
position: [1, 6]
- type: mummy
position: [3, 3]