Patch:Sneaky Platform (Keen 5)

From KeenWiki
Jump to navigation Jump to search

Platforms in Keen 5 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 5 platforms can be found at Patch:Platform (Keen 5). Patches relating to the sneaky platform in other Keen games can be found at Patch:Sneaky Platform (Keen 6).


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 5

#Sneaky Platform sprite type
%patch $10E05 $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.

Actions:
$1DA4W #Sneaky Platform sit
$1DC2W #Sneaky Platform flee
$1DE0W #Sneaky Platform return

Keen 5

#Spawn Sneaky Platform
%patch $10E36 {$1DA4W}

#Sneaky Platform sit
%patch $32100 {$0000W}

#When Keen tries to jump on Sneaky Platform
%patch $10EB2 {$1DC2W}

#Sneaky Platform flee
%patch $3211E {$1DE0W}

#Sneaky Platform return
%patch $3213C {$1DA4W}


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.

Behaviors:
$0F921524RL #Sneaky platform

Keen 5 Platform behaviors

#Platform wait
%patch $320F4 $0F921524RL

#Platform flee
%patch $32112 $00000000L

#Platform return
%patch $32130 $00000000L


Speed

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 $320F0 [$0000W $0000W]

#Platform flee
%patch $3210E [$0020W $0000W]

#Platform return
%patch $3212C [$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 5 collision values

#Platform wait
%patch $320F8 $00000000L

#Platform flee
%patch $32116 $00000000L

#Platform return
%patch $32134 $00000000L


Animations

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 5

#Cache
%patch $31A4A {$01BEW} #Red platforms cache start
%patch $31A9E {$01BEW} #Cache end

#Platform wait
%patch $320E4 $01BEW $01BEW
%patch $320EE $0000W        #Wait for Keen

#Platform flee
%patch $32102 $01BEW $01BEW
%patch $3210C $0030W        #Fleeing time

#Platform return
%patch $32120 $01BEW $01BEW
%patch $3212A $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 5

#Sneaky  Platform activity variable
%patch $10E0A $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 5

#Sneaky Platform foreground variable
%patch $10E0F $0000W

#Sneaky Platform clipping variable
%patch $10E33 $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 5

#Platform wait
%patch $320FC $090B17B5RL

#Platform flee
%patch $3211A $090B17B5RL

#Platform return
%patch $32138 $090B17B5RL


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 5

#Platform wait
%patch $320E8 [$0002W]

#Platform flee
%patch $32106 [$0001W]

#Platform return
%patch $32124 [$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 5

#Platform wait
%patch $320EA [$0000W $0000W]

#Platform flee
%patch $32108 [$0000W $0000W]

#Platform return
%patch $32126 [$0000W $0000W])


Sprite spawn code

There is just one kind of Sneaky Platform. The cache is set in $C7 $06 $C29DW $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 5 spawn code

#Location of initiation codes
%patch $F514 [$3A4W] #Sneaky Platform (At $F0F4)

#Sneaky Platform initiation code
%patch $F0F4 $57 $56 $9A {$0F9214D1RL}     $83 $C4 $04 $C7 $06 $C29DW  $0001W
             $E9 $02A0W

#Sneaky Platform spawn code
%patch $10DF1 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL    $83 $C4 $02 $8B $1E
              $40 $9E $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 [$1DA4W]  $50 $53 $9A $090B11C4RL    $83 $C4
              $04 $5D $CB