Patch:Keen's shot (Vorticons)
In Keen Vorticons Keen's shot is a purple line of energy that can be shot left or right while Keen is standing, jumping or on a pogoing. Its behavior is near identical across all three Vorticons episodes and so all three are treated here. Patches for individual episodes that relate to the player can be found at Patch:Keen (Keen 1), Patch:Keen (Keen 2) and Patch:Keen (Keen 3).
This page deals only with the shot once it is produced, as well as the process of creating it. It does not contain patches relating to the player, such patches can be found on Patch:Keen shooting (Vorticons), which deals with when and how the player produces the shot. As an example, this page will contain patches for the shooting sound and shot directions, while the other page will contain patches relating to disabling shooting, having a machine gun or the player's shooting animations.
Keen's shot's properties
There are five basic properties of Keen's shot that can be altered, its animation, sprite type, vertical speed and its left/right speeds.
Keen's shot uses only one animation by default, the same no matter what direction it moves in. Changing it should often be unnecessary. Likewise the shot's sprite type is a special one that kills enemies, if changed it becomes harmless to them so shouldn't be tinkered with. The most useful things to alter are the horizontal speeds, making the shot faster or slower. (Or even sit still!)
Also of note is the shot's behavior (usually the same as enemy shots) and collision.
Keen 1 shot properties
#Keen's shot properties
%patch $46C5 [$000AW] #Sprite type
%patch $46EE [$0000W] #Vertical speed
%patch $46F8 [$006CW] #Animation
%patch $4704 [$0190W] #Right speed
%patch $4779 [$FE70W] #Left speed
%patch $46E9 [$4808W] #Behavior
%patch $47F3 [$4849W] #Collision
Keen 2 shot properties
#Keen's shot properties
%patch $7424 [$000AW] #Sprite type
%patch $744D [$0000W] #Vertical speed
%patch $7457 [$007AW] #Animation
%patch $7463 [$0190W] #Right speed
%patch $74D8 [$FE70W] #Left speed
Keen 3 shot properties
#Keen's shot properties
%patch $7CE3 [$000FW] #Sprite type
%patch $7D0C [$0000W] #Vertical speed
%patch $7D16 [$0066W] #Animation
%patch $7D22 [$0190W] #Right speed
%patch $7D95 [$FE70W] #Left speed
Complete shot creation code
This is the complete shot creation code that results in the production of a single shot. It is quite complex.
On the first line the shot is created and its sprite type set. ($000FW, changing this makes Keen's shots harmless to enemies.) On the third line the vertical position (9 pixels down from the top of Keen) is set and the shot's behavior.
On the fourth line the vertical speed is set (no vertical speed.), as well as the shot collision and animation.
Until this point all code was for both left and right moving shots. Line 5 checks the player's direction and splits the code into that for right moving and left moving shots. (This is marked in brown, replacing the two bytes with $90 $90 will make Keen always shoot right.) At the end of the first line of the right shot code the right shot's horizontal speed is set.
The code for the right shot takes up the next seven lines. On lines 2-4 the game checks to see if Keen is firing against a wall. If he is then a shot will not be created, instead a special zap\zot sprite is created.
The first thing to happen is sound $0025 is played, in line 4. In line 5 the shot's type s changed to $0012W and its behavior to that of a zap\zot. (Pause then vanish.) On the next line the animation timer is set to 0 and a random check is performed and a zap or zot animation assigned depending on the result.
The first line of the left moving shot code sets its horizontal speed, the next three lines check again to see if Keen is shooting against a wall, if so another zap\zot sprite is created instead of a shot. The variables here work exactly the same as for the right moving shot. This leads to the end of the code.
Keen 1
#Keen make shot code - all shot properties
%patch $46BA $55 $8B $EC $56 $E8 $E274W $8B $F0 $C7 $04 [$000AW] $8B $46 $06 #Set shot sprite type
$8B $56 $04 $89 $54 $04 $89 $44 $06 $8B $46 $0A $8B $56 $08 $81
$C2 $00 [$09] $15 [$0000W] $89 $54 $08 $89 $44 $0A $C7 $44 $32 {$4808W} #Set shot behavior, vertical position
$C7 $44 $22 [$0000W] $C7 $44 $34 {$4849W} $C7 $44 $28 [$006CW] #Set vertical speed, collision and animation
$83 $3E $4C $60 $00 {$7C $75}
#Right moving shot
%patch $4701 $C7 $44 $20 [$0190W] $8B $56 $06 $8B #Set right shot's speed
$46 $04 $B1 $0C $E8 $9A61W $8B $56 $0A $50 $8B $46 $08 $B1 $0C
$E8 $9A55W $05 $0001W $83 $D2 $00 $50 $A1 $6C08W $52 $99 $59
$5B $E8 $9E35W $5A $03 $D0 $42 $D1 $E2 $C4 $1E $48 $6C $03 $DA
$26 $8B $1F $D1 $E3 $83 $BF $FA $0E $00 $75 $03 $E9 $009CW $B8
[$0025W] $50 $E8 $77A3W $44 $44 $C7 $04 [$000DW] $C7 $44 $32 #Shooting wall, play sound; Zap\zot type
{$47E8W} $C7 $44 $2A [$0000W] $E8 $796BW $3D [$0080W] $7E $07 $C7 $44 #Zap\zot behavior, Timer = 0, random animation assignment
$28 [$006EW] $EB $76 $C7 $44 $28 [$006FW] $EB $6F
#Left moving shot
%patch $4776 $C7 $44 $20 [$FE70W] #Set left shot's speed
$8B $56 $0A $8B $46 $08 $B1 $0C $E8 $99ECW $05 $0001W $83
$D2 $00 $50 $A1 $6C08W $52 $99 $59 $5B $E8 $9DCCW $8B $56 $06
$50 $8B $46 $04 $B1 $0C $E8 $99CFW $5A $03 $D0 $D1 $E2 $C4 $1E
$48 $6C $03 $DA $26 $8B $1F $D1 $E3 $83 $BF $86 $18 $00 $74 $2B
$B8 [$0025W] $50 $E8 $7732W $44 $44 $C7 $04 [$000DW] $C7 $44 $32 #Shooting wall, play sound; Zap\zot type
{$47E8W} $C7 $44 $2A [$0000W] $E8 $78FAW $3D [$0080W] $7E $07 $C7 #Zap\zot behavior, Timer = 0, random animation assignment
$44 $28 [$006EW] $EB $05 $C7 $44 $28 [$006FW] $5E $5D $C3
Keen 2
#Keen make shot code - all shot properties
%patch $7419 $55 $8B $EC $56 $E8 $E357W $8B $F0 $C7 $04 [$000AW] $8B $46 $06 #Set shot sprite type
$8B $56 $04 $89 $54 $04 $89 $44 $06 $8B $46 $0A $8B $56 $08 $81
$C2 $00 [$09] $15 [$0000W] $89 $54 $08 $89 $44 $0A $C7 $44 $32 {$7567W} #Set shot behavior, vertical position
$C7 $44 $22 [$0000W] $C7 $44 $34 {$75A8W} $C7 $44 $28 [$007AW] #Set vertical speed, collision and animation
$83 $3E $28 $60 $00 {$7C $75}
#Right moving shot
%patch $7460 $C7 $44 $20 [$0190W] $8B $56 $06 $8B #Set right shot's speed
$46 $04 $B1 $0C $E8 $6432W $8B $56 $0A $50 $8B $46 $08 $B1 $0C
$E8 $6426W $05 $0001W $83 $D2 $00 $50 $A1 $6BE4W $52 $99 $59
$5B $E8 $67D6W $5A $03 $D0 $42 $D1 $E2 $C4 $1E $24 $6C $03 $DA
$26 $8B $1F $D1 $E3 $83 $BF $CE $10 $00 $75 $03 $E9 $009CW $B8
[$0025W] $50 $E8 $415CW $44 $44 $C7 $04 [$000CW] $C7 $44 $32 {$7547W} #Shooting wall, play sound; Zap\zot type
$C7 $44 $2A [$0000W] $E8 $4324W $3D [$0080W] $7E $07 $C7 $44 #Zap\zot behavior, Timer = 0, random animation assignment
$28 $[$007CW] $EB $76 $C7 $44 $28 [$007DW] $EB $6F
#Left moving shot
$C7 $44 $20 [$FE70W] #Set left shot's speed
%patch $74D5 $8B $56 $0A $8B $46 $08 $B1 $0C $E8 $63BDW $05 $0001W $83
$D2 $00 $50 $A1 $6BE4W $52 $99 $59 $5B $E8 $676DW $8B $56 $06
$50 $8B $46 $04 $B1 $0C $E8 $63A0W $5A $03 $D0 $D1 $E2 $C4 $1E
$24 $6C $03 $DA $26 $8B $1F $D1 $E3 $83 $BF $92 $1B $00 $74 $2B
$B8 [$0025W] $50 $E8 $40EBW $44 $44 $C7 $04 [$000CW] $C7 $44 $32 #Shooting wall, play sound; Zap\zot type
{$7547W} $C7 $44 $2A [$0000W] $E8 $42B3W $3D [$0080W] $7E $07 $C7 #Zap\zot behavior, Timer = 0, random animation assignment
$44 $28 [$007CW] $EB $05 $C7 $44 $28 [$007DW] $5E $5D $C3
Keen 3
#Keen make shot code - all shot properties
%patch $7CD8 $55 $8B $EC $56 $E8 $E2DEW $8B $F0 $C7 $04 [$000FW] $8B $46 $06 #Set shot sprite type
$8B $56 $04 $89 $54 $04 $89 $44 $06 $8B $46 $0A $8B $56 $08 $81
$C2 $00 [$09] $15 [$0000W] $89 $54 $08 $89 $44 $0A $C7 $44 $32 {$7E29W} #Set shot behavior, vertical position
$C7 $44 $22 [$0000W] $C7 $44 $34 {$7E6BW} $C7 $44 $28 [$0066W] #Set vertical speed, collision and animation
$83 $3E $78 $62 $00 {$7C $73}
#Right moving shot
%patch $7D1F $C7 $44 $20 [$0190W] $8B $56 $06 $8B #Set right shot's speed
$46 $04 $B1 $0C $E8 $6EB3W $8B $56 $0A $50 $8B $46 $08 $B1 $0C
$E8 $6EA7W $05 $0001W $83 $D2 $00 $50 $A1 $6E34W $52 $99 $59
$5B $E8 $7257W $5A $03 $D0 $42 $D1 $E2 $C4 $1E $74 $6E $03 $DA
$26 $8B $1F $D1 $E3 $83 $BF $6A $11 $00 $74 $2C $B8 [$0025W] $50 #Shooting wall, play sound
$E8 $FE4BW $59 $C7 $04 [$0012W] $C7 $44 $32 {$7E05W} $C7 $44 $2A #Zap\zot type, behavior
[$0000W] $E8 $4DC7W $3D [$0080W] $7E $07 $C7 $44 $28 [$0069W] $EB #Timer = 0, random animation assignment
$05 $C7 $44 $28 [$006AW] $EB $72 $EB $70
#Left moving shot
%patch $7D92 $C7 $44 $20 [$FE70W] $8B #Set left shot's speed
$56 $0A $8B $46 $08 $B1 $0C $E8 $6E40W $05 $0001W $83 $D2 $00
$50 $A1 $6E34W $52 $99 $59 $5B $E8 $71F0W $8B $56 $06 $50 $8B
$46 $04 $B1 $0C $E8 $6E23W $5A $03 $D0 $D1 $E2 $C4 $1E $74 $6E
$03 $DA $26 $8B $1F $D1 $E3 $83 $BF $96 $1C $00 $74 $2C $B8 [$0025W] #Shooting wall, play sound
$50 $E8 $4B8CW $59 $C7 $04 [$0012W] $C7 $44 $32 {$7E05W} $C7 #Zap\zot type, behavior
$44 $2A [$0000W] $E8 $4D55W $3D [$0080W] $7E $07 $C7 $44 $28 [$0069W] #Timer = 0, random animation assignment
$EB $05 $C7 $44 $28 [$006AW] $EB $00 $5E $5D $C3
Complete shot behavior
This is the behavior code used by Keen's shots. It is reasonably simple and is more a tile check. On the first line the 'detect tiles' code is called and if the shot is touching any tile that blocks in any direction the shot will zap\zot.
At the end of line 1 sound 25 is played; on line 2 the shot's sprite type is set to that of a Zap/zot, on line 3 its behavior is set to that of a Zap\zot and its collision is set to 'nothing'. Finally on the fourth line a random check is made and the sprite's animation is changed to one of the two Zap\zot animations.
Keen 1
#Keen 1 shot behavior
%patch $4808 $55 $8B $EC $56 $E8 $E45EW $8B $F0 $0B $C0 $74 $31 $B8 [$0025W]
$50 $E8 $76D7W $44 $44 $C7 $06 $20 $82 [$000DW] $C7 $06 $52 $82
{$47E8W} $C7 $06 $4A $82 {$0000W} $E8 $789BW $3D [$0080W] $7E $08
$C7 $06 $48 $82 [$006EW] $EB $06 $C7 $06 $48 $82 [$006FW] $5E $5D
$C3
Keen 3
#Keen 3 shot behavior
%patch $7E29 $55 $8B $EC $56 $E8 $E4C7W $8B $F0 $0B $F6 $74 $32 $B8 [$0025W]
$50 $E8 $4B2CW $59 $C7 $06 $10 $99 [$0012W] $C7 $06 $42 $99 {$7E05W}
$C7 $06 $3A $99 {$0000W} $E8 $4CF1W $3D [$0080W] $7E $08 $C7
$06 $38 $99 [$0069W] $EB $06 $C7 $06 $38 $99 [$006AW] $EB $00 $5E
$5D $C3
Keen's shot falls under gravity
This patch alters Keen's shot behavior so that his shot will fall instead of moving in a straight line. Notably, if Keen's shot is given an upwards speed it will move in an arc. All other marked properties in this behavior work identically to those in the default behavior in the above section.
A side effect of this patch is that the Zap\zot also falls and doesn't have its animation timer reset. This doesn't affect the default Zap\zots much. A more notable side effect is that the Tank Robot's shots also fall under gravity also.
Keen 1
#Keen's shot obeys gravity
%patch $4808 $55 $8B $EC $56 $E8 $E45EW $8B $F0 $0B $C0 $74 $2B $B8 [$0025W]
$50 $E8 $76D7W $44 $44 $C7 $06 $20 $82 [$000DW] $C7 $06 $52 $82
{$47E8W} $E8 $78A1W $3D [$0080W] $7E $08 $C7 $06 $48 $82 [$006EW]
$EB $06 $C7 $06 $48 $82 [$006FW] $E8 $E3E7W $5E $5D $C3
Keen's shot hangs in the air after moving a short time
This patch causes Keen's shots to freeze in the air, but only after moving for a short time. Depending on the shot's speed and direction they can act as landmines or traps. This is almost identical to simply removing Keen's shot's speed, but the shot does in fact move for about a second.
Again all other marked properties in this behavior work identically to those in the default behavior in the above section.
Keen 1
#Keen's shot hangs in the air after moving a short time
%patch $4808 $55 $8B $EC $56 $E8 $E45EW $8B $F0 $0B $C0 $74 $2B $B8 [$0025W]
$50 $E8 $76D7W $44 $44 $C7 $06 $20 $82 [$000DW] $C7 $06 $52 $82
{$47E8W} $E8 $78A1W $3D [$0080W] $7E $08 $C7 $06 $48 $82 [$006EW]
$EB $06 $C7 $06 $48 $82 [$006FW] $E8 $E42AW $5E $5D $C3
Sprite Collision
Keen's shot's collision is relatively simple; it reacts to any and all sprite types except for type $1 (Keen) and type $E (zap\zot.) When a sprite that is not one of the two exceptions sound $25 is played on line 2, the sprite's behavior is set to $47E8W, (Wait a moment then vanish) its collision to $3360W (Nothing) and its animation timer to 0 A random number is got and if less than $80 (That is, a 50:50 chance the animation is set to $6E, else it is set to $6F.
The net result is that the shot is transformed into a zap\zot sprite.
Keen 1
#Keen's shot's collision
%patch $4849 $55 $8B $EC $56 $57 $8B $76 $04 $8B $7E $06 $83 $3D [$01] {$74} $31
$83 $3D [$0E] {$74} $2C $B8 [$0025W] $50 $E8 $768EW $44 $44 $C7 $44
$32 {$47E8W} $C7 $44 $34 $3360W $C7 $44 $2A $0000W $E8 $7855W
$3D [$0080W] {$7E} $07 $C7 $44 $28 [$006EW] $EB $05 $C7 $44 $28 [$006FW]
$5F $5E $5D $C3