Patch:Dart Gun

From KeenWiki
Jump to: navigation, search

The Dart Gun in Keen 4 is an invisible sprite that regularly spawns new sprites, or darts. There are four different varieties of gun (Though they are not different sprites in themselves.) that shoot in different directions. Similar sprites occur in Keen 3 and Keen 6, as well as in Keen 5 and the watermelons in Keen Dreams. this page also covers patches relating to the dart sprites produced.


Contents

Sprite Type

Dart guns are type 1, specifically to avoid interactions with any other sprites. Darts are type 31, but this doesn't affect any sprites by default.

Patch: Keen 4
#Sprite type
%patch $12873 $01
#Dart gun
%patch $1292B $1F
#Darts


Sprite Actions

There are four separate sets of actions relating to darts. The first is the dart gun. t remains as it is, running a 'make dart' code every time it animates. The remaining three are darts, horizontal, up and down. Each has two animation frames.

Actions:
$3962W #Dart gun
$3980W #Dart horizontal 1
$399EW #Dart horizontal 2
$39BCW #Dart up 1
$39DAW #Dart up 2
$39F8W #Dart down 1
$3A16W #Dart down 2

Patch: Keen 4
#Dart gun
%patch $128EC $3962W
#Place dart gun in level
%patch $327EE $3962W
#Dart gun stays a dart gun after making a dart
#Spawn darts
%patch $1296D $3980W
#Spawn Dart left
%patch $129A7 $3980W
#Spawn Dart right
%patch $12950 $39BCW
#Spawn Dart up
%patch $1298A $39F8W
#Spawn Dart down
#Horizontal darts
%patch $3280C $399EW
#Dart horizontal 1
%patch $3282A $3980W
#Dart horizontal 2
#Up darts
%patch $32848 $39DAW
#Dart up 1
%patch $32866 $39BCW
#Dart up 2
#Down darts
%patch $32884 $3A16W
#Dart down 1
%patch $328A2 $39F8W
#Dart down 2


Sprite Behavior

The only sprite with a behavior is the dart gun, and this behavior regularly produces one of the three dart sprites, setting their direction and other properties. Darts themselves do nothing.

Behaviors:
$11A20EE6RL #Dart gun

Patch: Keen 4
#Dart gun
%patch $327E2 $11A20EE6RL
#Dart gun
#Horizontal darts
%patch $32800 $00000000L
#Nothing
%patch $3281E $00000000L
#Nothing
#Up darts
%patch $3283C $00000000L
#Nothing
%patch $3285A $00000000L
#Nothing
#Down darts
%patch $32878 $00000000L
#Nothing
%patch $32896 $00000000L
#Nothing


Speed and Jump Height

The Dart Gun doesn't move, as is expected. Darts move either horizontally or vertically by default, the direction of their movement being determined by the dart's direction below. Due to having different sprites, up and down darts have different speeds.

Patch: Keen 4
#Shooter
%patch $327DE $0000W $0000W
#Horizontal darts
%patch $327FC $0040W $0000W %patch $3281A $0040W $0000W
#Up darts
%patch $32838 $0000W $0040W %patch $32856 $0000W $0040W
#Down darts
%patch $32874 $0000W $0040W %patch $32892 $0000W $0040W


Dart direction

The darts have their directions set on creation. That is, in what direction they'll move. Each dart can move both horizontally and vertically, or both at the same time. This is controlled by two variables, the horizontal and vertical direction, and whether they're right\down (1), left\up (-1) or still (0)

Patch: Keen 4 dart directions
#Down dart
%patch $12948 $0000W
#H
%patch $1294D $FFFFW
#V
#Right Dart
%patch $12965 $0001W
#H
%patch $1296A $0000W
#V
#Up Dart
%patch $12982 $0000W
#H
%patch $12987 $0001W
#V
#Left dart
%patch $1299F $FFFFW
#H
%patch $129A4 $0000W
#V


Sprite Collision

The dart collisions are quite simple. The dart gun has no collision, it does not interact with other sprites. (Thus it cannot be destroyed, or hurt Keen.) The darts themselves use the 'misc lethal' collision, killing Keen if they touch him.

Patch: Keen 4 collision values
#Dart shooter
%patch $327E6 $00000000L
#Nothing
#Horizontal darts
%patch $32804 $09DC1752RL
#Deadly to Keen
%patch $32822 $09DC1752RL
#Deadly to Keen
#Up darts
%patch $32840 $09DC1752RL
#Deadly to Keen
%patch $3285E $09DC1752RL
#Deadly to Keen
#Down darts
%patch $3287C $09DC1752RL
#Deadly to Keen
%patch $3289A $09DC1752RL
#Deadly to Keen


Animations

The dart animations are simple, darts have two animations and the dart gun is invisible. Note that the dart gun animation speed is also the frequency it produces darts.

The 'when spawned' sprites are used to position darts and should be the same as the first frame of the dart produced, otherwise your darts will be off-center.

Patch: Keen 4
#Cache
%patch $3070E $017CW
#Darts Cache start
%patch $30758 $0183W
#Darts cache end
#Dart shooter
%patch $327D2 $0000W $0000W
#(No sprites)
%patch $327DC $0096W
#Animation speed
#Spawn sprites
%patch $128B2 $017CW
#Up dart
%patch $128C6 $0180W
#Right dart
%patch $128D6 $017EW
#Down dart
%patch $128E9 $0182W
#Left dart
#Horizontal darts
%patch $327F0 $0182W $0180W %patch $327FA $0006W
#Animation speed
%patch $3280E $0183W $0181W %patch $32818 $0006W
#Animation speed
#Dart up
%patch $3282C $017CW $017CW %patch $32836 $0006W
#Animation speed
%patch $3284A $017DW $017DW %patch $32854 $0006W
#Animation speed
#Dart down
%patch $32868 $017EW $017EW %patch $32872 $0006W
#Animation speed
%patch $32886 $017FW $017FW %patch $32890 $0006W
#Animation speed


