The first thing to do is to calculate / extract ATTRIBUTE TABLE so that it accurately matches the location of the bomb. The bomberman bomb has a different palette than its explosion (changing the palette in the attribute table). In my demo of the game, the place of the bomb is also copied to RAM variables BombY_Temp and BombX_Temp. Maybe their position would be good to calculate the position of this place on the screen in the Attribute Table? The problem is that one byte (two bits per single 16x16 field) in this array corresponds to four 16x16 pix fields on the screen, I do not know how to calculate it.

I would like some tips on how to make randomly moving opponents. The one I did in this demo came out pretty weak.

Another thing is the best way of animating a background in UNROM (it is not possible to animate the background using CHR bank switching). Originally the code I have under UNROM, but the demo I have now moved to the CNROM where animating the bomb is by switching CHR banks. However, I would prefer UNROM.

Link to an earlier topic where I asked for help with the bomb code.

https://forums.nesdev.com/viewtopic.php?f=10&t=16256

Sample code I used to animate the bomb and its explosion in UNROM:

Unfortunately it overloads the NMI (VBLANK), which crashes in NTSC (in the PAL barely). I have no idea how to do this as efficiently as possible.

Code: Select all

```
Bomb_Anim_no:
RTS
Bomb_Anim: ;in NMI loop
INC Bomb_Anim_Timer ;timer
INC Bomb_Anim_Timer
INC Bomb_Anim_Timer
INC Bomb_Anim_Timer
LDA Bomb_Anim_Timer
CMP #$00
BCC BA_no1
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE1_AddrLO
STA $2006
lda #$10 ;pattern table bgr tile1 nr.
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE2_AddrLO
STA $2006
lda #$11 ;pattern table bgr tile2 nr.
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE3_AddrLO
STA $2006
lda #$20 ;pattern table bgr tile3 nr.
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE4_AddrLO
STA $2006
lda #$21 ;pattern table bgr tile4 nr.
sta $2007
; LDA #$00 ;reset screen (Not needed, there is one at the end of the NMI loop.)
; STA $2006
; LDA #$00
; STA $2006
BA_no1:
LDA Bomb_Anim_Timer
CMP #$40
BCC BA_no2
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE1_AddrLO
STA $2006
lda #$12
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE2_AddrLO
STA $2006
lda #$13
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE3_AddrLO
STA $2006
lda #$22
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE4_AddrLO
STA $2006
lda #$23
sta $2007
; LDA #$00
; STA $2006
; LDA #$00
; STA $2006
BA_no2:
LDA Bomb_Anim_Timer
CMP #$80
BCC BA_no3
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE1_AddrLO
STA $2006
lda #$14
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE2_AddrLO
STA $2006
lda #$15
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE3_AddrLO
STA $2006
lda #$24
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE4_AddrLO
STA $2006
lda #$25
sta $2007
; LDA #$00
; STA $2006
; LDA #$00
; STA $2006
BA_no3:
LDA Bomb_Anim_Timer
CMP #$C0
BCC BA_no4
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE1_AddrLO
STA $2006
lda #$12
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE2_AddrLO
STA $2006
lda #$13
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE3_AddrLO
STA $2006
lda #$22
sta $2007
LDA BOMB_PPU_TILE1_AddrHI
STA $2006
LDA BOMB_PPU_TILE4_AddrLO
STA $2006
lda #$23
sta $2007
; LDA #$00
; STA $2006
; LDA #$00
; STA $2006
BA_no4:
RTS
```