From 0c5af85cc0cb9bb39a3a72548e735b92daf0a28f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 4 Mar 2026 22:53:35 +0100 Subject: Add collision with the player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows for explosions to run after making the player to disappear, and it re-runs the entering scene timer. Signed-off-by: Miquel Sabaté Solà --- src/player.s | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/player.s') diff --git a/src/player.s b/src/player.s index df2ee68..a821f0e 100644 --- a/src/player.s +++ b/src/player.s @@ -114,6 +114,11 @@ ;; Initialize the player's sprite. Note that for the sprite to look ;; correctly on screen you still need to call `Player::update` afterwards. .proc init + ;; Make sure that the 'dead' bit from the global flags is zeroed out. + lda Globals::zp_flags + and #%11101111 + sta Globals::zp_flags + ;; Initial state. lda #%01000100 sta zp_state @@ -822,4 +827,31 @@ rts .endproc + + ;; That's just german for "the Bart, the". + .proc die_bart_die + ;; TODO: dec lifes + + ;; Move the player's sprites out of the screen. + ldx #0 + lda #$FF + sta OAM::m_sprites, x + sta OAM::m_sprites + 4, x + sta OAM::m_sprites + 8, x + sta OAM::m_sprites + 12, x + sta OAM::m_sprites + 16, x + sta OAM::m_sprites + 20, x + + ;; Set the player as dead. + lda #$10 + ora Globals::zp_flags + sta Globals::zp_flags + + ;; Create an explosion. + lda Player::zp_screen_y + sta Globals::zp_arg2 + lda Player::zp_screen_x + sta Globals::zp_arg3 + JAL Explosions::create + .endproc .endscope -- cgit v1.2.3