Patch:Blooguard
This page covers patches relating to the Blooguards in Keen 6. Blooguards are large, green, one-eyed,club-carrying creatures found in most levels. related creatures are Blooglets and Bloogs. Blooguards are notable in that when they club the ground Keen is stunned for a short time if also standing on the ground.
Sprite Type
Blooguards use sprite type 24. This is used by no other sprite type and does not affect any other sprite types.
Keen 6
#Blooguard sprite type
%patch $10902 $18
Sprite Actions
Blooguards have an interesting action structure. They are spawned walking, a four frame loop that they will stick in until randomly clubbing when Keen is near. The clubbing sequence is four frames long and ends with the Blooguard returning to walking. When the Blooguard is shot it will stun and stay stunned.
$1F7CW #Blooguard walking 1 $1F9AW #Blooguard walking 2 $1FB8W #Blooguard walking 3 $1FD6W #Blooguard walking 4 $1FF4W #Blooguard clubbing 1 $2012W #Blooguard clubbing 2 $2030W #Blooguard clubbing 3 $204EW #Blooguard clubbing 4 $206CW #Blooguard stunned
Keen 6
#When spawned
%patch $10950 [$1F7CW]
#Walking loop
%patch $32CC8 [$1F9AW]
%patch $32CE6 [$1FB8W]
%patch $32D04 [$1FD6W]
%patch $32D22 [$1F7CW]
#Blooguard slam (Randomly when Keen is near)
%patch $109C4 [$1FF4W]
#Clubbing sequence
%patch $32D40 [$2012W]
%patch $32D5E [$2030W]
%patch $32D7C [$204EW]
%patch $32D9A [$1F7CW]
#When shot
%patch $10A17 [$206CW]
#While stunned
%patch $32DB8 [$206CW]
Sprite Behavior
The Blooguard has two unique behaviors. The first is used when it is walking and allows it to chase Keen and club the ground. The second is used by one of its clubbing frames and stuns Keen. When itself stunned the Blooguard uses a generic 'move through the air' behavior.
Behaviors: $0EFC199ERL #Blooguard walk $0EFC1A09RL #Blooguard club ground
Keen 6
#Walking
%patch $32CBC $0EFC199ERL
%patch $32CDA $0EFC199ERL
%patch $32CF8 $0EFC199ERL
%patch $32D16 $0EFC199ERL
#Clubbing
%patch $32D34 $00000000L
%patch $32D52 $00000000L
%patch $32D70 $0EFC1A09RL
%patch $32D8E $00000000L
#Stunned
%patch $32DAC $08F41765RL
Seeking Keen and when to club
These two patches change when the Blooguard will club the ground. The first allows them to club if Keen is level with them no matter how far away he is. The second lets them club no matter where Keen is.
Keen 6
#Clubs if Keen is level with Guard
%patch $109A9 $90 $90
#Clubs any time, no matter where Keen is
%patch $109B5 $90 $90
Blooguard doesn't club the ground
This patch stops the Blooguard from ever clubbing the ground.
Keen 6
#Blooguard doesn't club the ground
%patch $109B5 $EB
Blooguard walk behavior code
This is the complete behavior code for the Blooguard. On the first line a probability check is performed. If passed the Bloog compares its horizontal position with that of Keen's and turns in his direction on line 3. Following this the Blooguard checks what horizontal direction Keen is facing. First it checks if Keen is facing right then left. For either direction it checks is horizontal position relative to Keen. The end result is it will only proceed if it is behind Keen. On the second to last line it checks to see if it is vertically the same as Keen (Not above or below him) before performing a second probability check which, if passed, changes its action to its first clubbing action.
Keen 6
#Blooguard walking behavior
%patch $1095E $55 $8B $EC $56 $8B $76 $06 $9A $1CF30034RL $3D [$0020W] $7D
$18 $8B $44 $0A $8B $1E $64 $A9 $3B $47 $0A {$73} $07 $C7 $44 $0E
[$0001W] $EB $05 $C7 $44 $0E [$FFFFW] $83 $7C {$0E} [$01] {$75} $0C $8B
$44 $0A $8B $1E $64 $A9 $3B $47 {$0A $72} $12 $83 $7C {$0E} [$FF] {$75}
$27 $8B $44 $0A $8B $1E $64 $A9 $3B $47 {$0A $76} $1B $8B $44 $28
$8B $1E $64 $A9 $3B $47 {$28 $75} $0F $9A $1CF30034RL $3D [$0020W]
{$7D} $05 $C7 $44 $1C [$1FF4W] $5E $5D $CB
Speed
The only speed relevant to the Blooguard is its walking speed, defined in its animation motion. The Blooguard also has a random horizontal direction when spawned. (And moves down for some reason.)
Molly's initial directions
%patch $10934 [$0001W] #Initially move right
%patch $1093F [$FFFFW] #Or left
%patch $10948 [$0001W] #And down
Animation motion
#Walking
%patch $32CB8 [$0080 $0000W]
%patch $32CD6 [$0080 $0000W]
%patch $32CF4 [$0080 $0000W]
%patch $32D12 [$0080 $0000W]
#Clubbing
%patch $32D30 [$0000W $0000W]
%patch $32D4E [$0000W $0000W]
%patch $32D6C [$0000W $0000W]
%patch $32D8A [$0000W $0000W]
#Stunned
%patch $32DA8 [$0000W $0000W]
Sprite positioning
The Blooguard is spawned two and a half tiles off the ground by default.
Keen 6
#Blooguard's spawn height
%patch $1091E [$FD80W]
Sprite Collision
The Blooguard's collision is quite basic, it is lethal to Keen, but can be stunned. Notably however it takes several shots to tun.
Collision values
The Blooguard uses the same collision for all its actions except when stunned.
Keen 6 collision values
#Walking
%patch $32CC0 $0EFC1A37RL #Blooguard
%patch $32CDE $0EFC1A37RL #Blooguard
%patch $32CFC $0EFC1A37RL #Blooguard
%patch $32D1A $0EFC1A37RL #Blooguard
#Clubbing
%patch $32D38 $0EFC1A37RL #Blooguard
%patch $32D56 $0EFC1A37RL #Blooguard
%patch $32D74 $0EFC1A37RL #Blooguard
%patch $32D92 $0EFC1A37RL #Blooguard
#Stunned
%patch $32DB0 $00000000L #Nothing
Collision code
This is the complete code for the Blooguard's only collision. On the first line it checks for Keen's sprite type and if found runs he 'kill the player' code. On line 2 it checks for Keen's shot type. If this is detected it checks whether the sprite's strength is at zero. If so the sprite's action changes to 'stunned Blooguard' If not then the 'hit flash' code is called.
Keen 6
#Blooguard's collision code
%patch $109F7 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D [$02] {$75} $05
$9A $0AA213CARL $83 $3D [$03] {$75} $2A $FF $4C [$40] {$75} $12 $B8
[$206CW] $50 $57 $56 $9A $08F41722RL $83 $C4 $06 $5F $5E $5D
$CB $C7 $44 $3E [$0002W] $C7 $44 $04 [$0001W] $57 $9A $0CA60EC2RL
$83 $C4 $02 $5F $5E $5D $CB
Blooguard doesn't flash when shot
This patch stops the Blooguard from flashing white when shot but not stunned.
Keen 6
#Blooguard doesn't flash when shot
%patch $10A28 $EB $03
Sprite strength
The Blooguard takes three hits to stun.
Sprite strength
#Blooguard's strength
%patch $1094D [$0003W]
Animations
The Blooguard's animations are quite straightforward; eight are used for walking and eight more for clubbing, with one left over for being stunned. Note that the walking animation speeds affect the Blooguard's walking speed, and its clubbing animation speeds affect how long this action takes.
Keen 6 Animations
#Cache
%patch $32440 [$00FEW] #Blooguard cache start
%patch $32490 [$010CW] #Blooguard cache end
#Walking
%patch $32CAC $00FEW $0102W
%patch $32CB6 $0009W #Animation speed
%patch $32CCA $00FFW $0103W
%patch $32CD4 $0009W #Animation speed
%patch $32CE8 $0100W $0104W
%patch $32CF2 $0009W #Animation speed
%patch $32D06 $0101W $0105W
%patch $32D10 $0009W #Animation speed
#Clubbing
%patch $32D24 $0106W $0109W
%patch $32D2E $001EW #Animation speed
%patch $32D42 $0107W $010AW
%patch $32D4C $0009W #Animation speed
%patch $32D60 $0108W $010BW
%patch $32D6A $0001W #Animation speed
%patch $32D7E $0108W $010BW
%patch $32D88 $0009W #Animation speed
#Stunned
%patch $32D9C $010CW $010CW
%patch $32DA6 $0000W #Animation speed
Sprite positioning
The Blooguard spawns 2.5 tiles higher then where it is placed in-level. This must be changed with its sprite height as it is used to make the Blooguard move along the ground.
Keen 6
#Blooguard spawn height
%patch $1091E [$FD80W] #2.5 tiles upwards
Sounds
The Blooguard makes a sound when clubbing the ground\stunning Keen.
Keen 4
#Keen stunned by Blooguard sound
%patch $109CD [$34]
#Don't play Keen stunned by Blooguard sound
%patch $109CC $EB $0A
Clipping and foreground
The Blooguard uses a value of 0 for its foreground variable, placing it behind other sprites and all foreground tiles.
Keen 6 Foreground
#Blooguard foreground variable
%patch $1090C [$0000W]
Sprite-tile interaction
The Blooguard uses a general 'stay on platforms and flash when stunned' tile interaction also used by other sprites such as the Nospike. The only exception is its stunned frame which uses the general 'Stunned sprite' interaction.
Keen 6
#Walking
%patch $32CC4 $0EFC1A7FRL
%patch $32CE2 $0EFC1A7FRL
%patch $32D00 $0EFC1A7FRL
%patch $32D1E $0EFC1A7FRL
#Clubbing sequence
%patch $32D3C $0EFC1A7FRL
%patch $32D5A $0EFC1A7FRL
%patch $32D78 $0EFC1A7FRL
%patch $32D96 $0EFC1A7FRL
#While stunned
%patch $32DB4 $08F419AFRL
Probability and randomness
The Blooguard has a certain probability of clubbing the ground when Keen is in range. This is about 1/8 (Max value $FF). It also has a 50:50 chance of moving right or left when spawned.
Keen 6 randomness
#Chance of clubbing ground (When Keen around)
%patch $109BD [$20]
#Chance of initially moving right
%patch $10929 [$80]
Action type
The Blooguard's actions are all quite basic and thus type 0. The exception is the Blooguard being stunned, which requires it to move through the air smoothly. This is type 2.
Sprite action types
#Walking
%patch $32CB0 [$0000W]
%patch $32CCE [$0000W]
%patch $32CEC [$0000W]
%patch $32D0A [$0000W]
#Clubbing sequence
%patch $32D28 [$0000W]
%patch $32D46 [$0000W]
%patch $32D64 [$0000W]
%patch $32D82 [$0000W]
#While stunned
%patch $32DA0 [$0002W]
Deprotect and stick to ground
The Blooguard needs to stick to the ground while walking and thus uses a value of 1 for this variable in its walking actions, as well as when clubbing.
Sprite deprotect, stick
#Walking
%patch $32CB2 [$0000W $0001W]
%patch $32CD0 [$0000W $0001W]
%patch $32CEE [$0000W $0001W]
%patch $32D0C [$0000W $0001W]
#Clubbing sequence
%patch $32D2A [$0000W $0001W]
%patch $32D48 [$0000W $0001W]
%patch $32D66 [$0001W $0001W]
%patch $32D84 [$0000W $0001W]
#While stunned
%patch $32DA2 [$0000W $0000W]
Sprite spawn code
Only partial spawning code for the Blooguard is available.
In the spawning code the last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.
The Blooguard always starts the level moving down, moving in a random horizontal direction. $C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction.
$C7 $47 $40 $0003W is the sprite's strength, 3 hits in the Blooguard's case.
Keen 6
#Blooguard spawning code
%patch $108EE $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E
$66 $A9 $C7 $07 [$0018W] $C7 $47 $02 [$0001W] $C7 $47 $20 [$0000W]
$8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
[$FD80W] $89 $47 $0C $9A $1CF30034RL $3D [$0080W] $7D $0B $8B
$1E $66 $A9 $C7 $47 $0E [$0001W] $EB $09 $8B $1E $66 $A9 $C7 $47
$0E [$FFFFW] $8B $1E $66 $A9 $C7 $47 $10 [$0001W] $C7 $47 $40 [$0003W]
$B8 [$1F7CW] $50 $53 $9A $08F41219RL $83 $C4 $04 $5D $CB