Patch:Little Ampton

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Little Amptons in Keen 5. They are small purple robots built by the Shikadi to repair, monitor and adjust various machines on the Omegamatic without their direct involvement. They are notable in being able to flip switches and climb up and down poles.

Sprite Type

Little Amptons use sprite type 14 which is used only by the Little Ampton and doesn't affect anything else.

Keen 5

#Little Ampton sprite type
%patch $11274 $0E

Sprite Actions

The Little Ampton have an extensive set of actions. They are spawned walking, a four frame cycle that they remain in until one of several things happens. If the Ampton reaches the edge of its platform or a wall it will turn, then resume walking. When touching a switch tile the Little Ampton will enter the flip switch sequence, a five frame sequence that again ends with the Ampton resuming walking.

When touching a pole tile the Little Ampton starts the grasp pole sequence, a three frame sequence. The first two frames involve checking whether or not the pole can be climbed and the third involves moving on the pole itself, waiting to stop. The Little Ampton stops climbing poles in two circumstances. The first is when moving up and reaching flat ground (by moving through a pole hole.) and the second is when moving down to flat ground. The stopping sequence is two frames long and ends with the Ampton returning to walking.

There are two walking actions that play the Ampton walking sounds, changing these will change or remove the walking sound pattern. When shot the Little Ampton stuns and then does nothing more.

$21DCW #Lil Ampton walk 1
$21FAW #Lil Ampton walk 2
$2218W #Lil Ampton walk 3
$2236W #Lil Ampton walk 4
$2254W #Lil Ampton turn
$2272W #Lil Ampton start pole slide 1
$2290W #Lil Ampton start pole slide 2
$22AEW #Lil Ampton pole slide
$22CCW #Lil Ampton stop pole slide 1
$22EAW #Lil Ampton stop pole slide 2
$2308W #Lil Ampton flip switch 1
$2326W #Lil Ampton flip switch 2
$2344W #Lil Ampton flip switch 3
$2362W #Lil Ampton flip switch 4
$2380W #Lil Ampton flip switch 5
$239EW #Stunned Ampton

Keen 5

#When spawned
%patch $112BD [$21DCW]

#Walk cycle
%patch $32538 [$21FAW]
%patch $32556 [$2218W]
%patch $32574 [$2236W]
%patch $32592 [$21DCW]

#When at the edge of platforms
%patch $11701 [$2254W]

#After turning
%patch $325B0 [$21DCW]

#When touching a switch tile
%patch $11349 [$2308W]

#Flip switch sequence
%patch $32664 [$2326W]
%patch $32682 [$2344W]
%patch $326A0 [$2362W]
%patch $326BE [$2380W]
%patch $326DC [$21DCW]

#When touching a pole tile
%patch $113E7 [$2272W] #Moving up from pole bottom
%patch $1140D [$2272W] #Moving down from flat ground with pole

#Grasp pole sequence
%patch $325CE [$2290W]
%patch $325EC [$22AEW]
%patch $3260A [$0000W]

#Stop pole climbing when...
%patch $114EC [$22CCW] #Moving up to flat ground
%patch $115E0 [$22CCW] #Moving down to flat ground

#Stop pole climbing sequence
%patch $32628 [$22EAW]
%patch $32646 [$21DCW]

#Actions that play sounds
%patch $112D9 [$21DCW] #Sound 1
%patch $112EE [$2218W] #Sound 2

#When shot
%patch $11688 [$239EW]

#While stunned
%patch $326FA [$0000W]

Sprite Behavior

The Little Ampton has three behaviors. The first is simply walking, this is used by the walking Ampton. The second is sliding on poles. This is used by the Ampton when it is sliding on poles. (No behavior is used when it starts sliding on poles.) The third behavior is used when the Ampton changes tiles. This is used in the last frame of its switch flipping sequence to flip the switch and on the last frame of stopping pole sliding for unknown reasons.

$110202ABRL #Ampton walk
$11020405RL #Ampton pole slide
$11020606RL #Ampton change tiles

Keen 5

%patch $3252C $110202ABRL #Ampton walk
%patch $3254A $110202ABRL #Ampton walk
%patch $32568 $110202ABRL #Ampton walk
%patch $32586 $110202ABRL #Ampton walk

%patch $325A4 $00000000L  #Nothing

#Start pole sliding
%patch $325C2 $00000000L  #Nothing
%patch $325E0 $00000000L  #Nothing

#Pole slide
%patch $325FE $11020405RL #Ampton pole slide

#Stop pole sliding
%patch $3261C $00000000L  #Nothing
%patch $3263A $11020606RL #Ampton check pole/switch

