bullets

by circlefriendo

Game: smw

Description: shoot bullets at mario at regular intervals

;; based on:
;;
;; Aimed Bullet/Eerie Generator, by yoshicookiezeus
;; based on mikeyk's generic.asm

    !SpriteToGen        = $1c
    !TimeBetweenSpawns  = $FF 

    !RAM_MarioYPos      = $96
    !RAM_MarioYPosHi    = $97
    !RAM_MarioXPos      = $94
    !RAM_MarioXPosHi    = $95
    !RAM_SpritesLocked  = $9D
    !addr = $0000
	
	
Main:
    LDA $14                     ;\  if not time to spawn sprite
    AND #!TimeBetweenSpawns     ; |
    ORA !RAM_SpritesLocked
    BNE .Return                 ;/  branch
    JSL $02A9DE                 ;\  find empty sprite slot
    BMI .Return                 ;/  if no slot found, return
    TYX        
    
    LDA #!SpriteToGen           ;\  set new sprite number
    STA $7E009E,x                   ;/
    JSL $07F7D2                 ; reset sprite properties
    LDA #$08                    ;\  set new sprite status
    STA $7E14C8,x                 ;/

    LDA !RAM_MarioYPos          ;\ set new sprite y position to Mario y position
    CLC                         ; |
    ADC #$08                    ; |
    STA $7E00D8,x                   ; |
    LDA !RAM_MarioYPosHi        ; |
    ADC #$00                    ; |
    STA $7E14D4,x                 ;/

    LDA !RAM_MarioXPos          ;\ set new sprite x position to Mario x position
    CLC                         ; |
    ADC #$88                    ; |  move bullet to the right of mario
    STA $7E00E4,x                   ; |
    LDA !RAM_MarioXPosHi        ; |
    ADC #$00                    ; |
    STA $7E14E0,x                 ;/

    lda #$01
    sta $7e00c2,x    ; set bullet to move left

    lda #$09          ; play bullet bill noise
    sta $1dfc

    LDA #$DE
    LDX #$C0
    LDY #$DE
    RTL

.Return:
    RTL
back to listings