Patch:Spirogrip
Spirogrip are yellow hand-like aliens found on the Omegamatic in Keen 5 with a single, large eye. They will randomly slam into walls and cannot be destroyed.
Sprite Type
Spirogrips use sprite type 13 which is used only by the Spirogrip and doesn't affect anything else.
Keen 5
#Spirogrip sprite type
%patch $127B5 $0D
Sprite Actions
Spirogrip actions are exceedingly complex to understand. Spirogrips are spawned 'pausing'; sitting still before moving away from a wall of some kind. This leads to moving 'reverse down' that is moving upwards. It will then go to spinning.
Spinning is an eight frame cycle that randomly ends when the Spirogrip moves in one of four randomly chosen directions. When moving in any direction the Spirogrip will only stop when it hits a solid tile. When it does so it will reverse away from that tile in one of four 'reversing directions' (just as it was spawned doing.) before pausing, then returning to spinning.
Actions: $2824W #Spirogrip pause down $2842W #Spirogrip reverse down (Move up) $2860W #Spirogrip pause left $287EW #Spirogrip reverse left (Move right) $289CW #Spirogrip pause up $28BAW #Spirogrip reverse up $28D8W #Spirogrip pause right $28F6W #Spirogrip reverse right $2914W #Spirogrip spin 1 $2932W #Spirogrip spin 2 $2950W #Spirogrip spin 3 $296EW #Spirogrip spin 4 $298CW #Spirogrip spin 5 $29AAW #Spirogrip spin 6 $29C8W #Spirogrip spin 7 $29E6W #Spirogrip spin 8 $2A04W #Spirogrip move down $2A22W #Spirogrip move left $2A40W #Spirogrip move up $2A5EW #Spirogrip move right
Keen 5
#Spawn Spirogrip
%patch $127DC [$2824W]
#Spirogrip spin cycle
%patch $32C70 [$2932W]
%patch $32C8E [$2950W]
%patch $32CAC [$296EW]
%patch $32CCA [$298CW]
%patch $32CE8 [$29AAW]
%patch $32D06 [$29C8W]
%patch $32D24 [$29E6W]
%patch $32D42 [$2914W]
#Stop spinning and randomly...
%patch $1282F [$2A04W] #Move down
%patch $1283E [$2A22W] #Move left
%patch $12820 [$2A40W] #Move up
%patch $12811 [$2A5EW] #Move right
#Moving down, hits wall
%patch $32D60 [$2824W]
#Moving left, hits wall
%patch $32D7E [$2860W]]
#Moving up, hits wall
%patch $32D9C [$289CW]
#Moving right, hits wall
%patch $32DBA [$28D8W]
#Spirogrip moves away from a wall it's stuck to:
%patch $32B80 [$2842W] #Spirogrip back up down
%patch $32B9E [$29C8W] #Spirogrip pause down
#Spirogrip moves away from a wall it's stuck to:
%patch $32BBC [$287EW] #Spirogrip back up left
%patch $32BDA [$2914W] #Spirogrip pause left
#Spirogrip moves away from a wall it's stuck to:
%patch $32BF8 [$28BAW] #Spirogrip back up up
%patch $32C16 [$298CW] #Spirogrip pause up
#Spirogrip moves away from a wall it's stuck to:
%patch $32C34 [$28F6W] #Spirogrip back up right
%patch $32C52 [$2950W] #Spirogrip pause right
Sprite Behavior
The only behavior the Spirogrip has is that used for spinning which results in it randomly stopping and moving in a random direction. Everything else is tile interaction.
Behaviors: $11C40BAARL #Spirogrip spin
Keen 5
#Moving away from walls
%patch $32B74 $00000000L #Nothing (down)
%patch $32B92 $00000000L #Nothing
%patch $32BB0 $00000000L #Nothing (Left)
%patch $32BCE $00000000L #Nothing
%patch $32BEC $00000000L #Nothing (Up)
%patch $32C0A $00000000L #Nothing
%patch $32C28 $00000000L #Nothing (Right)
%patch $32C46 $00000000L #Nothing
#Spin
%patch $32C64 $00000000L #Nothing
%patch $32C82 $11C40BAARL #Spirogrip spin
%patch $32CA0 $00000000L #Nothing
%patch $32CBE $11C40BAARL #Spirogrip spin
%patch $32CDC $00000000L #Nothing
%patch $32CFA $11C40BAARL #Spirogrip spin
%patch $32D18 $00000000L #Nothing
%patch $32D36 $11C40BAARL #Spirogrip spin
#Moving
%patch $32D54 $00000000L #Nothing (Down)
%patch $32D72 $00000000L #Nothing (Left)
%patch $32D90 $00000000L #Nothing (Up)
%patch $32DAE $00000000L #Nothing (Right)
Speed
The Spirogrip's speed is entirely defined by its animation motion. It does not move at all when spinning or pausing, but moves quite quickly when moving and moves in reverse when reversing (as expected).
Animation motion
#Spirogrip back away from walls -Down
%patch $32B70 [$0000W $0000W]
%patch $32B8E [$0000W $FFF0W]
#Spirogrip back away from walls -Left
%patch $32BAC [$0000W $0000W]
%patch $32BCA [$0010W $0000W]
#Spirogrip back away from walls -Right
%patch $32BE8 [$0000W $0000W]
%patch $32C06 [$FFF0W $0000W]
#Spirogrip back away from walls -Up
%patch $32C24 [$0000W $0000W]
%patch $32C42 [$0000W $0010W]
#Spirogrip spinning
%patch $32C60 [$0000W $0000W]
%patch $32C7E [$0000W $0000W]
%patch $32C9C [$0000W $0000W]
%patch $32CBA [$0000W $0000W]
%patch $32CD8 [$0000W $0000W]
%patch $32CF6 [$0000W $0000W]
%patch $32D14 [$0000W $0000W]
%patch $32D32 [$0000W $0000W]
#Spirogrip Move Down
%patch $32D50 [$0000W $0030W]
#Spirogrip Move Left
%patch $32D6E [$FFD0W $0000W]
#Spirogrip Move Right
%patch $32D8C [$0030W $0000W]
#Spirogrip Move Up
%patch $32DAA [$0000W $FFD0W]
Sprite Collision
The Spirogrip does not have its own collision; using a generic "Kill and block shots" collision value used by many sprites instead.
Keen 5 collision values
#Spirogrip back away from walls -Down
%patch $32B78 $11C40D61RL #Kill and block shots
%patch $32B96 $11C40D61RL #Kill and block shots
#Spirogrip back away from walls -Left
%patch $32BB4 $11C40D61RL #Kill and block shots
%patch $32BD2 $11C40D61RL #Kill and block shots
#Spirogrip back away from walls -Up
%patch $32BF0 $11C40D61RL #Kill and block shots
%patch $32C0E $11C40D61RL #Kill and block shots
#Spirogrip back away from walls -Right
%patch $32C2C $11C40D61RL #Kill and block shots
%patch $32C4A $11C40D61RL #Kill and block shots
#Spirogrip spinning
%patch $32C68 $11C40D61RL #Kill and block shots
%patch $32C86 $11C40D61RL #Kill and block shots
%patch $32CA4 $11C40D61RL #Kill and block shots
%patch $32CC2 $11C40D61RL #Kill and block shots
%patch $32CE0 $11C40D61RL #Kill and block shots
%patch $32CFE $11C40D61RL #Kill and block shots
%patch $32D1C $11C40D61RL #Kill and block shots
%patch $32D3A $11C40D61RL #Kill and block shots
#Moving Down
%patch $32D58 $11C40D61RL #Kill and block shots
#Moving Left
%patch $32D76 $11C40D61RL #Kill and block shots
#Moving Right
%patch $32D94 $11C40D61RL #Kill and block shots
#Moving Up
%patch $32DB2 $11C40D61RL #Kill and block shots
Animations
The Spirogrip's animations are complex to understand. The spinning cycle uses eight Spirogrip animations sequentially. The spinning animation speed is purely cosmetic. When moving in a given direction the Spirogrip uses one of four movement animations which is also used when it hits a wall and reverses\pauses.
Keen 5
#Cache
%patch $31A3E [$0189W] #Spirogrip cache start
%patch $31A92 [$0194W] #Cache end
#Spirogrip back away from walls -Down
%patch $32B64 $0189W $0189W
%patch $32B6E $0096W #Length of backup
%patch $32B82 $0189W $0189W
%patch $32B8C $0040W #Length of pause before spinning
#Spirogrip back away from walls -left
%patch $32BA0 $018AW $018AW
%patch $32BAA $0096W #Length of backup
%patch $32BBE $018AW $018AW
%patch $32BC8 $0040W #Length of pause before spinning
#Spirogrip back away from walls -up
%patch $32BDC $018CW $018CW
%patch $32BE6 $0096W #Length of backup
%patch $32BFA $018CW $018CW
%patch $32C04 $0040W #Length of pause before spinning
#Spirogrip back away from walls -right
%patch $32C18 $018BW $018BW
%patch $32C22 $0096W #Length of backup
%patch $32C36 $018BW $018BW
%patch $32C40 $0040W #Length of pause before spinning
#Spirogrip spin
%patch $32C54 $018DW $018DW
%patch $32C5E $0008W #Animation speed
%patch $32C72 $0193W $0193W
%patch $32C7C $0008W #Animation speed
%patch $32C90 $018EW $018EW
%patch $32C9A $0008W #Animation speed
%patch $32CAE $0194W $0194W
%patch $32CB8 $0008W #Animation speed
%patch $32CCC $018FW $018FW
%patch $32CD6 $0008W #Animation speed
%patch $32CEA $0191W $0191W
%patch $32CF4 $0008W #Animation speed
%patch $32D08 $0190W $0190W
%patch $32D12 $0008W #Animation speed
%patch $32D26 $0192W $0192W
%patch $32D30 $0008W #Animation speed
#Spirogrip move down
%patch $32D44 $0189W $0189W
%patch $32D4E $0000W #Wait to hit wall
#Spirogrip move left
%patch $32D62 $018AW $018AW
%patch $32D6C $0000W #Wait to hit wall
#Spirogrip move up
%patch $32D80 $018CW $018CW
%patch $32D8A $0000W #Wait to hit wall
#Spirogrip move right
%patch $32D9E $018BW $018BW
%patch $32DA8 $0000W #Wait to hit wall
Sounds
The Spirogrip makes a noise when it stops spinning and also when it hits a wall. (In any direction.) Both sounds can be removed.
Keen 5
#Sounds
%patch $127FC $3D #Spirogrip move sound
%patch $1288F $1B #Spirogrip slam into walls sound
Keen 5
#Sounds
%patch $127FB $EB $0A #Don't play Spirogrip move sound
%patch $1288E $EB $0A #Don't play Spirogrip slam into walls sound
Sprite positioning
The Spirogrip spawns one tile above where it is placed, something unnecessary as it does not need to walk on the ground.
Keen 5
#Spawn height
%patch $127CC $FF00W #1 tile up
Sprite-tile interaction
The Spirogrip has its own special collision used whenever it moves in any direction. This is what causes it to slam into walls. The rest of the time it uses a default 'avoid solid tiles' collision used by many sprites.
Keen 5
#Spirogrip back away from walls -Down
%patch $32B7C $090B17B5RL #Solid
%patch $32B9A $090B17B5RL #Solid
#Spirogrip back away from walls -Left
%patch $32BB8 $090B17B5RL #Solid
%patch $32BD6 $090B17B5RL #Solid
#Spirogrip back away from walls -Up
%patch $32BF4 $090B17B5RL #Solid
%patch $32C12 $090B17B5RL #Solid
#Spirogrip back away from walls -Right
%patch $32C30 $090B17B5RL #Solid
%patch $32C4E $090B17B5RL #Solid
#Spirogrip spinning
%patch $32C6C $090B17B5RL #Solid
%patch $32C8A $090B17B5RL #Solid
%patch $32CA8 $090B17B5RL #Solid
%patch $32CC6 $090B17B5RL #Solid
%patch $32CE4 $090B17B5RL #Solid
%patch $32D02 $090B17B5RL #Solid
%patch $32D20 $090B17B5RL #Solid
%patch $32D3E $090B17B5RL #Solid
#Move Down
%patch $32D5C $11C40C03RL #Spirogrip slam
#Move Left
%patch $32D7A $11C40C03RL #Spirogrip slam
#Move Up
%patch $32D98 $11C40C03RL #Spirogrip slam
#Move Right
%patch $32DB6 $11C40C03RL #Spirogrip slam
Action type
Whenever it does not need to move (spinning, pausing.) the Spirogrip uses action type 0, otherwise it uses type 1.
Keen 5
#Spirogrip back away from walls -Down
%patch $32B68 [$0000W]
%patch $32B86 [$0001W]
#Spirogrip back away from walls -Left
%patch $32BA4 [$0000W]
%patch $32BC2 [$0001W]
#Spirogrip back away from walls -Up
%patch $32BE0 [$0000W]
%patch $32BFE [$0001W]
#Spirogrip back away from walls -Right
%patch $32C1C [$0000W]
%patch $32C3A [$0001W]
#Spirogrip spinning
%patch $32C58 [$0000W]
%patch $32C76 [$0000W]
%patch $32C94 [$0000W]
%patch $32CB2 [$0000W]
%patch $32CD0 [$0000W]
%patch $32CEE [$0000W]
%patch $32D0C [$0000W]
%patch $32D2A [$0000W]
#Spirogrip Move Down
%patch $32D48 [$0001W]
#Spirogrip Move Left
%patch $32D66 [$0001W]
#Spirogrip Move Up
%patch $32D84 [$0001W]
#Spirogrip Move Right
%patch $32DA2 [$0001W]
Deprotect and stick to ground
The Spirogrip does not use either of these values, they are both set to 0 in all its actions.
Keen 5 Change Motion
#Spirogrip back away from walls -Down
%patch $32B6A [$0000W $0000W]
%patch $32B88 [$0000W $0000W]
#Spirogrip back away from walls -Left
%patch $32BA6 [$0000W $0000W]
%patch $32BC4 [$0000W $0000W]
#Spirogrip back away from walls -Right
%patch $32BE2 [$0000W $0000W]
%patch $32C00 [$0000W $0000W]
#Spirogrip back away from walls -Up
%patch $32C1E [$0000W $0000W]
%patch $32C3C [$0000W $0000W]
#Spirogrip spinning
%patch $32C5A [$0000W $0000W]
%patch $32C78 [$0000W $0000W]
%patch $32C96 [$0000W $0000W]
%patch $32CB4 [$0000W $0000W]
%patch $32CD2 [$0000W $0000W]
%patch $32CF0 [$0000W $0000W]
%patch $32D0E [$0000W $0000W]
%patch $32D2C [$0000W $0000W]
#Spirogrip Move Down
%patch $32D4A [$0000W $0000W]
#Spirogrip Move Left
%patch $32D68 [$0000W $0000W]
#Spirogrip Move Up
%patch $32D86 [$0000W $0000W]
#Spirogrip Move Right
%patch $32DA4 [$0000W $0000W]
Probability and randomness
The Spirogrip will randomly go to moving when it is spinning. This has a reasonable chance of happening ($14) which makes the amount of time it spends spinning quite variable. The more this is increased the more 'decisive' the Spirogrip will become.
Keen 5
#Chance of initially moving right:
%patch $127F7 $14
Sprite spawn code
Only partial spawning code is available for the Spirogrip. Notice there are three kinds, one for each difficulty level. The cache is set in $C7 $06 $C291W $0001W.
The last blue highlighted value is the sprite action the Spirogrip uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type,finally $D3 $E0 $05 $xxxxW is how far down (Or more usually up) the sprite is spawned from where it is placed. This isn't really necessary for the Spirogrip, but helps place it in-level.
$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. The Spirogrip starts the level moving down and right.
Keen 5
#Location of initiation code
%patch $F4E4 [$294W] #Easy Spirogrip (At $EFE4)
%patch $F4E6 [$28AW] #Normal Spirogrip (At $EFDA)
%patch $F4E8 [$280W] #Hard Spirogrip (At $EFD0)
#Spirogrip Initiation code
%patch $EFD0 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $03CDW $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $03C3W $57 $56 $9A {$11C40B61RL} $83 $C4 $04 $C7 $06
$C291W $0001W $E9 $03B0W
#Spirogrip spawn code
%patch $127A1 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL $83 $C4 $02 $8B $1E
$40 $9E $C7 $07 [$000DW] $C7 $47 $02 [$0001W] $8B $46 $06 $B1 $08
$D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W] $89 $47 $0C
$C7 $47 $0E [$0001W] $C7 $47 $10 [$0001W] $B8 [$2824W] $50 $53 $9A
$090B11C4RL $83 $C4 $04 $5D $CB