This page contains patches that relate to Keen mooning in Keen 4 and the circumstances under which he does so. The page is divided into two sections, the first deals with what triggers Keen's mooning, including the 'moon tile'; the second section deals with Keen's mooning sprites, their properties, actions and suchlike. Related patches can be found in Patch:Keen (Keen 4), notably those relating to Keen's other bored sequences since those patches can affect his mooning sequence.
While Keen cannot moon in Keen 5 the mooning variable is still in the code. As such this page has a final section dealing with the mooning variable there.
- 1 When Keen moons
- 2 Mooning Keen's sprite
- 3 The mooning variable in other games
When Keen moons
This section contains patches relating to what triggers the mooning sequence. By default this occurs when Keen stands in (Not on.) a tile with a special 'moon property' long enough to display his second bored sequence (Facing the player and shrugging.) However instead of doing this Keen will moon the player.
This can only happen once by default, further attempts will simply play the second bored sequence unless the player dies.
Keen never moons
This patch completely disables mooning. This shouldn't be required if the moon tile property isn't used in a mod.
|Patch: Keen never moons|
The game keeps track of whether Keen can moon via a 'mooning variable'; there are four situations in which is is directly referenced. The first situation is when Keen is bored. If the mooning variable is 1 Keen will moon and set the mooning value to 2. The second situation is when Keen dies; the value is set to 0. The third situation is when Keen steps on a normal tile; if the value is 1 it is set to 0. Finally if Keen steps in a moon tile, if the mooning variable is 0 it will be set to 1.
The variable works as follows: Keen can only moon when the mooning variable is 1. This can only happen if Keen is standing in a mooning tile. If Keen stands in a mooning tile then walks onto a normal tile the mooning value is set to 0, meaning he will not moon on normal tiles.
Once Keen has mooned and the mooning variable is 2, neither standing on a mooning tile or normal tile will change the mooning variable, meaning he can't moon again.
If Keen moons, but then dies, he can stand on a mooning tile again and moon. (Winning or quitting the level also seems to reset mooning.) See also Patch:Game stats and Patch:Jump conditions to make sense of these patches.
Several patches that use these checks follow. They can be combined if desired to make more complex triggers for Keen's mooning.
|Patch: Mooning variable references|
Keen can moon more than once
By default Keen can only moon once. This can be patched, and Keen can moon an indefinite number of times. This works by removing the code that changes the moon variable to 2.
|Patch: Keen can moon as often as he wants|
Dying won't let Keen moon again or stops him mooning
There are two patches in this section. The first patch stops dying from resetting Keen's mooning variable, meaning that if Keen has mooned once in a level, dying will not allow him to repeat it. The second patch makes dying itself set Keen's mooning variable to 2, meaning that if he dies even once in a level he cannot moon in it. This can be used to make mooning even more difficult to activate.
|Patch: Dying won't let Keen moon again|
|Patch: Dying stops Keen mooning|
Moon tiles act as triggers
This patch stops Keen's mooning variable being reset to 0 if he steps off a moon tile without mooning. This means that if Keen has stood on a moon tile then he can moon anywhere in the level, if he hasn't died, by waiting. This allows the moon tile to act as a 'trigger'; if Keen has stood on it his behavior will change.
|Patch: Moon tiles act as triggers|
Moon tiles win the level
This patch makes touching a moon tile win the level. It does this by changing the game stat so that the level state is set to 2 (Win level) if Keen touches a moon tile with a moon variable of 0. Combined with the above patches this can make an alternate exit to the level available only in certain circumstances.
|Patch: Moon tiles win the level|
Moon tiles activate jump cheat
This patch is similar to the above in that it alters a game stat, this time to activate the jump cheat. It can also be made to turn the cheat off.
|Patch: Moon tiles activate jump cheat|
Mooning Keen's sprite
This section deals with the properties of Keen's mooning sprite, its behavior, actions and suchlike. Patches in this section do not alter how Keen starts mooning, but rather what happens when he does or what happens afterwards. The mooning sequence consists of three actions (Using two animations.) that involve Keen mooning the player.
Keen's mooning sequence consists of three consecutive actions. The sequence is started in Keen's bored code, as detailed above. It ends with Keen returning to standing. For a complete list of Keen's actions see Patch:Keen (Keen 4)#Sprite_Actions.
Actions: $0A7CW #Keen moons 1 $0A9AW #Keen moons 2 $0AB8W #Keen moons 3
|Patch: Keen 4|
Keen has too many possible behaviors to list here. However they can be found by clicking this section's title. Mooning Keen uses the same behavior as standing Keen, meaning he waits for arrow\jump\shoot keys to be pressed. This also means that mooning can be interrupted at any time and anything Keen can do while standing he can do while mooning. Replacing the behavior with $00000000L will make mooning uninterruptable. (The player will lose control of Keen.)
|Patch: Mooning Keen behaviors|
Keen uses the same sprite collision while mooning as he does while standing. This allows him to interact with things such as point sprites in his usual manner.
|Patch: Keen 4|
Mooning Keen is still by default, not using any motion.
|Patch: Animation motion|
Two sprite bitmaps are used in three frames. Notice that these frames are not cached with the normal frames; a special 'caching sprite' must be present in the level to activate mooning Keen's cache. Failure to put such a sprite in the level will cause the game to crash with an uncached sprite error.
Alternatively, if the animations are patched to not be the default images but instead be normal player frames then the cache can be abandoned entirely.
|Patch: Mooning Keen animations|
Keen uses his default tile interaction while mooning. This means he acts as if he's standing.
|Patch: Keen 4|
Keen's mooning action is type 3, allowing him to respond instantly to keypresses.
|Patch: Mooning Keen action type|
Keen uses the 'stick to ground' variable so he can moon on slopes and other such tiles.
|Patch: Keen 4|
Keen mooning does not have a spawn code of its own, being part of the player sprite. However the animations used by mooning Keen are not cached with his normal ones. This means a special 'blank' sprite must be placed in levels where mooning occurs for the sole purpose of activating this cache. In the initiation code notice the mooning cache being set ($C7 $06 $CB81W $0001W.)
The mooning activation sprite itself then vanishes from the level as it is not needed.
|Patch: Keen 4|
The mooning variable in other games
While Keen cannot moon by default in Keen 5 or 6 the mooning variable is still in the game's tile code. (However Keen himself lacks any code to make use of the variable.) This variable can therefore be utilized for other purposes.
|Patch: Keen 5 mooning variable references|
|Patch: Keen 6 mooning variable references|