#Flip switches
%patch $32658 $00000000L  #Nothing
%patch $32676 $00000000L  #Nothing
%patch $32694 $00000000L  #Nothing
%patch $326B2 $00000000L  #Nothing
%patch $326D0 $11020606RL #Ampton check pole/switch

%patch $326EE $090B1710RL #Fall

Amptons ignore computer terminals

This patch makes it so that Amptons never fiddle with computer terminals, they walk right by them unaffected.

Ampton ignores computer terminals

#Ampton ignores computer terminals
%patch $11344 $EB

Instead of climbing poles Amptons fly into the air or ground

By default Little Amptons move up or down slightly when they start climbing a pole. This is controlled by altering their action timer. By default this is barely noticeable, 6 i the default value. If this value is made large, say $40 then the Little Ampton will 'climb' several tiles into the air or under the ground even if the pole is not that tall. If it is made very large, say $800 then it will keep moving until it has left the level. This can be controlled separately for upwards or downwards pole movement. If an Ampton is off a pole when its time runs out it will sit in the air, otherwise it will move on the pole normally.

Instead of climbing poles Amptons fly into the air

#Instead of climbing poles Amptons fly into the air or ground
%patch $113F1 $0006W #Up
%patch $11417 $0006W #Down

Ampton cannot move up poles (From pole bottoms)

This patch stops the Little Ampton from starting to climb poles upwards. That is, while it can move up on a pole, it cannot, when walking, grasp a pole at the bottom and start moving upwards. It can however move down poles or, if it reaches the bottom of a pole in midair, reverse direction and move up.

