Patch:Enemy shooter (Keen 6)
The enemy shooter in Keen 6 is an invisible sprite that regularly spawns new sprites, in its case pink shots. There are four different varieties of shooter (Though they are not different sprites in themselves.) that shoot in different directions. Similar sprites occur in Keen 3 and Keen 5, as well as the dart gun in Keen 4 and the watermelons in Keen Dreams.
Contents
Sprite Type
Dart guns are type 18, which is only used for them. The pink shots are type 4, which is used for enemy projectiles such as the Babobba's cinders.
Patch: Keen 6 |
|
Sprite Actions
There are three separate sets of actions relating to the shooter. The first is the invisible shooter, the next is the pink shot and the third is the shot hitting things and dissipating.
The way the gun works is simple, it loops between shooting and not-shooting, making one new sprite each time. The shots when produced loop four actions to move around and will smash when they hit either Keen or solid ground. The smashed shots have two actions before vanishing.
Actions: $26F6W #Gun wait $2714W #Gun shoot $2732W #Pink shot 1 $2750W #Pink shot 2 $276EW #Pink shot 3 $278CW #Pink shot 4 $27AAW #Pink shot smash 1 $27C8W #Pink shot smash 2
Patch: Keen 6 |
|
Sprite Behavior
There are two behaviors, the shooter uses a 'produce shot' behavior when it is shooting. This produces the pink shots and gives them their direction depending on what shooter produced them. The pink shot uses the 'Projectile' behavior, which means it simply moves in its current direction. Smashed shots and waiting guns have no behavior.
Behaviors: $08F4179DRL #Projectile $10CC0717RL #Spawn pink shot
Patch: Keen 6 |
|
Spawn shot behavior
This is the complete pink shot spawning behavior code. On the second line the shot's type is set (4, or 'enemy projectile') Next the sprite's activity is set. After this the directions are set by reference to a list of 4 items ($03 + 1) located at $1145B ($079BW). This sets one of four speeds for each shot direction. After this is the sprite's action (Line 7.) After all this sound $1D is played.
Patch: Keen 6 |
|
Speed
Unlike most other enemy shots the pink shots do not utilize animation motion, instead using speeds set when the shots are created. In this case $16 is a horizontal speed and $18 a vertical one. Only one speed per direction is set by default.
Patch: Keen 6 |
|
Patch: Animation motion |
|
Shot spawn directions
The directions that the shots move are determined by pointers to their code. As a result there is a four item list that controls the basic directions of the four kinds of shot. All that can be done at present is to make two types of shot or more move in the same direction, so this is not a very useful patch.
Patch: Keen 6 |
|
Sprite Collision
The gun and shot collisions are quite simple. The gun has no collision, it does not interact with other sprites. (Thus it cannot be destroyed, or hurt Keen.) The shots themselves use a special pink shot collision, killing Keen if they touch him and transforming into a smashed shot.
Collision values
These are the values used by each frame in the game.
Patch: Keen 6 collision values |
|
Collision code
The Pink Shot is the only Enemy Gun related sprite with a collision by default. It responds to Keen's sprite type, transforming into a smashed shot. Notice it doesn't make a sound when it smashes in this way.
Patch: Keen 6 collision code |
|
Pink shots can be destroyed by Keen's shot
This patch alters the Pink Shot's collision code so that Keen can destroy a pink shot with his own shot. Destroying a Pink Shot in this was will not kill Keen, but the shot is still lethal.
As a side effect the Orbatrix's collision cannot be messed with since this patch makes the two collisions share code.
Patch: Pink shots can be destroyed by Keen's shots |
|
Animations
The shooter animations are simple, shots have four animations plus two smashing animations and the shooter itself is invisible. Note that the shooter animation speed is also the frequency it produces shots (It controls the firing rate.) Shots use the same animations no matter what direction they move.
Patch: Keen 6 |
|
Sounds
There are two sounds, one for when the shooters shoot and one for when the pink shot is destroyed. Each can be blocked. Interestingly the Pink Shot doesn't make a noise when it smashes against Keen.
Patch: Keen 6 |
|
Sprite-tile interaction
Only the pink shots themselves have a unique til collision, this makes them smash whenever they hit a tile blocking their path. The gun and smashed shots use a general code that simply draws the sprite.
Patch: Keen 6 |
|
Tile interaction code
This is the complete code for the pink shot tile interaction code. On the first two lines right walls, floors, left walls and ceilings are checked for in that order. If any of these are blocking the shot's path then the next two lines of code are run. These play sound $1E and change the sprite's type to that of the smashed shot. The last three or so lines of code draw the pink shot on the screen.
Patch: Keen 6 |
|
Sprite spawn code
There are four kinds of enemy shooters, (Referred to here as 'lasers' for simplicity,) up, down, left and right. Each type uses the same initiation code and to thus set the same cache in $C7 $06 $CD43W $0001W. This passes on the 'variety' to the spawn code, which in turn passes it to the laser itself.
In the spawn code the last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity and $C7 $07 $xxxxW sets the sprite type.
Patch: Keen 6 Enemy shooter Initiation code |
|