Patch:Guard Robot

From KeenWiki
Jump to: navigation, search

Guard Robots are harmless but annoying enemies found in Keen 2. This page lists patches relating to Guard Robot sprites. It is divided into sections relating to the various sprite properties the patches involve. Being fluent with various sprite patch pages will help when working with these patches.

Sprite Type

Guard Robots use sprite type 6 which means they kill Keen on contact but are harmless to everything else. This also allows their shots not to collide with them.

Patch: Keen 2
#Guard Robot sprite type:
%patch $3D58 $06

Sprite Behavior

The Guard Robot has three behaviors, move, shoot and turn. The movement behavior is responsible for reversing direction when the robot hits walls. The Robot's shot has its own behavior and collision and is also used by theVorticon Elite, so any patches affecting it will affect the elite's shot as well.

$4539W #Move and turn when hitting walls, randomly go to shoot
$45B0W #Shoot
$4647W #Turn
$7567W #Move until hits blocks (Orange shot)
$4677W #Guard Robot collision
$775FW #Orange shot collision

Patch: When spawned
%patch $3D80 $4539W

Patch: In level
%patch $4573 $45B0W
#Shoot (Randomly while moving)
%patch $45AB $4647W
#Turn (When hits walls)
%patch $45F8 $4539W
#Move and turn (After shooting
%patch $465D $4539W
#Move and turn (After turning)
%patch $3D85 $4677W
#Guard Robot collision
%patch $766C $4677W
#Orange shot behavior
%patch $7677 $775FW
#Orange shot collision

Speed and Jump Height

The default speed of Guard Robots is +-100 when walking. They will head right when spawned by default. The robot's shots are the fastest sprites in the game moving at +-350. The Robot's shot speed here is separate from the Elite's, altering one will NOT affect the other.

Patch: Starting speeds
%patch $3D7B $0064W 
#Move right

Patch: In level
#When moving
%patch $458B $0064W
#Hits left wall (Go right)
%patch $45A5 $FF9CW
#Hits right wall (Go left)
#Orange shot
%patch $4619 $015EW
%patch $4623 $FEA2W

Sprite Collision

The Guard Robot's collision is one of the simplest in the game and should be 'do nothing' It appears however that there were plans for the Robot to have a more complex collision, since it has a high strength (100) and this collision appears to have been dummy code to be filled in later, possibly with a death like that of the snowflake in Keen 5. The strength works if the Robot is given for example, he Elite's death.

The Robot's shot shares its collision with the Elite's shot, anything that affects it affects the Elite's shot also.

Patch: Guard Robot
%patch $3D85 $4677W  
#Guard Robot collision
%patch $3D8A $0063W
#Robot strength
%patch $40C8 $75FCW
#Dead Guard Robot behavior
%patch $40C3 $61A2W
#Dead Guard Robot collision
%patch $7677 $775FW
#Orange shot collision
%patch $776B $3D $06
#Enemy shot ISN'T destroyed by Robot
%patch $7770 $3D $0D
#Enemy shot ISN'T destroyed by Tantalus
%patch $7775 $3D $04
#Enemy shot ISN'T destroyed by Elite


The Robot's shot shares its animation with the Elite's shot, so changing one will affect both.

Patch: When spawned
%patch $3D8F $0078W 

Patch: In level
%patch $4548 $0070W 
#Moving right
%patch $4550 $0074W
#Moving left
%patch $455A $03
#And next 3 frames
%patch $4556 $04
#Animation speed
%patch $45BF $0070W
#Shooting right
%patch $45C7 $0074W
#Shooting left
%patch $45D1 $03
#And next 3 frames
%patch $45CD $04
#Animation speed
%patch $4670 $0078W
%patch $466D $01
#Frames used -1
%patch $4669 $04
#Animation speed
%patch $767C $007BW
#Orange shot


These patches relate to the production of shots by the robot. Some of the alter ones may have unknown side effects.

Shot position

This controls the height at which the Robot's shots are spawned. It is divided into two values, the first in a 'fine-tuner', the number of pixels down from the Tank sprite's top the bullet appears. The second value is much rougher and is worth 256 pixels when +-1 It is really only useful when making the shot appear a negative number of pixels below (That is above) the sprite, when it will be changed to $FFFFW.

Since the shots are fired by both the Elites and the Robot there is an interesting system. The first set of values affects the Robot only, while the second set affects the orange shots and thus both the Robot and the Elite.

Patch: Keen 2
#Robot shot height (Default $FFFFFC, if zero then no shot appears)
%patch $4630 $FC %patch $4632 $FFFFW
#Enemy BULLET height (Default $000009, if zero then no appears)
%patch $765F $09 %patch $7661 $0000W

Number of shots

This patch affects the number of shots the Robot produces and how long it waits before producing the first shot. The Robot's shooting code divides time into $16 tick 'blocks'; thus both values in this patch must divide by $16 (That is 22, NOT $10, which is decimal 16) in order to work correctly. If the time is below the first value, the Robot will not shoot; this is its pause before shooting. The Robot will then shoot until it reaches the second value, at one shot per $16 ticks.

Thus the number of shots the Robot produces is the second value minus the first value divided by $16 plus one. ((v2 - v1) /16) + 1 So if both values are $16, one shot will be produced, the patch below allows five shots to be produced.

Patch: Keen 2
%patch $45E8  $0032W 
#Pause before shooting
%patch $45F0 $0096W
#Total shooting time

Stop shooting

It is possible to skip shooting entirely by patching the Robot behavior so that it keeps moving instead of shooting. However the following patch changes the shooting behavior into a simple pause, if this is wanted.

Patch: Keen 2
# Prevent the guard robot from shooting
%patch $463E $90 $90 $90

Misc shooting patches

This patch makes the Robot shoot a random number of shots, and Keep moving while it's shooting. This asn make it far more dangerous and unpredictable.

Patch: Keen 2
#Robot shoots a large, but random number of bullets, and moves while shooting
%patch $45AF $90

This patch makes the Robot only shoot right. it may have unintended side effects.

Patch: Keen 2
#Robot always shoots right
%patch $4623 $90 $90

Misc patches

The following patches make the Robot turn left or right quickly instead of pausing slightly when it hits walls. They may have unintended side effects.

Patch: Keen 2
#Robot turns right quickly
%patch $4590 $F0
#Robot turns left quickly
%patch $459E $F0