spawner

by circlefriendo

Game: SMW

Description: Summons a configurable sprite

!sprite = $7f9d0a
!time = $7f9d0b
!reserve = $7f9d0c

; https://smwspeedruns.com/Sprites

!mode = $0100
!item_box = $0dc2
!drop_item = $028008

!timer = $7f9d1a

lda !carl_initialized
beq init


lda !timer
sta $0f0d


; only when frame counter = 0
lda $13
and #$1f
bne end


lda !timer
dec
sta !timer
beq go_off

rtl

go_off:
lda !time
sta !timer
sta $0f04

trigger:

; end if not mode $14
lda !mode
eor #$14
bne end


; store current reserve item
lda !item_box
sta !reserve

; spawn sprite from item box
lda !sprite
sta !item_box
jsl !drop_item

; restore reserve item
lda !reserve
sta !item_box

end:

rtl



init:
!goomba = #$9c
lda !goomba
sta !sprite

lda #$10
sta !time
sta !timer

lda #$01
sta !carl_initialized

rtl

back to listings