diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-12 23:36:49 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-12 23:36:49 +0100 |
commit | a20b308cfe92a8bb47c6896e7fdb24b15c2efd59 (patch) | |
tree | 22a38850ea38dc91f02095101192061aaafbc30d /game/player.asm | |
parent | 8eec2f91339b8f06e1b80c49c976a9d9ac6e01f7 (diff) | |
download | tr8vm-a20b308cfe92a8bb47c6896e7fdb24b15c2efd59.tar.gz tr8vm-a20b308cfe92a8bb47c6896e7fdb24b15c2efd59.zip |
Add player bullets
Also a changes in the entity system:
- don't preserve the BG (always erase black)
- skip unused entities
- fix in the reserved size (and entity is 8 bytes)
- allocate new entities
Diffstat (limited to 'game/player.asm')
-rw-r--r-- | game/player.asm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/game/player.asm b/game/player.asm index 0e44411..ef63839 100644 --- a/game/player.asm +++ b/game/player.asm @@ -2,6 +2,9 @@ ; player update code ; +cool_down: + .db 0 + player_update: ld x, [sp + 2] ld a, [sp + 3] @@ -52,6 +55,8 @@ player_update: ; base frame ld y, 0 + push b + ; both left and right and b, 48 cmp b, 48 @@ -69,4 +74,27 @@ player_update: player_store_frame: ld [a : x], y + + pop b + + ; fire + bit b, 0 + bnz + ret + + ld x, <cool_down + ld a, >cool_down + ld y, [a : x] + cmp y, 0 + bz + jmp player_fire + dec y + ld [a : x], y + ret + +player_fire: + add y, 10 + ld [a : x], y + + call bullet_player_new ret |