Added a first version of Sams dark force, making it visible. It's not looking quite what I wanted it, but it is getting there.
To make things faster for removal of the beam we calc the required length and direction of the beam:
The beam needs to be removed once Sam stops pressing the fire button or he or his enemy dies. Aren't we glad that we already have a back buffer we can use to restore the background properly?
So when Sam dies we modify existing code to:
Voilá! Carnage made more visible ;)
Previous Step Next Step
To make things faster for removal of the beam we calc the required length and direction of the beam:
;redraw black beam ldx PARAM6 ldy SPRITE_CHAR_POS_Y,x dey sty SAM_FORCE_START_Y lda SCREEN_LINE_OFFSET_TABLE_LO,y sta ZEROPAGE_POINTER_1 sta ZEROPAGE_POINTER_2 lda SCREEN_LINE_OFFSET_TABLE_HI,y sta ZEROPAGE_POINTER_1 + 1 clc adc #( ( SCREEN_COLOR - SCREEN_CHAR ) >> 8 ) sta ZEROPAGE_POINTER_2 + 1 ldy SPRITE_CHAR_POS_X,x lda SPRITE_DIRECTION,x sta PARAM1 lda #0 sta SAM_FORCE_LENGTH ldx SPRITE_HELD dex - lda #253 sta (ZEROPAGE_POINTER_1),y lda #6 sta (ZEROPAGE_POINTER_2),y inc SAM_FORCE_LENGTH lda PARAM1 bne ++ iny jmp + ++ dey + tya cmp SPRITE_CHAR_POS_X,x bne - ;store for later removal ldx PARAM6 lda PARAM1 bne + ;going right lda SPRITE_CHAR_POS_X,x sta SAM_FORCE_START_X jmp ++ + ;going left sty SAM_FORCE_START_X inc SAM_FORCE_START_X ++ ldy SPRITE_HELD dey
The beam needs to be removed once Sam stops pressing the fire button or he or his enemy dies. Aren't we glad that we already have a back buffer we can use to restore the background properly?
;restore play field from force beam !zone RemoveForceBeam RemoveForceBeam ldy SAM_FORCE_START_Y lda SCREEN_LINE_OFFSET_TABLE_LO,y sta ZEROPAGE_POINTER_1 sta ZEROPAGE_POINTER_2 sta ZEROPAGE_POINTER_3 sta ZEROPAGE_POINTER_4 lda SCREEN_LINE_OFFSET_TABLE_HI,y sta ZEROPAGE_POINTER_1 + 1 clc adc #( ( SCREEN_COLOR - SCREEN_CHAR ) & 0xff00 ) >> 8 sta ZEROPAGE_POINTER_2 + 1 sec sbc #( ( SCREEN_COLOR - SCREEN_BACK_CHAR ) & 0xff00 ) >> 8 sta ZEROPAGE_POINTER_3 + 1 sec sbc #( ( SCREEN_BACK_CHAR - SCREEN_BACK_COLOR ) & 0xff00 ) >> 8 sta ZEROPAGE_POINTER_4 + 1 ldy SAM_FORCE_START_X - lda (ZEROPAGE_POINTER_3),y sta (ZEROPAGE_POINTER_1),y lda (ZEROPAGE_POINTER_4),y sta (ZEROPAGE_POINTER_2),y iny dec SAM_FORCE_LENGTH bne - rts
So when Sam dies we modify existing code to:
lda SPRITE_HELD beq + jsr RemoveForceBeam lda #0 sta SPRITE_HELD +
Voilá! Carnage made more visible ;)
Previous Step Next Step
Attached Files
-
step68.zip (181.18KB)
downloads: 41
Create a custom theme