Ampton cannot move up poles (From pole bottoms

#Ampton cannot move up poles (From pole bottoms
%patch $113DF $5F $5E $8B $E5 $5D $CB

Ampton cannot move down poles (From flat ground with poles going through)

This patch stops the Little Ampton from starting to climb poles downwards. That is, while it can move down on a pole, it cannot, when walking, grasp a pole that goes through some solid ground and start moving downwards. It can however move up poles or, if it reaches the top of a pole in midair, reverse direction and move down.

Ampton cannot move down poles (From flat ground with poles going through)

#Ampton cannot move down poles (From flat ground with poles going through)
%patch $113DE $1A

Ampton ignores poles entirely

This patch combines the two above, the Little Ampton will never climb poles at all.

Ampton ignores poles entirely

#Ampton ignores poles entirely
%patch $11345 $05


Currently only the Ampton's animation motion can be patched to any extent. This controls the Ampton's walking speed. The Ampton also changes its vertical direction when starting to climb poles though this has little utility.

Ampton pole moving directions

#Ampton's initial vertical direction
%patch $112BA [$0001W]

#Possible initial horizontal directions (See randomness section below)
%patch $112B1 [$FFFFW] #Left
%patch $112A6 [$0001W] #Right

#Ampton start pole moving vertical directions
%patch $113E2 [$FFFFW] #Move up when starting pole climb from pole bottom
%patch $11408 [$0001W] #Move down when starting pole climb from flat ground with pole through

#Ampton stop moving on pole vertical directions
%patch $114F7 [$0001W] #Moving up to flat ground
%patch $11539 [$FFFFW] #Moving down to flat ground

Animation motion

#Lil Ampton walk
%patch $32528 [$0080W $0000W]
%patch $32546 [$0080W $0000W]
%patch $32564 [$0080W $0000W]
%patch $32582 [$0080W $0000W]

#Ampton turn
%patch $325A0 [$0000W $0000W]

#Start pole sliding
%patch $325BE [$0000W $0000W]
%patch $325DC [$0000W $0000W]

#Pole slide
%patch $325FA [$0000W $0000W]

#Stop pole sliding
%patch $32618 [$0000W $0000W]
%patch $32636 [$0000W $0000W]

#Flip switches
%patch $32654 [$0000W $0000W]
%patch $32672 [$0000W $0000W]
%patch $32690 [$0000W $0000W]
%patch $326AE [$0000W $0000W]
%patch $326CC [$0000W $0000W]

%patch $326EA [$0000W $0000W]

Sprite Collision

The Little Ampton has only one collision, but it is rather complex; it can kill Keen if he is on a pole it is moving on but otherwise only pushes him.

Collision values

The Ampton uses its own special collision for all of its actions. As noted above it is lethal to Keen on poles in certain situations but is otherwise harmless and can be stunned.

Keen 5 collision values

%patch $32530 $11020615RL #Ampton
%patch $3254E $11020615RL #Ampton
%patch $3256C $11020615RL #Ampton
%patch $3258A $11020615RL #Ampton

%patch $325A8 $11020615RL #Ampton

#Start pole slide
%patch $325C6 $11020615RL #Ampton
%patch $325E4 $11020615RL #Ampton

#Pole slide
%patch $32602 $11020615RL #Ampton

#Stop pole slide
%patch $32620 $11020615RL #Ampton
%patch $3263E $11020615RL #Ampton

#Flip switch
%patch $3265C $11020615RL #Ampton
%patch $3267A $11020615RL #Ampton
%patch $32698 $11020615RL #Ampton
%patch $326B6 $11020615RL #Ampton
%patch $326D4 $11020615RL #Ampton

%patch $326F2 $00000000L  #Nothing

Collision code

This is the default Little Ampton sprite collision code. It is rather complex.

The first paragraph deals with colliding with Keen. On the first line Keen's sprite type is checked for. On line 2 the Ampton checks to see if it is sliding on poles (Specifically it checks its own action.) if so it runs the 'kill Keen' code. Otherwise it runs the 'push Keen' code in line three\four.

The second paragraph deals with Keen's shots. The sprite type check is on line five. If a shot is detected the Ampton's clipping is set to 1 (In case it is on a pole where it has no clipping.) On line six its vertical direction is set to 1 (Down.) and its horizontal speed to 0. The page Patch:Galaxy Sprite Parameters is useful for seeing how these variables are identified.

Also on line six sound $21 is played. Finally on line 7 the Ampton's action is changed to that of the stunned Ampton.

Deadly Ampton turns when shot

#Little Ampton default collision code
%patch $11635 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D [$02] {$75} $22 #React to Keen
              $81 $7C {$1C} [$22AEW]  {$75} $09 $9A $0AAF1517RL     $5F $5E $5D $CB #Kill if on poles
              $56 $57 $9A $090B0CD2RL     $83 $C4 $04 $5F $5E $5D $CB $5F $5E
              $5D $CB
                      $83 $3D [$03] {$75} $29 $C7 $44 $06 $0001W  $C7 $44 $10     #React to Keen's shot, clipping
          [$0001W]  $C7 $44 $18 [$0000W]  $B8 [$0021W]  $50 $9A $196E09EFRL     $83 #Speed, play sound
              $C4 $02 $B8 [$239EW]  $50 $57 $56 $9A $090B16CDRL     $83 $C4 $06 #Goto stun
              $5F $5E $5D $CB

Ampton lethal to Keen

This patch removes the action check that makes the Ampton lethal only on poles. The Ampton thus kills Keen whenever Keen touches it.

Ampton lethal to Keen

#Ampton lethal to Keen
%patch $11645 $EB $05

Deadly Ampton that turns when shot

The Ampton is indestructible and will Kill Keen when it touches him, but if Keen shoots it, it will turn around. It can be shot off ledges (It will turn into a pole climbing Ampton, which will be 'stuck'. This can be patched to something like a falling Shelley, avoiding this problem.)

Deadly Ampton turns when shot

#Deadly Ampton turns when shot
%patch $11635 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3D [$02] {$74} $22
              $81 $7C $1C [$0888W]  {$75} $09 $9A $0AAF1517RL     $5F $5E $5D $CB

Harmless Ampton turns when shot or 'pushed' by Keen

This patch is the same as the above patch, but the Ampton doesn't kill Keen, instead Keen running past it, (Like a bullet) will make it turn too.

Harmless Ampton turns when shot or 'pushed' by Keen

#Harmless Ampton turns when shot or 'pushed' by Keen
%patch $11635 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3D [$02] {$74} $22
              $81 $7C $1C [$0888W]  {$75} $09 $90 $90 $90 $90 $90 $5F $5E $5D $CB

Immortal Ampton turns when it touches Keen

This patch is similar to the above patch except that the Ampton will turn when it bumps into Keen. (It can't be pushed off ledges though.) Keen can push past it if he's quick, but if he is stuck behind it is... well stuck (until it walks away.)

Immortal Ampton turns when it touches Keen

#Immortal Ampton turns when it touches Keen
%patch $11635 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3D [$02] {$74} $22
               $81 $7C $1C [$0888W]  {$74} $09 $9A $090B0CD2RL     $5F $5E $5D $CB


The Little Ampton's animations are reasonably straightforward. Eight animations are used when walking, four for each direction. The walking animation speeds affect how fast the Little Ampton walks (See speed section above.) A single animation is used when turning. The turning animation speed determines how long this delays the Ampton.

When pole sliding two animations are used. The first is used for the first frame of starting and the last frame of stopping pole sliding while the second frame is used everywhere else. The animation speeds for starting and stopping determine how long the Little Ampton stops at poles before sliding.

The same two animations used for pole sliding are used when flipping switches in a 1-2-1-2-1 pattern. The animation speeds here determine how long this sequence delays the Ampton, this can be significant. Finally the stunned Ampton uses a single animation.

Keen 5

%patch $31A40 [$0195W] #Ampton cache start
%patch $31A94 [$01A0W] #Cache end

#Little Ampton walk
%patch $3251C $019CW $0195W
%patch $32526 $0008W        #Animation speed
%patch $3253A $019DW $0196W
%patch $32544 $0008W        #Animation speed
%patch $32558 $019EW $0197W
%patch $32562 $0008W        #Animation speed
%patch $32576 $019FW $0198W
%patch $32580 $0008W        #Animation speed

#Ampton turn
%patch $32594 $0199W $0199W
%patch $3259E $0008W        #Animation speed

#Start pole slide
%patch $325B2 $019AW $019AW
%patch $325BC $0008W        #Animation speed
%patch $325D0 $019BW $019BW
%patch $325DA $0008W        #Animation speed

#Pole slide
%patch $325EE $019BW $019BW
%patch $325F8 $0000W        #Wait to find pole ends

#Stop pole slide
%patch $3260C $019BW $019BW
%patch $32616 $0008W        #Animation speed
%patch $3262A $019AW $019AW
%patch $32634 $0008W        #Animation speed

#Ampton flip switch
%patch $32648 $019AW $019AW
%patch $32652 $000CW        #Animation speed
%patch $32666 $019BW $019BW
%patch $32670 $000CW        #Animation speed
%patch $32684 $019AW $019AW
%patch $3268E $000CW        #Animation speed
%patch $326A2 $019BW $019BW
%patch $326AC $000CW        #Animation speed
%patch $326C0 $019AW $019AW
%patch $326CA $000CW        #Animation speed

#Stunned Ampton
%patch $326DE $01A0W $01A0W
%patch $326E8 $0000W        #Animation speed


The Little Ampton has two walking sounds, which are played one after the other near constantly and make the Little Ampton one of the more vocal sprites in the game. Each sound has an associated action, only if the Little Ampton is using that action will the sound play. Changing the $75 to $EB will cause the sound to never play. (See Patch:Jump conditions.)

There is also a sound played when the Little Ampton is stunned.


%patch $112DE $1F #Ampton walk 1
%patch $112F3 $20 #Ampton walk 2

%patch $1167C $21 #Ampton stunned

When to play sounds

#Actions that play sounds
%patch $112D9 [$21DCW] {$75} #Sound 1
%patch $112EE [$2218W] {$75} #Sound 2

#Don't play Ampton stunned sound
%patch $1167B $EB $0A

Sprite positioning

The Little Ampton spawns half a tile (8 pixels) higher than where it is placed. This is vital for allowing it to walk on flat ground.

Keen 5

#Spawn height
%patch $11290 $FF80W #1/2 tile up

Clipping and foreground

The Ampton has a foreground variable of 0, meaning it appears behind all sprites and foreground tiles. This is useful since it needs to move behind tiles when going through solid ground with poles going through it.

Initially the Ampton's clipping is 1, but this cannot be patched. When the Ampton starts pole climbing its clipping is set to 0 so it can move through solid tiles with the pole property, just like Keen. This is set in two places, one for moving up poles and one for moving down. If this is altered the Ampton will have problems with pole sliding. Similarly its clipping is reset to 1 when it stops pole climbing. This is vital, thought it seems to only be set in one place.

Keen 5

%patch $1127E [$0000W] #Ampton

Keen 5

#Start pole climbing clipping
%patch $113EC [$0000W] #Moving up on poles
%patch $11412 [$0000W] #Moving down on poles

#Stop pole climbing clipping
%patch $114E7 [$0001W] #Moving up to flat ground

Sprite-tile interaction

The Little Ampton has only one unique tile interaction, used when walking. This allows it to check for pole and switch tiles and to act appropriately. It uses a generic 'stunned' interaction when shot and otherwise uses a generic 'draw sprite' interaction used by many sprites that pretty much ignores tile properties.

Keen 5

%patch $32534 $11020679RL
%patch $32552 $11020679RL
%patch $32570 $11020679RL
%patch $3258E $11020679RL

%patch $325AC $090B17B5RL

#Start pole slide
%patch $325CA $090B17B5RL
%patch $325E8 $090B17B5RL

#Pole slide
%patch $32606 $090B17B5RL

#Stop pole slide
%patch $32624 $090B17B5RL
%patch $32642 $090B17B5RL

#Flip switches
%patch $32660 $090B17B5RL
%patch $3267E $090B17B5RL
%patch $3269C $090B17B5RL
%patch $326BA $090B17B5RL
%patch $326D8 $090B17B5RL

%patch $326F6 $090B195ARL

Climbing poles, flipping switches

There are two tile types the Ampton interacts with, poles, which it climbs and 'Ampton computer' which is fiddles with. These are actually controlled by the walking Ampton's behavior, not its tile interaction. The two prperties are listed here

Keen 5

#Ampton reacts to 'Ampton computer' tile type:
%patch $11343 $1F

#Ampton reacts to pole tile type:
%patch $11354 $01

Action type

The Little Ampton uses type 0 for all of its actions, making its movement slightly jerky. The exception is using type 2 when stunned (as many stunned sprites do) and using type 4 when moving on poles. (This one cannot be changed without severe changes to how the Little Ampton behaves, it is especially set up to allow the Little Ampton to successfully stop climbing poles.)

Keen 5

%patch $32520 [$0000W]
%patch $3253E [$0000W]
%patch $3255C [$0000W]
%patch $3257A [$0000W]

%patch $32598 [$0000W]

#Start pole slide
%patch $325B6 [$0000W]
%patch $325D4 [$0000W]

#Pole slide
%patch $325F2 [$0004W]

#Stop pole slide
%patch $32610 [$0000W]
%patch $3262E [$0000W]

#Flip switch
%patch $3264C [$0000W]
%patch $3266A [$0000W]
%patch $32688 [$0000W]
%patch $326A6 [$0000W]
%patch $326C4 [$0000W]

%patch $326E2 [$0002W]

Deprotect and stick to ground

The Little Ampton uses its stick to ground value in all its actions except when stunned, sliding on poles and stopping its pole slide. This is odd since it only needs to use this when walking.

Keen 5

%patch $32522 [$0000W $0001W]
%patch $32540 [$0000W $0001W]
%patch $3255E [$0000W $0001W]
%patch $3257C [$0000W $0001W]

%patch $3259A [$0000W $0001W]

#Start pole slide
%patch $325B8 [$0000W $0001W]
%patch $325D6 [$0000W $0001W]

#Pole slide
%patch $325F4 [$0000W $0000W]

#Stop pole slide
%patch $32612 [$0000W $0000W]
%patch $32630 [$0000W $0000W]

#Flick switches
%patch $3264E [$0000W $0001W]
%patch $3266C [$0000W $0001W]
%patch $3268A [$0000W $0001W]
%patch $326A8 [$0000W $0001W]
%patch $326C6 [$0000W $0001W]

%patch $326E4 [$0000W $0000W]

Probability and randomness

The Ampton has a 50/50 chance of initially moving right or left. (See speed section above.) It also seems to have another variable to randomize its pole sliding, though this is unconfirmed.

Keen 5

#Chance of initially moving right:
%patch $1129B $80

#Randomizes pole sliding somehow?
%patch $113CE $80

Sprite spawn code

Notice that there are three Ampton pointers, one for each difficulty level. The cache is set in $C7 $06 $C293W $0001W

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Ampton 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.

$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. The Ampton always starts the level moving down but it has a 50/50 chance of initially moving let or right.

The spawn code contains and is thus incompatible with a number of patches elsewhere on this page.

Keen 5

#Location of initiation code
%patch $F518 [$3F1W]  #Easy Little Ampton (At $F141)
%patch $F51A [$3E7W]  #Normal Little Ampton (At $F137)
%patch $F51C [$3DDW]  #Hard Little Ampton (At $F12D)

#Little Ampton Initiation code
%patch $F12D $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $0270W  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $0266W  $57 $56 $9A {$11020240RL}     $83 $C4 $04 $C7 $06 $C293W
                 $0001W  $E9 $0253W

#Little Ampton spawning code
%patch $11260 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL     $83 $C4 $02 $8B $1E
              $40 $9E $C7 $07 [$000EW]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
              [$FF80W]  $89 $47 $0C $9A $1DFB0036RL     $3D [$0080W]  $7D $0B $8B
              $1E $40 $9E $C7 $47 $0E [$0001W]  $EB $09 $8B $1E $40 $9E $C7 $47
              $0E [$FFFFW]  $8B $1E $40 $9E $C7 $47 $10 [$0001W]  $B8 [$21DCW]  $50
              $53 $9A $090B11C4RL     $83 $C4 $04 $5D $CB