Patch:Earth Explodes
You just lost The Game.
In Keen 2 if Keen flips a Tantalus ray switch he will trigger the destruction of earth and a Game Over. This is the only way in the Keen Vorticons series to incur a Game Over without losing all your lives. Related patches are Patch:Tantalus ray, Patch:Game over (Vorticons) and Patch:Ending sequence (Keen 2).
When this happens the screen will shake, Keen will say 'oops' and then a view of the Vorticon Mothership firing on earth will occur. When the mothership shot hits the earth, the earth is destroyed in an explosion and hail of sprites.
What makes a Tantalus switch
If a certain tile is located at a certain location relative to a normal switch that switch becomes a 'Tantalus switch' that will cause the Earth to explode when it is flipped. By default tile $01DF needs to be 5 tiles below and 3 right of the switch.
Keen 2
#What makes a switch a 'End the world' switch:
%patch $6443 [$01DFW] #Tile needed
%patch $6429 [$0005W] #Number of tiles below switch tile needs to be
%patch $6437 [$03] #Number of tiles right of switch tile needs to be
No Tantalus switches
This patch makes it so that there is no such thing as a Tantalus switch; all switches behave the same.
Keen 2
#No Tantalus switches
%patch $6445 $90 $90
Screen shake and oops
This section contains patches that relate to the screen shaking and the 'oops' textbox which occurs in the same location Keen was in when he accidentally flips a Tantalus switch.
Skip shake and oops
This patch skips the shake and 'oops' textbox; the game goes straight to the Vortiship firing sequence.
Keen 2
#Skip shake and oops box
%patch $644A $E9 $00A8W
Shake strength
There are two variables that control he severity of the screen shaking. One horizontal, one vertical. The sequence works best when both are the same. The amount of shaking is in tiles * $10, so the default is 4 tiles both ways.
Keen 2
#Screen shake strength
%patch $646D [$0040W] #Horizontal
%patch $6490 [$0040W] #Vertical
No shake
These patches stop the screen shaking. The first holds the screen still for some time while the second simply brings up the 'oops' textbox immediately, no pause.
Keen 2
#No screen shake: long pause
%patch $6493 $90 $90 $90
%patch $6470 $90 $90 $90
#No screen shake: no pause
%patch $6468 $6C
Shake duration
This patch controls how long the screen shakes for. By default this is $50 ticks. The maximum value is $7F ticks, the minimum 1.
Keen 2
#Screen shake duration
%patch $64D2 $50
Text box
This appears after the screen stops shaking, presumably the Tantalus has fired and Keen has realized what he's done.
Keen 2
%patch $64D6 [$0001W] #Oops box bottom
%patch $64DA [$0005W] #Right side
%patch $64E4 [$2CF0W] #Text is read from...
%patch $64ED [$0064W] #Pause before box vanishes\ship fires
#Text
%patch $1A470 "Oops."
No text box
This patch removes the 'oops' textbox entirely leaving just the shaking and then (after a pause) proceeding to the Vortiship firing.
Keen 2
#No 'oops' box
%patch $64D5 $EB $15
Mothership firing sequence
This section contains patches that relate to when the screen fades out and shows the Vorticon Mothership in space, and the ship firing. This happens in level 81.
For 'timer patches' times are in 1/144ths of a second, and cannot be zero.
Mothership
Keen 2
#Level used for earth exploding ($51 = 81 = level81.CK2)
%patch $4BBC [$0051W]
#Times
%patch $64ED [$0064W] #Pause between 'Oops' before going to ship sequence
%patch $4BE3 [$0078W] #Pause between seeing the Vortiship and the Vortiship firing
Ship's shot
This is the (by default green) sprite shot by the mothership which hits the earth.
Keen 2
%patch $4CAE [$3A] #Shot animation
%patch $4CA7 [$02] #Number of animation frames
Keen 2
#Bullet Vortiship shoots is invisible
%patch $4CBD $05
How screen tracks shot
The screen moves to track the shot's path, much like during normal gameplay it tracks Keen. It is possible to alter how closely it tracks. By default it is left and above the shot. There are two values that govern the h or v position of the screen, they add together, thus the two h values are really one value of $FFFFA0 ($60 pixels left of the shot). $10 pixels make up one tile.
Keen 2
#Where screen tracks relative to shot:
%patch $4C85 [$A0] #Horizontal value 1
%patch $4C87 [$FFFFW] #Horizontal value 2
%patch $4C99 [$B0] #Vertical value 1
%patch $4C9B [$FFFFW] #Vertical value 2
Shot path
There are three variables that control the shot's path. They are h\v target, speed and time spent moving.
The first, target consists of four values, two each for the horizontal and vertical target. This is where in the level the shot aims for. By default this is $29000,$11000; it can be seen that two values are 'added' to make the final value. The final values are in pixels. Note the shot target is not the earth explosion location.
The actual values of the target don't really matter as they're affected by the two speed variables which control how fast the shot moves. The smaller the speed value, the faster the shot moves (This is because they are not true speeds, but how often the shot targets are moved towards.) Both of these should be equal, if they aren't the shot's path will be skewed, moving more vertically or horizontally (That is, to make the shot move more horizontally you can decrease the h speed or increase the h target.) Speeds cannot be 0 or the game will crash (in an infinite loop of calling speed.)
The third value is how long the shot moves for; by default it is the same as the speed value, meaning the shot reaches its target. Making this longer means the shot will move for a longer period of time.
It is possible to ignore the shot entirely and just sit at the mothership until the earth explodes.
Keen 2
#Shot path
%patch $4C39 [$0002W] #Vertical target 1
%patch $4C3C [$9000W] #Vertical target 2
%patch $4C61 [$0001W] #Horizontal target 1
%patch $4C64 [$1000W] #Horizontal target 2
%patch $4C2F [$0014W] #V speed
%patch $4C57 [$0014W] #H speed
%patch $4CC8 [$14] #Shot sequence length
Earth Explodes
This is where earth is destroyed; the Mothership shot reaches its target and the 3x3 array of tiles in the level is replaced, along with the creation of a number of earth fragment sprites.
Sound
This is the sound the earth makes when it explodes
Keen 2
#Sound played
%patch $4CCF [$002AW]
#Don't play any sound
%patch $4CD2 $90 $90 $90
Replacement tiles
By default a 3x3 array of tiles is replaced with tile $9B (Blank black) making it look as if the earth has vanished. The values for block height\width are one less than the block width.
Keen 2
%patch $4D2E [$009BW] #Replacement tile
%patch $4D33 [$02] #Height or replacement block
%patch $4D3C [$02] #Width or replacement block
Explosion and fragments
Like the shot path above the target for the explosion and fragment have two variables that add together.
Keen 2
%patch $4CDA $F000W #Fragment h position 1
%patch $4CDF $0002W #Fragment h position 2
%patch $4CE4 $6000W #Fragment v position 1
%patch $4CE9 $0001W #Fragment v position 2
Misc
These patches don't fit into the above categories easily.
Win level after oops
This makes it so that instead of playing the Game Over sequence, the level where the switch has just been pulled will be won after the 'oops' text box; meaning that the player exits the level and it's marked as done.
Keen 2
#Win the level after 'oops'
%patch $64F9 $0001W
When Game Over occurs
This alters when the Game Over occurs, that is, when the sequence ends. The last two patches may be unstable and interfere with others. The first patch ends the sequence as soon as the switch is pulled (This can turn it into a 'win game' switch.), the second after the 'oops' text box, the third when looking at the Vorticon Mothership, and the fourth when the shot hits the earth (but before the earth explodes.)
Keen 2
#Go to Game Over as soon as switch is pulled
%patch $7C97 $90 $90 $90
%patch $841C $90 $90 $90
%patch $8454 $90 $90 $90 $90 $90 $90
%patch $644A $E9 $00A8W
#Go straight to Game Over after 'oops
%patch $4BB3 $C3
#Game ends before Vorticon ship fires
%patch $4CBD $10
#Game over occurs when earth is blowing up,
%patch $4D9F $90