From KeenWiki
Jump to navigation Jump to search

Spindreds are enemies found in Keen 5, aboard the Omegamatic. They are diamond-like beings that bounce on both the floors and the ceilings. They hit a surface three times and then move to the opposite surface, hit it three times, and then come back and do the same again.

Sprite Type

Spindred use sprite type 18 which is used only by the Spindred and doesn't affect anything else.

Keen 5

#Spindred sprite type
%patch $128B1 $12

Sprite Actions

Spindred have four actions, repeating in a loop. They are spawned using the first of these.

$2A7CW #Spindred 1
$2A9AW #Spindred 2
$2AB8W #Spindred 3
$2AD6W #Spindred 4

Keen 5

#When spawned
%patch $128D8 [$2A7CW]

#Bouncing loop
%patch $32DD8 [$2A9AW]
%patch $32DF6 [$2AB8W]
%patch $32E14 [$2AD6W]
%patch $32E32 [$2A7CW]

Sprite Behavior

The Spindred has only one behavior, and it uses this all the time, during all four of its actions.


Keen 5

%patch $32DCC $11C40CA6RL #Spindred 1
%patch $32DEA $11C40CA6RL #Spindred 2
%patch $32E08 $11C40CA6RL #Spindred 3
%patch $32E26 $11C40CA6RL #Spindred 4

Speed and Bounce Height

The only speed that matters to the Spindred are its bounce heights, defined in its code. Animation motion is not used at all. It is also possible to change the direction the Spindred initially moves in (Whether it bounces towards the ceiling or the floor.) This must be +-1, it cannot be 0.

Spindred speeds

#Initial Spindred direction
%patch $128D5 $0001W #(Down)

#Jump heights
%patch $12A65 [$FFD8W] #Small floor jump height
%patch $12A18 [$0028W] #Small ceiling jump height

Animation motion

#Spindred bouncing
%patch $32DC8 [$0000W $0000W]
%patch $32DE6 [$0000W $0000W]
%patch $32E04 [$0000W $0000W]
%patch $32E22 [$0000W $0000W]

Number of bounces on floor and ceiling

This patch controls how many bounces the Spindred will make on the floor or ceiling before it 'reverses direction' Each is a separate patch.

Keen 5

#Number of roof bounces before going to floor:
%patch $129E5 [$0003]

#Number of floor bounces before going to roof:
%patch $12A32 [$0003]

Spindred 'sticks' to floors and ceilings

This patch makes the Spindred appear to not bounce, but instead 'stick' to floors and ceilings for a short time. This is done by making jump heights small so individual jumps aren't seen. The 'stick time' can be made longer by increasing the number of floor or ceiling bounces (See above.)

Spindred 'sticks' to floors and ceilings

#Spindred 'sticks' to floors and ceilings
%patch $12A65 [$FFF8W] #Small floor jump height
%patch $12A18 [$0008W] #Small ceiling jump height

Sprite Collision

The Spindred does not have its own collision, simply using a general 'kill and block shots' collision used by many sprites.

Collision values

The Spindred uses a general collision for everything it does. This collision kills Keen if he touches the Spindred, but also blocks his shots.

Keen 5 collision values

%patch $32DD0 $11C40D61RL #Kill and block shots
%patch $32DEE $11C40D61RL #Kill and block shots
%patch $32E0C $11C40D61RL #Kill and block shots
%patch $32E2A $11C40D61RL #Kill and block shots


The Spindred's animations are quite simple; it has four animations, one for each bouncing action.

Keen 5

%patch $31A46 [$01A8W] #Spindred cache start
%patch $31A9A [$01ABW] #Cache end

#Spindred bounce
%patch $32DBC $01A8W $01A8W
%patch $32DC6 $0008W        #Animation speed
%patch $32DDA $01A9W $01A9W
%patch $32DE4 $0008W        #Animation speed
%patch $32DF8 $01AAW $01AAW
%patch $32E02 $0008W        #Animation speed
%patch $32E16 $01ABW $01ABW
%patch $32E20 $0008W        #Animation speed


The Spindred uses three sounds, produced in four situations. The first sound is used for small floor and ceiling jumps while the remaining two are used when the Spindred 'reverses direction'. It is possible to stop any of these four sounds playing.

Keen 5

#Spindred sounds
%patch $129FC $25 #Spindred slam into ground from roof
%patch $12A0A $1C #Spindred small ceiling bounce
%patch $12A49 $10 #Spindred slam into ceiling from floor
%patch $12A57 $1C #Spindred small floor bounce

#Don't play Spindred sounds
%patch $129FB $EB $0A #Don't play Spindred slam into ground from roof sound
%patch $12A09 $EB $0A #Don't play Spindred small ceiling bounce sound
%patch $12A48 $EB $0A #Don't play Spindred slam into ceiling from floor sound
%patch $12A56 $EB $0A #Don't play Spindred small floor bounce sound

Sprite positioning

The Spindred spawns half a tile up from where it is placed. This si not strictly necessary, but is a cosmetic fix.

