Patch:Keen jumping (Vorticons)
This page contains patches relating to the player jumping in Keen Vorticons. This is a complex action with many intricacies. Broadly jumping can be divided into three sections, preparing to jump, jumping and falling through the air. More patches affecting the player can be found at Patch:Keen (Keen 1), Patch:Keen (Keen 2) and Patch:Keen (Keen 3). Closely related to jumping is walking.
Falling is a continuation of jumping and so is also treated here.
Sprite Behavior
Keen's jump behavior is triggered in two distinct situations. The first is when standing\walking on solid ground. The second is more cryptic, it triggers when Keen is standing, walking or something similar; but not on solid ground. In Keen 2\3 this happens when Keen is on moving platforms. In all three Vorticons episodes this can also happen if Keen is just landing with his pogo equipped but then stops it and jumps. (A tricky maneuver.)
Keen exits jumping by going to the falling behavior; though this is a bit disingenuous. When Keen goes to falling he in fact releases all his jump speeds, meaning he is moving up in the air. (The actual jump behavior will only get him 3 pixels off the ground.)
#When Keen uses his jump code
%patch $3AE8 {$3B8BW} #Jump on solid ground
%patch $3913 {$3B8BW} #Jump when pogo landing
#After jumping Keen falls
%patch $3C2D {$3C99W}
#When Keen uses his jump code
%patch $692A {$69CDW} #Jump on solid ground
%patch $6755 {$69CDW} #Jump when on moving platforms or pogo landing
#After jumping Keen falls
%patch $6A6F {$6ADBW}
#When Keen uses his jump code
%patch $718E {$7230W} #Jump on solid ground
%patch $67B5 {$7230W} #Jump when on moving platforms, ball or pogo landing
#After jumping Keen falls
%patch $72DA {$7344W}
The pre-jump pause
As noted above, Keen's jump speeds are mainly effective after he has stopped jumping, when he is using falling code. The jump itself is quite short, (24 tics by default,) and is used to build up vertical speed as well as play the jumping animation sequence. (These are explained in the following sections.
Changing the length of the pre-jump pause will drastically affect the jump, so care should be taken.
The pre-jump pause
#Keen's pre-jump pause - Keen 1
%patch $3C25 [$0024W] {$7C}
#Keen's pre-jump pause - Keen 2
%patch $6A67 [$0024W] {$7C}
#Keen's pre-jump pause - Keen 3
%patch $72D3 [$24] {$7C}
Keen jumps instantly
This patch allows Keen to jump (nearly) as soon as the jump key is pressed. This actually reduces the pre-jump pause to 4 tics, about 10% of its normal length. The jump height is then increased to compensate for this. The animations are not changed however which means that using this patch Keen will use only one frame when jumping instead of 6.
The pre-jump pause
#Keen jumps instantly - Keen 1
%patch $3C25 [$0004W] $7C
%patch $3BAC [$0023W]
#Keen jumps instantly - Keen 2
%patch $6A67 [$0004W] {$7C}
%patch $69EE [$0023W]
#Keen jumps instantly - Keen 3
%patch $72D3 [$04] {$7C}
%patch $7251 [$0023W]
Vertical and horizontal jump speeds\height
Keen's jump speeds are curious and complex. When jumping left or right a check is made on Keen's horizontal speed. If his speed is less than a certain amount (by default his walking speed.) then he will have his jump speed set to a certain value; otherwise he will use his current horizontal speed. What this means is that is Keen is moving slower than he can walk he will jump as fast as he can walk; but if he is moving faster than he can walk (for example, when slipping on ice.) he will jump at that faster speed instead. See Patch:Jump conditions.
Changing the checks ($7E\$7D) to $90 $90 will make all of Keen's jumps the same horizontal speed. The checks will have to be changed if Keen's walking speeds are altered.
Keen's jump height as it is set by default is twice the number of tiles he can jump. (It is 6, he can jump 3 tiles high.) However it is also affected by the length of his pre-jump pause; if this is made longer he will jump higher, if it is made shorter he will jump lower. This must be taken into account if the pause is altered. (See section above.)
Keen's jump height - Keen 1
#Jumping right speed
%patch $3BEF [$78] {$7E} #If <= to...
%patch $3BF6 [$0078W] #Set to
#Jumping left speed
%patch $3C0B [$88] {$7D} #If <= to...
%patch $3C12 [$FF88W] #Set to
#Jump height in half tiles
%patch $3BAC [$0006W]
Keen's jump height - Keen 2
#Jumping right speed
%patch $6A31 [$78] {$7E} #If <= to...
%patch $6A38 [$0078W] #Set to
#Jumping left speed
%patch $6A4D [$88] {$7D} #If <= to...
%patch $6A54 [$FF88W] #Set to
#Jump height in half tiles
%patch $69EE [$0006W]
Keen's jump height - Keen 3
#Jumping right speed
%patch $7296 [$78] {$7E} #If <= to...
%patch $729D [$0078W] #Set to
#Jumping left speed
%patch $72B4 [$88] {$7D} #If <= to...
%patch $72BB [$FF88W] #Set to
#Jump height in half tiles
%patch $7251 [$0006W]
Animations
There are two types of animation involved in jumping; starting and actual. The starting animations are set before Keen jumps and should match those of the actual jumping animations to ensure a smooth jump.
When jumping Keen's animations depend heavily on the pre-jump pause length. (See section above.) By default the initial left\right animation is set, as well as an animation speed, and the number of frames used is the pause length divided by the animation speed. By default the pause is $24 long and the animation speed is 6. (36/6 = 6 frames are used.)
Thus the simplest way to make Keen use less animation frames when jumping is to increase the animation speed (so it takes longer per frame.)
Keen's jump animations
#Jumping animations - Keen 1
%patch $3905 [$0008W] #Jumping right start
%patch $390D [$000EW] #Jumping left start
%patch $3ADA [$0008W] #Jumping right
%patch $3AE2 [$000EW] #Jumping left
%patch $3B92 [$0006W] #Animation speed
#Jumping animations - Keen 2
%patch $691D [$0008W] #Jumping right
%patch $6925 [$000EW] #Jumping left
%patch $69D4 [$0006W] #Animation speed
#Jumping animations - Keen 3
%patch $7180 [$0008W] #Jumping right
%patch $7188 [$000EW] #Jumping left
%patch $7237 [$0006W] #Animation speed
Sounds
Keen makes a sound when jumping. It can be blocked.
Keen 1's jump sound
#Keen jump sound
%patch $3C3D $06
#Keen jump sound disabled
%patch $3C3C $EB $07
Keen 2's jump sound
#Keen jump sound
%patch $6A7F $06
#Keen jump sound disabled
%patch $6A7E $EB $07
Keen 3's jump sound
#Keen jump sound
%patch $72EA $06
#Keen jump sound disabled
%patch $72E9 $EB $06