Patch:Sneaky Platform (Keen 6)

From KeenWiki
Jump to navigation Jump to search

Platforms in Keen 6 are sprites that Keen can stand on and sometimes be carried places on. This page lists patches relating to a specific Platform sprite, the Sneaky Platform. The page is divided into sections relating to the various sprite properties the patches involved. Being fluent with various sprite patch pages will help when working with these patches.

Patches relating to other Keen 6 platforms can be found at Patch:Platform (Keen 6). Patches relating to the sneaky platform in other Keen games can be found at Patch:Sneaky Platform (Keen 5).

Sprite Type

Sneaky Platforms use type 6, one of the types that lets Keen stand on a sprite. Changing this may make it impossible for Keen to stand on the platforms. The Sneaky Platform uses the same value as all other platforms.

Keen 6

#Sneaky Platform sprite type
%patch $10778 $06

Sprite Actions

The Sneaky Platform has three actions. It is spawned sitting. When Keen attempts to jump on the Sneaky Platform while it is sitting it goes to its fleeing sequence.

The fleeing Platform will turn into a returning Platform after a fixed period of time. The returning Platform will likewise turn into a sitting Platform after the same amount of time, returning the Sneaky Platform to its original position.

$1E8CW #Sneaky Airboard sit
$1EAAW #Sneaky Airboard flee
$1EC8W #Sneaky Airboard return

Keen 6

#Spawn Sneaky Platform
%patch $107A9 {$1E8CW}

#Sneaky Platform sit
%patch $32BD8 {$0000W}

#When Keen tries to jump on Sneaky Platform
%patch $10825 {$1EAAW}

#Sneaky Platform flee
%patch $32BF6 {$1EC8W}

#Sneaky Platform return
%patch $32C14 {$1E8CW}

Sprite Behavior

The Sneaky Platform has only one behavior; that which waits for Keen to try and jump on it then turns it into a fleeing Platform. This is used by the waiting action. The other two actions have no behavior at all; what they do is predetermined.

$0EFC17F7RL #Sneaky platform

Keen 6 Platform behaviors

#Platform wait
%patch $32BCC $0EFC17F7RL

#Platform flee
%patch $32BEA $00000000L

#Platform return
%patch $32C08 $00000000L


The Sneaky Platform's motion is directed entirely by its animation motion. While waiting it is still, while fleeing Keen is has one speed and while returning it has half the opposite speed meaning it will return to its original position. (Since it is given twice as long to return as to flee; see animation section below.)

Animation motion

#Platform wait
%patch $32BC8 [$0000W $0000W]

#Platform flee
%patch $32BE6 [$0020W $0000W]

#Platform return
%patch $32C04 [$FFF0W $0000W]

Sprite Collision

Sneaky Platforms have no sprite collision.

Collision values

Sneaky Platforms have no collision at all. They do not interact with any sprites. (Keen being able to stand on them is part of his collision, not the platform's.) Giving the platform a collision can make them more interesting. (Destructible for instance.)

Keen 6 collision values

#Platform wait
%patch $32BD0 $00000000L

#Platform flee
%patch $32BEE $00000000L

#Platform return
%patch $32C0C $00000000L


The Sneaky Platform uses only one animation by default for all of its frames. 'It's' cache is not however used only by itself; instead it is used by all red platforms. This means that changing it will affect the other red platforms and cause either memory issues or an uncached sprite error. This makes editing the Sneaky Platform's animation difficult.

The Sneaky Platform's animation speeds are of note. The waiting action does not use this but the fleeing and returning actions balance theirs and their speeds. (See section above.) As a result the Platform will flee for a certain time with a certain speed then return with half the speed taking twice as long.

Keen 6

%patch $32436 {$01A8W} #Platforms cache start
%patch $32486 {$01B0W} #Cache end

#Platform wait
%patch $32BBC $01A8W $01A8W
%patch $32BC6 $0000W        #Wait for Keen

#Platform flee
%patch $32BDA $01A8W $01A8W
%patch $32BE4 $0030W        #Fleeing time

#Platform return
%patch $32BF8 $01A8W $01A8W
%patch $32C02 $0060W        #Returning time

Sneaky Platform Activity

The Sneaky Platform must be active when offscreen, so it specifically has its activity variable set to 2. If it is any other value the Platform will stop moving when Keen cannot see it, meaning that they are much, much harder to use. (If for example Keen 'scares' the Platform offscreen it will not return, possibly leaving him stuck.)

Keen 6

#Sneaky  Platform activity variable
%patch $1077D $0002W

Clipping and foreground

The Sneaky Platforms have a foreground variable of 0, meaning they appear behind all sprites and foreground tiles. The clipping is zero by default allowing the Platform to pass through solid tiles. (Changing this has interesting effects.)

Keen 6

#Sneaky Platform foreground variable
%patch $10782 $0000W

#Sneaky Platform clipping variable
%patch $107A6 $0000W

Sprite-tile interaction

The Sneaky Platform does not interact with tiles at all, it can pass right through them. Its tile interaction is simply to ensure it stays visible.

Keen 6

#Platform wait
%patch $32BD4 $08F4180ARL

#Platform flee
%patch $32BF2 $08F4180ARL

#Platform return
%patch $32C10 $08F4180ARL

Action type

The waiting action is type 2 allowing it to respond instantly to Keen. The fleeing and returning actions are type 1 since they must move smoothly back into position.

Keen 6

#Platform wait
%patch $32BC0 [$0002W]

#Platform flee
%patch $32BDE [$0001W]

#Platform return
%patch $32BFC [$0001W]

Deprotect and stick to ground

The Sneaky Platform needs neither of these variables and so both are set to 0 in all its actions.

Keen 6

#Platform wait
%patch $32BC2 [$0000W $0000W]

#Platform flee
%patch $32BE0 [$0000W $0000W]

#Platform return
%patch $32BFE [$0000W $0000W])

Sprite spawn code

There is just one kind of Sneaky Platform. The cache is set in $C7 $06 $CD23W $0001W.

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Platform uses as it proceeds to act in-level. $C7 $06 $xxxxW sets the clipping, $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 $02 $xxxxW sets the sprite activity, $C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, seldom used.) $C7 $47 $0E $xxxxW is the horizontal direction. The Sitting Platform always starts the level moving down but with no horizontal direction.

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

Keen 6 spawn code

#Location of initiation codes
%patch $E9A0 $024EW #Sneaky Platform (At $E66E)

#Sneaky Platform initiation code
%patch $E66E $57 $56 $9A $0EFC17A4RL     $83 $C4 $04 $C7 $06 $CD23W  $0001W
             $E9 $0246W

#Sneaky Platform spawn code
%patch $10764 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL     $83 $C4 $02 $8B $1E
              $66 $A9 $C7 $07 [$0006W]  $C7 $47 $02 [$0002W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $3E $89 $47 $0A $8B $46 $08
              $D3 $E0 $89 $47 $0C $C7 $47 $0E [$0000W]  $C7 $47 $10 [$0001W]  $C7
              $47 $06 [$0000W]  $B8 [$1E8CW]  $50 $53 $9A $08F41219RL     $83 $C4
              $04 $5D $CB