Keen 5

#Spindred spawn height
%patch $128CD $FF80W #1/2 tile up

Clipping and foreground

The Spindred has a foreground variable of 0, meaning it appears behind all sprites and foreground tiles. This is likely because it needs to slam into floors and ceilings and thus avoid fore errors.

Spindred foreground variable

#Spindred foreground variable
%patch $128BB $0000W

Sprite-tile interaction

The Spindred has only one tile interaction, and that is the one that makes it bounce off of floors and ceilings. It of course uses this all the time.

Keen 5

%patch $32DD4 $11C40D86RL #Spindred
%patch $32DF2 $11C40D86RL #Spindred
%patch $32E10 $11C40D86RL #Spindred
%patch $32E2E $11C40D86RL #Spindred

Tile Interaction code

This is the complete tile interaction code for the Spindred. It is divided into three parts. The last part draws the Spindred onscreen and is best not messed with.

The first two sections check for ceilings and floors respectively and are identical in structure. On the first line the code checks for a ceiling or floor. If one is not found then the rest of the code section is skipped.

If one is found, the first thing that happens on line 2 is for the Spindred's vertical speed to be set to zero. Next comes a check of the Spindred's vertical direction; the Spindred must be moving upwards ($FF) to properly hit a ceiling and downwards ($01) to properly hit a floor. If it is not, then the rest of the code is skipped.

At the end of the second line the Spindred's 'number of bounces' variable is checked, if it is not exactly three then the next two lines are skipped. Jumping to the start of line 5 the game plays sound $1C. Finally the Spindred's vertical speed is set to $0028W/$FFD8W. (Downwards from ceilings, upwards from floors.)

If the value is $03 then a 'big bounce' is activated. At the start of line 3 the 'number of bounces' variable is reset to zero. The vertical speed is set to $0044W/$FFBCW. (Again downwards from ceilings and upwards from floors.) The Spindred's vertical direction is then flipped. (This is what will make it change from ceilings to floors and vice versa.) Finally sound $25 (ceilings) or $10 (floors) is played and the code skips over the final two lines. (Used for small bounces.)

Keen 5

#Spindred tile interaction code
%patch $129C6 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$3A} [$00] $74 $47 $C7 $44 $18
              [$0000W]  $83 $7C {$10} [$FF] $75 $3C $FF $44 $3E $8B $44 $3E $3D [$0003W]
                  $75 $20 $C7 $44 $3E [$0000W]  $C7 $44 $18 [$0044W]  $8B $44 {$10}
              $F7 $D8 $89 $44 {$10} $B8 [$0025W]  $50 $9A $196E09EFRL     $83 $C4
              $02 $EB $11 $B8 [$001CW]  $50 $9A $196E09EFRL     $83 $C4 $02 $C7
              $44 $18 $0028W

                                          $83 $7C {$36} [$00] $74 $47 $C7 $44 $18
              [$0000W]  $83 $7C {$10} [$01] $75 $3C $FF $44 $3E $8B $44 $3E $3D [$0003W]
                  $75 $20 $C7 $44 $3E [$0000W]  $C7 $44 $18 [$FFBCW]  $8B $44 {$10}
              $F7 $D8 $89 $44 {$10} $B8 [$0010W]  $50 $9A $196E09EFRL     $83 $C4
              $02 $EB $11 $B8 [$001CW]  $50 $9A $196E09EFRL     $83 $C4 $02 $C7
              $44 $18 $FFD8W 

                              $FF $74 $20 $33 $C0 $50 $FF $74 $1E $FF $74 $0C
              $FF $74 $0A $8B $C6 $05 $46 $00 $50 $9A $174E163ERL     $83 $C4
              $0C $5E $5D $CB

Action type

The Spindred uses action type 3 for all its actions; this ensures it can react instantly when needed, but also move smoothly through the air.

Keen 5

%patch $32DC0 [$0003W]
%patch $32DDE [$0003W]
%patch $32DFC [$0003W]
%patch $32E1A [$0003W]

Deprotect and stick to ground

The Spindred has values of 0 for both variables in all its actions. This is because it does not need to move on hills or deprotect its animations.

Keen 5 Change Motion

%patch $32DC2 $0000W $0000W
%patch $32DE0 $0000W $0000W
%patch $32DFE $0000W $0000W
%patch $32E1C $0000W $0000W

Sprite spawn code

Only partial code for the Spindred is available, notice there are three types of Spindred, one for each difficulty. the Spindred cache is set in $C7 $06 $C299W $0001W.

Keen 5

#Location of initiation code
%patch $F55E [$56AW]  #Easy Spindred (At $F2BA)
%patch $F560 [$560W]  #Normal Spindred (At $F2B0)
%patch $F562 [$556W]  #Hard Spindred (At $F2A6)

#Spindred Initiation code
%patch $F2A6 $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $00F7W  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $00EDW  $57 $56 $9A {$11C40C5DRL}     $83 $C4 $04 $C7 $06
             $C299W  $0001W  $E9 $00DAW