And the boss got a bit more lively (visually), it was quite stiff previously. Moving body parts and the head screams (also visually) when getting hurt.
The boss helper code is enhanced by a routine doing circling movements:
jsr GenerateRandomNumber
and #$03bne .DoY
inc SPRITE_MOVE_POS,x
lda SPRITE_MOVE_POS,x
and #$0f
sta SPRITE_MOVE_POS,x
ldy SPRITE_MOVE_POS,x
lda BOSS_DELTA_TABLE_X,y
beq .DoY
sta PARAM1
bmi .Left
.Right
jsr MoveSpriteRight
dec PARAM1
bne .Right
jmp .DoY
.Left
jsr MoveSpriteLeft
inc PARAM1
bne .Left
.DoY
jsr GenerateRandomNumber
and #$03bne .Done
inc SPRITE_MOVE_POS_Y,x
lda SPRITE_MOVE_POS_Y,x
and #$0f
sta SPRITE_MOVE_POS_Y,x
ldy SPRITE_MOVE_POS_Y,x
lda BOSS_DELTA_TABLE_Y,y
beq .Done
sta PARAM1
bmi .Up
.Down
jsr MoveSpriteDown
dec PARAM1
bne .Down
jmp .Done
.Up
jsr MoveSpriteUp
inc PARAM1
bne .Up
.Done
rts
Plus a rather simple swinging table:
BOSS_DELTA_TABLE_X
!byte 0, 1, 0, 1, 1, 0, 1, 0
BOSS_DELTA_TABLE_Y
!byte 0, $ff, 0, $ff, $ff, 0, $ff, 0
!byte 0, 1, 0, 1, 1, 0, 1, 0
To make the boss' head scream we adjust its hurt routine:
;------------------------------------------------------------
;hit behaviour getting hurt
;------------------------------------------------------------
!zone HitBehaviourBoss7
HitBehaviourBoss7
lda #SPRITE_BOSS_HEAD_HURT
sta SPRITE_POINTER_BASE,x
jmp HitBehaviourHurt