lorom !index = $0E54 !status = $0F86,x !speed = $0FB4,x !speed2 = $0FB6,x !width = $0F82,x ;enemy collision width (1/2 pixel value from center) !height = $0F84,x ;enemy collision height (1/2 pixel value from center) !timer = $0FB2,x !indicator = $0FA8,x ; 0 = no, 1 = on !dir = $0FAA,x org $A0E27F DW $0800,#Palette ;bytes for gfx org $A0E291 DW INIT org $A0E297 DW RUN org $A0E2B5 DL $9A8220 ;grapple gfx, :P org $A6FB72 Palette: DW $3800,$0000,$0000,$0000,$0000,$0000,$0000,$0000 : DW $0000,$0000,$0000,$0000,$0000,$0000,$0000,$6EE0 GFX: DW HORIZONTAL,VERTICAL NOGFX: DW $0001,NULL,$812F NULL: DW $0001 DB $00, $00, $00, $08, $21 HORIZONTAL: DW $0002,HONE DW $0002,HTWO DW $0002,HTHREE DW $0002,HFOUR DW $80ED,HORIZONTAL HONE: DW $0004 DB $F0, $01, $00, $00, $21 DB $F8, $01, $00, $01, $21 DB $00, $00, $00, $02, $21 DB $08, $00, $00, $03, $21 HTWO: DW $0004 DB $F0, $01, $00, $10, $21 DB $F8, $01, $00, $11, $21 DB $00, $00, $00, $12, $21 DB $08, $00, $00, $13, $21 HTHREE: DW $0004 DB $F0, $01, $00, $20, $21 DB $F8, $01, $00, $21, $21 DB $00, $00, $00, $22, $21 DB $08, $00, $00, $23, $21 HFOUR: DW $0004 DB $F0, $01, $00, $30, $21 DB $F8, $01, $00, $31, $21 DB $00, $00, $00, $32, $21 DB $08, $00, $00, $33, $21 VERTICAL: DW $0002,VONE DW $0002,VTWO DW $0002,VTHREE DW $0002,VFOUR DW $80ED,VERTICAL VONE: DW $0004 DB $00, $00, $F0, $04, $21 DB $00, $00, $F8, $14, $21 DB $00, $00, $00, $24, $21 DB $00, $00, $08, $34, $21 VTWO: DW $0004 DB $00, $00, $F0, $05, $21 DB $00, $00, $F8, $15, $21 DB $00, $00, $00, $25, $21 DB $00, $00, $08, $35, $21 VTHREE: DW $0004 DB $00, $00, $F0, $06, $21 DB $00, $00, $F8, $16, $21 DB $00, $00, $00, $26, $21 DB $00, $00, $08, $36, $21 VFOUR: DW $0004 DB $00, $00, $F0, $07, $21 DB $00, $00, $F8, $17, $21 DB $00, $00, $00, $27, $21 DB $00, $00, $08, $37, $21 WIDTH: DW $0020 HEIGHT: DW $0008 DW $0020 INIT: LDX !index ;enemy index STZ $0F90,x ;timer for different actions LDA $0F92,x ;0 = horizonzal, 1 = vertical AND #$0001 STA !dir SAVESPACE: ASL TAY LDA.w GFX,y ;horizontal/vertical STA $0F92,x LDA.w WIDTH,y STA !width LDA.w HEIGHT,y STA !height LDA !speed ;timer for ON BEQ + BRA ++ + LDA #$FFFF ++ STA !timer LDA #$0000 ;when the timer runs off, the game executes DEACTIVATE STA !indicator LDA #$0001 ;Action delay STA $0F94,x RTL RUN: LDX !index LDA !speed2 BEQ LEAVE DEC !timer LDA !timer BEQ $02 BPL LEAVE LDA !indicator ASL TAX JSR (TODO,x) LEAVE: LDA !indicator BNE + LDA #$0007 JSR $80903F + RTL TODO: DW DEACTIVATE DW ACTIVATE DEACTIVATE: LDX !index LDA !status ORA #$2400 STA !status LDA #NOGFX STA $0F92,x LDA #$0001 STA $0F94,x STA !indicator ;when timer runs out, activate LDA !speed2 STA !timer RTS ACTIVATE: LDX !index LDA !status AND #$F0FF STA !status LDA !dir JSL SAVESPACE RTS