Sounds

The dart shooters make a sound each time they produce a dart. This sound can be blocked.

Patch: Keen 4
#Dart gun shoot sound
%patch $129B4 $29
#Don't make sound:
%patch $129B3 $EB $0A


Sprite positioning

The positioning of darts is poorly understood. The values are in pixels and two of the values are negative (Left or up)

Patch: Keen 4
#Where darts are spawned relative to shooter
%patch $128A9 $30
#Up dart v (-ve)
%patch $128AD $0090W
#Up dart h
%patch $128BD $0080W
#Right dart v
%patch $128C3 $50
#Right dart h
%patch $128D1 $0090W
#Down dart h
%patch $128E1 $70
#Left dart v
%patch $128E5 $30
#Left dart h (-ve)


Clipping and foreground

The Dart Gun is given clipping of 0, that is, pass through tiles; possibly so it can shoot darts from walls. Darts do not appear to have clipping set.

Patch: Keen 4
#Dart gun clipping
%patch $12887 $0000W


Sprite-tile interaction

Dart shooters do not interact with tiles, as expected. Darts use the 'enemy shot' interaction; they vanish when they hit a tile that blocks in any direction.

Patch: Keen 4
#Dart gun
%patch $327EA $00000000L
#Horizontal darts
%patch $32808 $11A20CA1RL %patch $32826 $11A20CA1RL
#Up darts
%patch $32844 $11A20CA1RL %patch $32862 $11A20CA1RL
#Down dart
%patch $32880 $11A20CA1RL %patch $3289E $11A20CA1RL


Darts don't vanish when they hit tiles

This patch stops the darts vanishing when they hit solid tiles. They will however stop moving.) If nothing else is done they will rapidly build up and crash the game so some other manner of removing them must be used. (Darts destroy each other, vanish after a fixed time, exit the level... simply going offscreen will not work.)

Patch: Keen 4
#Darts don't vanish when they hit tiles
%patch $126E0 $EB $0A


Darts smash like Keen's shots

This patch causes darts to smash into tiles just like Keen's shots, making the same noise and smashed shot sprite instead of just vanishing.

Patch: Keen 4
#Darts smash like Keen's shots
%patch $126E2 $0D8F0D43RL


Action type

Dart guns are type 0, they sit and do nothing. Darts are type 1, they move smoothly through the air.

Patch: Keen 4
#Dart gun
%patch $327D6 $0000W
#Horizontal dart
%patch $327F4 $0001W %patch $32812 $0001W
#Up dart
%patch $32830 $0001W %patch $3284E $0001W
#Down dart
%patch $3286C $0001W %patch $3288A $0001W


Deprotect and stick to ground

Darts and dart guns do not use either of these values since they have no interaction with sloped tiles at all.

Patch: Keen 4
#Dart gun
%patch $327D8 $0000W $0000W
#Horizontal darts
%patch $327F6 $0000W $0000W %patch $32814 $0000W $0000W
#Up darts
%patch $32832 $0000W $0000W %patch $32850 $0000W $0000W
#Down darts
%patch $3286E $0000W $0000W %patch $3288C $0000W $0000W


Sprite spawn code

There are four kinds of Dart shooter which are divided further into three different difficulties in the game. Notice that there are three initiation codes, one for each difficulty, instead of four; one for each type. In each initiation code notice the Dart cache being set ($C7 $06 $CB79W $0001W.) Finally notice that all three initiation codes go to the same spawning codes; that is where the different types of Dart shooter are differentiated.

Patch: Location of initiation code
%patch $EEED $0489W 
#Easy Up Dart (At $ED79)
%patch $EEEF $0489W
#Easy Right Dart (At $ED79)
%patch $EEF1 $0489W
#Easy Down Dart (At $ED79)
%patch $EEF3 $0489W
#Easy Left Dart (At $ED79)
%patch $EF21 $0463W
#Medium Up Dart (At $ED53)
%patch $EF23 $0463W
#Medium Right Dart (At $ED53)
%patch $EF25 $0463W
#Medium Down Dart (At $ED53)
%patch $EF27 $0463W
#Medium Left Dart (At $ED53)
%patch $EF29 $043DW
#Hard Up Dart (At $ED2D)
%patch $EF2B $043DW
#Hard Right Dart (At $ED2D)
%patch $EF2D $043DW
#Hard Down Dart (At $ED2D)
%patch $EF2F $043DW
#Hard Left dart (At $ED2D)

Patch: Dart Gun Initiation code
#Dart shooter - hard
%patch $ED2D $83 $3E $7A6CW $02 $7D $03 $E9 $00C6W $8B $46 $F8 $05 $FFADW $50 $FF $76 $FC $57 $9A $11A20E3BRL $83 $C4 $06 $C7 $06 $CB79W $0001W $E9 $00AAW
#Dart shooter - medium
%patch $ED53 $83 $3E $7A6CW $02 $7D $03 $E9 $00A0W $8B $46 $F8 $05 $FFB1W $50 $FF $76 $FC $57 $9A $11A20E3BRL $83 $C4 $06 $C7 $06 $CB79W $0001W $E9 $0084W
#Dart shooter - easy
%patch $ED79 $8B $46 $F8 $05 $FFCBW $50 $FF $76 $FC $57 $9A $11A20E3BRL $83 $C4 $06 $C7 $06 $CB79W $0001W $EB $69

Personal tools