Patch:Guard Robot

From KeenWiki
Jump to navigation Jump to 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.

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.

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

When spawned

%patch $3D80 {$4539W}

In level

#Moving
%patch $4573 {$45B0W} #Shoot (Randomly while moving)
%patch $45AB {$4647W} #Turn (When hits walls)

#Shooting
%patch $45F8 {$4539W} #Move and turn (After shooting

#Turning
%patch $465D {$4539W} #Move and turn (After turning)

%patch $3D85 {$4677W} #Guard Robot collision

%patch $766C {$7567W} #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.

Starting speeds

%patch $3D7B [$0064W] #Move right

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] #Right
%patch $4623 [$FEA2W] #Left


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.

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


Animations

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

When spawned

%patch $3D8F [$0078W] #Start

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] #Turning
%patch $466D $01    #Frames used -1
%patch $4669 $04    #Animation speed

%patch $767C [$007BW] #Orange shot


Shooting

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


Shooting frequency

This patch controls how often the Robot shoots. By default the Robot's frequency depends on a general 'difficulty variable' with value 6. This patch creates a new variable for the Robot to use which can be customized. (Here a lower value results in less shooting.)

Robot shooting frequency

#Robot shooting frequency
%patch $456B  $212EW
%patch $198AE [$0006W]


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.

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.

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.

Keen 2

# Prevent the guard robot from shooting
%patch $463E  $90 $90 $90


Don't shoot in the dark

This patch makes it so that the Guard Robot doesn't shoot when the lights are off. It is incompatible with the robot speed patches listed elsewhere on this page, the last two blue values are the right and left speeds respectively. The first brown color is the Robot's shooting behavior, the second is its turning behavior.

Keen 2

#Guard robot doesn't shoot in the dark
%patch $456E $14 $83 $3E $96BEW  $00 $74 $0D $C7 $06 $96F2W  {$45B0W}  $33 $C0
             $A3 $96ECW  $EB $24 $E8 $1529W  $8B $F0 $A9 $0001W  $74 $08 $C7
             $06 $96ECW  [$0064W]  $EB $0C $F7 $C6 $0004W  $74 $12 $C7 $06 $96ECW
                 [$FF9CW]  $C7 $06 $96F2W  {$4647W}  $C7 $06 $96EAW  $0000W  $5E
             $5D $C3


Misc shooting patches

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

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.

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.

Keen 2

#Robot turns right quickly
%patch $4590 $F0

#Robot turns left quickly
%patch $459E $F0