diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-10 12:18:27 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-10 12:18:27 +0100 |
commit | 2a9dba45c2219757dccb249737d504b922f4451e (patch) | |
tree | 9780e6e70ef5b6b7ac8aec5869b9679810024c03 /game/entities.asm | |
parent | c1e83a23774fff30a257466e19b1237b3b78b055 (diff) | |
download | tr8vm-2a9dba45c2219757dccb249737d504b922f4451e.tar.gz tr8vm-2a9dba45c2219757dccb249737d504b922f4451e.zip |
Add frame support, updated sprite
Diffstat (limited to 'game/entities.asm')
-rw-r--r-- | game/entities.asm | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/game/entities.asm b/game/entities.asm index fd79825..6116624 100644 --- a/game/entities.asm +++ b/game/entities.asm @@ -63,7 +63,7 @@ entities_erase_next: port b, y ; next entity - add x, 5 + add x, 6 bo inc a @@ -90,7 +90,7 @@ entities_update_next: push a push x - add x, 5 + add x, 6 bo inc a @@ -117,7 +117,7 @@ entities_update_next: pop a ; next entity - add x, 7 + add x, 8 bo inc a @@ -137,6 +137,8 @@ entities_draw_next: bz jmp entities_draw_done + ; two local variables to keep x, y coord + inc x bo inc a @@ -154,9 +156,9 @@ entities_draw_next: inc x bo inc a - ; a : x points to sprite data + ; a : x points to the frame - ; get gb data + ; save bg data ; settings mode ld y, 128 @@ -201,15 +203,53 @@ entities_draw_next: ; setup inc b - ; addr: sprite data + ; prepare some local variables + + ; frame ld y, [a : x] - port b, y + inc x + bo + inc a + push y + + ; sprite addr + ld y, [a : x] + push y inc x bo inc a ld y, [a : x] + push y + + ; frame number + ld b, [sp + 2] +entity_draw_frame: + dec b + bo + jmp entity_draw_frame_done + + ; calculate frame + ld y, [sp + 0] + inc y + ld [sp + 0], y + jmp entity_draw_frame + +entity_draw_frame_done: + + ; settings port + ld b, 0xb1 + + ; addr: sprite data + ld y, [sp + 1] + port b, y + ld y, [sp + 0] port b, y + ; free local variables + pop y + pop y + pop y + ; x ld y, [sp + 1] port b, y |