Patch:Seeking Keen

From KeenWiki
Jump to navigation Jump to search

Keen seeking is a trait of many sprites in various Keen games. quite often this is based on a simple check and change; if the sprite is on the left of Keen it turns right, if it is on the right of Keen it turns left. Sometimes it may also check if it is above or below Keen.

Seeking patches then often consist of two values, both of which can have either of three values, $FFFFW (Left), $0000W (Sit sitll), or $0001W (Right). Usually the default patch will contain $FFFFW and $0001W.

To make a Keen seeking sprite flee Keen, simply reverse the two values. To make it move only in one direction, make both values the same. To make the sprite stand still, make one or both of the values zero. This sounds rather limited but in the hands of a capable modder they can be utilized to produce some interesting effects.

An example patch is below, along with some variations. It governs Keen 4's Inchworm's Keen-seeking behavior.

Keen 4

#Inchworm Keen seeking
%patch $10F86 [$FFFFW]
%patch $10F8E [$0001W]

Keen 4

#Inchworm flees Keen
%patch $10F86 [$0001W]
%patch $10F8E [$FFFFW]

Keen 4

#Inchworm can chase Keen left, but if he jumps over it it can't chase him right
%patch $10F86 [$FFFFW]
%patch $10F8E [$0000W]

Keen 4

#Inchworm always moves right
%patch $10F86 [$0001W]
%patch $10F8E [$0001W]


The seeking can be removed entirely by replacing the patch with '$90 $90 $90 $90 $90' at a location three lesss than the seeking patch value Thus our inchworm patch is now:

Keen 4

#Inchworm doesn't seek Keen at all
%patch $10F83 $90 $90 $90 $90 $90
%patch $10F8B $90 $90 $90 $90 $90


Notice $10F86 - 3 = $10F83. It is possible to remove only one seek condition so that a sprite will only look for Keen if he is on one side of it. (This could be used if a sprite appeared to only ever face on way, thus being blind when Keen was behind it.)