Patch:Bloog

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Bloogs in Keen 6. Bloogs are the most common enemy, large, green, one-eyed creatures found in most levels. related creatures are Blooglets and Blooguards.


Sprite Type

Bloogs use sprite type 7 which is used only by them and doesn't affect anything else.

Keen 6

#Bloog sprite type
%patch $1083E $07


Sprite Actions

Bloogs are quite simple, action-wise. They have a four frame walk cycle and are spawned walking. They will remain so until shot, at which point they will stun.

Actions:
$1EE6W  #Bloog walking 1
$1F04W  #Bloog walking 2
$1F22W  #Bloog walking 3
$1F40W  #Bloog walking 4
$1F5EW  #Bloog stunned 

Keen 6

#When spawned
%patch $10887 [$1EE6W]

#While walking
%patch $32C32 [$1F04W]
%patch $32C50 [$1F22W]
%patch $32C6E [$1F40W]
%patch $32C8C [$1EE6W]

#When shot
%patch $108DC [$1F5EW]

#While stunned
%patch $32CAA [$1F5EW]


Sprite Behavior

The Bloog has one unique behavior used by its walking frames. When dead it uses a generic 'move through the air' behavior.

Behaviors:
$0EFC18D5RL #Bloog

Keen 6

#Walking Bloog
%patch $32C26 $0EFC18D5RL
%patch $32C44 $0EFC18D5RL
%patch $32C62 $0EFC18D5RL
%patch $32C80 $0EFC18D5RL

#Stunned Bloog
%patch $32C9E $08F41765RL


Walking behavior code

This is the complete code for the Bloog walking. It is relatively simple; 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.

Keen 6

#Bloog walking behavior code
%patch $10895 $55 $8B $EC $56 $8B $76 $06 $9A $1CF30034RL     $3D [$0020W]  {$7D}
              $19 $8B $44 $0A $8B $1E $64 $A9 $3B $47 $0A {$73} $08 $C7 $44 $0E
              [$0001W]  $5E $5D $CB $C7 $44 $0E [$FFFFW]  $5E $5D $CB


Speed and Jump Height

The only speed relevant to the Bloog is its walking speed, controlled by its animation motion.

Animation motion

#Bloog walking speeds
%patch $32C22 [$0080W $0000W]
%patch $32C40 [$0080W $0000W]
%patch $32C5E [$0080W $0000W]
%patch $32C7C [$0080W $0000W]

#When stunned
%patch $32C9A [$0000W $0000W]


Sprite Collision

The Bloog has a single collision that is quite basic, it is lethal, but can be stunned.


Collision values

The Bloog uses a single collision when walking and no collision when it is stunned.

Keen 6

#Walking
%patch $32C2A $0EFC1902RL #Bloog
%patch $32C48 $0EFC1902RL #Bloog
%patch $32C66 $0EFC1902RL #Bloog
%patch $32C84 $0EFC1902RL #Bloog

#Stunned
%patch $32CA2 $00000000L  #Nothing


Collision code

Complete collision code

This is the complete collision code for the Bloog.It is rather simple; on the first line Keen is checked for, if found the 'kill the player' code is run. On the second line Keen's shot is checked for and, if found, the Bloog's action changes to that of the stunned Bloog and the 'destroy shot' code is run.

Keen 6

#Bloog collision code
%patch $108C2 $55 $8B $EC $56 $8B $76 $08 $83 $3C [$02] {$75} $08 $9A $0AA213CARL
                  $5E $5D $CB $83 $3C [$03] {$75} $10 $B8 [$1F5EW]  $50 $56 $FF $76
              $06 $9A $08F41722RL     $83 $C4 $06 $5E $5D $CB


Bloog harmless

This patch makes the Bloog harmless to the player, but still stunnable.

Keen 6

#Bloog harmless
%patch $108CC $EB


Animations

The Bloog's animation is quite straightforward, it uses four images for walking left and right and a fifth frame for when it is stunned. Note that the animation speed affects the Bloog's walking speed.

Keen 6

#Cache
%patch $3242C [$0156W] #Bloog cache start
%patch $3247C [$015EW] #Bloog cache end

#Walking
%patch $32C16 $015AW $0156W
%patch $32C20 $000AW        #Animation speed
%patch $32C34 $015BW $0157W
%patch $32C3E $000AW        #Animation speed
%patch $32C52 $015CW $0158W
%patch $32C5C $000AW        #Animation speed
%patch $32C70 $015DW $0159W
%patch $32C7A $000AW        #Animation speed

#Stunned
%patch $32C8E $015EW $015EW
%patch $32C98 $0000W        #Animation speed


Clipping and foreground

The Bloog has a foreground variable of 0, meaning it appears behind all sprites and foreground tiles. This fits its role as the unobtrusive most common enemy.

Bloog foreground variable

#Bloog foreground variable
%patch $10848 [$0000W]


Sprite-tile interaction

The Bloog uses a generic 'stay on platforms' tile interaction when walking and the 'stunned sprite' interaction when stunned.

Sprite tile interactions

#Walking
%patch $32C2E $08F41831RL
%patch $32C4C $08F41831RL
%patch $32C6A $08F41831RL
%patch $32C88 $08F41831RL

#Stunned
%patch $32CA6 $08F419AFRL


Action type

The Bloog's main actions are quite basic and so are type 0. T move smoothly through the air the stunned Bloog action is type 2.

Sprite action types

#Walking
%patch $32C1A [$0000W]
%patch $32C38 [$0000W]
%patch $32C56 [$0000W]
%patch $32C74 [$0000W]

#Stunned
%patch $32C92 [$0002W]


Deprotect and stick to ground

The Bloog needs to stick to the ground when walking and so uses a value of 1 for this variable in its walking actions.

Sprite deprotect, stick

#Walking
%patch $32C1C [$0000W $0001W]
%patch $32C3A [$0000W $0001W]
%patch $32C58 [$0000W $0001W]
%patch $32C76 [$0000W $0001W]

#Stunned
%patch $32C94 [$0000W $0000W]


Sprite spawn code

In the initiation code notice the Bloog cache being set ($C7 $06 $CD19W $0001W.) Also notice the three difficulties of Bloog that are possible.

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 and $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 Bloog starts the level moving either left or right with a 50:50 chance of either. $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.

Keen 6

#Location of initiation code
%patch $E958 [$00F6W] #Easy Bloog (At $E516)
%patch $E95A [$00ECW] #Medium Bloog (At $E50C)
%patch $E95C [$00E2W] #Hard Bloog (At $E502)

#Bloog initiation code
%patch $E502 $83 $3E {$75A8W}  [$03] {$7D} $03 $E9 $03BBW  $83 $3E {$75A8W}  [$02] {$7D}
             $03 $E9 $03B1W  $57 $56 $9A {$0EFC186ARL}     $83 $C4 $04 $C7 $06
             $CD19W  $0001W  $E9 $039EW

#Bloog spawn code
%patch $1082A $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL     $83 $C4 $02 $8B $1E
              $66 $A9 $C7 $07 [$0007W]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
              $FE00W  $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]  $B8 [$1EE6W]  $50
              $53 $9A $08F41219RL     $83 $C4 $04 $5D $CB