From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Orbatrix in Keen 6. Orbatrix are blue, one-eyed floating-bouncing enemies found in many levels.

Sprite Type

Orbatrix use sprite type 16. This is used by no other sprites, nor does it interact with any other sprite types.

Keen 6

#Orbatrix sprite type
%patch $114F2 $13

Sprite Actions

Orbatrix have several actions and cycles. Sadly little is known about them. The Orbatrix is spawned floating, which is a two frame loop. While floating it can randomly curl up, a three frame sequence that ends with it going to the bounding action, or partially uncurl.

The bouncing loop is four frames long and eventually ends with the Orbatrix uncurling, a six frame loop consisting of two parts. For the first two frames the Orbatrix uncurls, four the next four frames it rises up off the ground (Or wherever it has landed) until it is about level with Keen. It then goes to floating.

When shot the Orbatrix simply floats.

$27E6W  #Orbatrix float 1
$2804W  #Orbatrix float 2
$2822W  #Orbatrix curls 1
$2840W  #Orbatrix curls 2
$285EW  #Orbatrix curls 3
$287CW  #Orbatrix uncurls 1
$289AW  #Orbatrix uncurls 2
$28B8W  #Orbatrix uncurls 3
$28D6W  #Orbatrix uncurls 4
$28F4W  #Orbatrix uncurls 5
$2912W  #Orbatrix uncurls 6
$2930W  #Orbatrix bounding 1
$294EW  #Orbatrix bounding 2
$296CW  #Orbatrix bounding 3
$298AW  #Orbatrix bounding 4

Keen 6

#When spawned
%patch $11540 [$27E6W]

#Floating loop
%patch $33532 [$2804W]
%patch $33550 [$27E6W]

#Partially uncurl (When floating)
%patch $11563 [$28B8W]

#Curl (When floating)
%patch $1159F [$2822W]

#Curl sequence
%patch $3356E [$2840W]
%patch $3358C [$285EW]
%patch $335AA [$2930W]

#Bounce loop
%patch $3367C [$294EW]
%patch $3369A [$296CW]
%patch $336B8 [$298AW]
%patch $336D6 [$2930W]

#Uncurl (When bouncing)
%patch $11686 [$287CW]

#Uncurl sequence
%patch $335C8 [$289AW]
%patch $335E6 [$28B8W]
%patch $33604 [$28D6W] #Start rising here
%patch $33622 [$28F4W]
%patch $33640 [$2912W]
%patch $3365E [$27E6W]

#When shot
%patch $115BB [$27E6W]

Sprite Behavior

The Orbatrix has three unique and one shared behavior. When floating it uses its float behavior which also dictates when it can attack Keen. When curling up it has no behavior until its third action, when it uses its curling behavior. The bouncing Orbatrix uses a generic 'move through the air' behavior also used by other sprites. The first frame of its uncurling sequence has its own behavior while the other five have no behavior.

The curling\uncurling behaviors change the Orbatrix's sprite properties so that it can move between floating and bouncing.

$08F41765RL #Move through air
$10CC088ERL #Orbatrix float
$10CC09DARL #Orbatrix curl
$10CC0A13RL #Orbatrix uncurl

Keen 6

%patch $33526 $10CC088ERL
%patch $33544 $10CC088ERL

#Curling up
%patch $33562 $00000000L
%patch $33580 $00000000L
%patch $3359E $10CC09DARL

%patch $335BC $10CC0A13RL
%patch $335DA $00000000L
%patch $335F8 $00000000L
%patch $33616 $00000000L
%patch $33634 $00000000L
%patch $33652 $00000000L

%patch $33670 $08F41765RL
%patch $3368E $08F41765RL
%patch $336AC $08F41765RL
%patch $336CA $08F41765RL

Orbatrix float behavior

This is the complete behavior code for the Orbatrix floating. On the first line a random check is made which, if passed, makes the Orbatrix go to its third uncurling frame. (This stops it chasing Keen and makes it sit still.)

The second section deals with seeking Keen; if the Orbatrix is at the same Y coordinate as Keen, then Keen's X coordinate is checked on the next line, causing the Orbatrix to face him. On the second to last line there are two proximity checks to see if Keen is closer than 5 tiles left or right. If so the Orbatrix will attack via curling, if not it won't. (And will instead just head in his direction.)

Keen 6

#Orbatrix float behavior
%patch $1154E $55 $8B $EC $56 $57 $8B $76 $06 $9A $1CF30034RL     $3D [$0020W]
              $7D $09 $C7 $44 $1C [$28B8W]  $5F $5E $5D $CB
                                                          $8B $44 $28 $8B $1E
              $64 $A9 $3B $47 $28 {$75} $2C $8B $1E $64 $A9 $8B $47 $0A $2B $44
              $0A $8B $F8 $0B $FF $7D $05 $B8 [$FFFFW]  $EB $03 $B8 [$0001W]  $89
              $44 $0E $81 $FF [$FB00W]  $7E $0B $81 $FF [$0500W]  $7D $05 $C7 $44
              $1C [$2822W]  $5F $5E $5D $CB

Seeking Keen

The Orbatrix heads towards Keen when floating, though it does not do so very well.

Keen 6

#Seek Keen when floating
%patch $11586 $FFFFW
%patch $1158B $0001W

Orbatrix doesn't curl or bounce

This patch stops the Orbatrix from curling up and bouncing. This means all it can do is chase Keen and look around. This also stops it getting off of the platforms it is floating above.

Keen 6

#Orbatrix doesn't curl or bounce
%patch $11590 $5F $5E $5D $CB

Speed and Jump Height

The Orbatrix's floating speed is defined in its animation motion; all other animation speeds are zero. Its bouncing speed however is defined in its own code.

Animation motion

%patch $33522 [$0010W $0000W]
%patch $33540 [$0010W $0000W]

%patch $3355E [$0000W $0000W]
%patch $3357C [$0000W $0000W]
%patch $3359A [$0000W $0000W]

%patch $335B8 [$0000W $0000W]
%patch $335D6 [$0000W $0000W]
%patch $335F4 [$0000W $0000W]
%patch $33612 [$0000W $0000W]
%patch $33630 [$0000W $0000W]
%patch $3364E [$0000W $0000W]

%patch $3366C [$0000W $0000W]
%patch $3368A [$0000W $0000W]
%patch $336A8 [$0000W $0000W]
%patch $336C6 [$0000W $0000W]

Orbatrix bounce variables

#Orbatrix bounces:
%patch $116AB [$003CW] #Width
%patch $116B5 [$FFE0W] #Height
%patch $116C0 [$0005W] #Number of bounces

Sprite Collision

The Orbatrix has two collision values. It will kill Keen if he touches it and is indestructible.

Collision values

The Orbatrix has two collisions, one 'floating' one 'bounding' Both collisions are quite similar, Keen will die if he touches the Orbatrix in any circumstances, however the bounding collision is unique; if Keen shoots the Orbatrix while it uses this then it will uncurl and resume chasing him. This can be used to control where the Orbatrix goes, even trapping it.

Keen 6 collision values

%patch $3352A $10CC08E5RL #Orbatrix float
%patch $33548 $10CC08E5RL #Orbatrix float

#Curling up
%patch $33566 $10CC08E5RL #Orbatrix float
%patch $33584 $10CC08E5RL #Orbatrix float
%patch $335A2 $10CC08E5RL #Orbatrix float

%patch $335C0 $10CC0A41RL #Orbatrix bouncing
%patch $335DE $10CC0A41RL #Orbatrix bouncing
%patch $335FC $10CC08E5RL #Orbatrix float
%patch $3361A $10CC08E5RL #Orbatrix float
%patch $33638 $10CC08E5RL #Orbatrix float
%patch $33656 $10CC08E5RL #Orbatrix float

%patch $33674 $10CC0A41RL #Orbatrix bouncing
%patch $33692 $10CC0A41RL #Orbatrix bouncing
%patch $336B0 $10CC0A41RL #Orbatrix bouncing
%patch $336CE $10CC0A41RL #Orbatrix bouncing

Floating collision code

This is the complete sprite collision code for the floating Orbatrix . It reacts only to Keen's shot type. This is canned for on the first line. If detected then the 'transform colliding sprite into smashed shot' code is called and the Orbatrix's action changes to that of uncurling.

Keen 6

#Orbatrix float collision code
%patch $115A5 $55 $8B $EC $56 $8B $76 $08 $83 $3C [$03] {$75} $18 $56 $9A $0CA60EC2RL
                      $83 $C4 $02 $B8 [$28B8W]  $50 $FF $76 $06 $9A $08F41297RL
                  $83 $C4 $04 $5E $5D $CB

Bouncing collision code

This is the complete sprite collision code for the bouncing Orbatrix . It reacts to Keen's type on line 1, running the 'kill the player' code. On the second line a check for Keen's shot type is made and if found the 'transform colliding sprite into smashed shot' code is called and the Orbatrix's horizontal speed is set to 0.

Keen 6

#Orbatrix bouncing collision  code
%patch $11701 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3C [$02] {$75} $09
              $9A $0AA213CARL     $5F $5E $5D $CB $83 $3C [$03] {$75} $0E $56 $9A
              $0CA60EC2RL     $83 $C4 $02 $C7 $45 $16 [$0000W]  $5F $5E $5D $CB


The Orbatrix has several animations. Four are used when floating left or right, the animation speed there controls how fast the Orbatrix moves. Three are used when curling up, here the animation speed controls how long the curling sequence takes. Four are used when bouncing, where the animation speed is more trivial. Finally the uncurling sequence uses the remaining frames where the animation speed controls how long this sequence takes.

Keen 6 Animations

%patch $3244C [$0149W] #Orbatrix cache start
%patch $3249C [$0155W] #Orbatrix cache end

%patch $33516 $014DW $014FW #Orbatrix moving
%patch $33520 $000CW        #Animation speed
%patch $33534 $014EW $0150W #Orbatrix moving
%patch $3353E $000CW        #Animation speed

#Curling up
%patch $33552 $0149W $0149W #Orbatrix curls 1
%patch $3355C $000CW        #Animation speed
%patch $33570 $0155W $0155W #Orbatrix curls 2
%patch $3357A $000CW        #Animation speed
%patch $3358E $0155W $0155W #Orbatrix curls 3
%patch $33598 $000CW        #Animation speed

%patch $335AC $0151W $0151W #Orbatrix uncurls 1
%patch $335B6 $000CW        #Animation speed
%patch $335CA $0155W $0155W #Orbatrix uncurls 2
%patch $335D4 $000CW        #Animation speed
%patch $335E8 $0149W $0149W #Orbatrix uncurls 3
%patch $335F2 $000CW        #Animation speed
%patch $33606 $014AW $014AW #Orbatrix uncurls 4
%patch $33610 $000CW        #Animation speed
%patch $33624 $014BW $014BW #Orbatrix uncurls 5
%patch $3362E $000CW        #Animation speed
%patch $33642 $014CW $014CW #Orbatrix uncurls 6
%patch $3364C $000CW        #Animation speed

%patch $33660 $0154W $0151W #Orbatrix bounding 1
%patch $3366A $0006W        #Animation speed
%patch $3367E $0153W $0152W #Orbatrix bounding 2
%patch $33688 $0006W        #Animation speed
%patch $3369C $0152W $0153W #Orbatrix bounding 3
%patch $336A6 $0006W        #Animation speed
%patch $336BA $0151W $0154W #Orbatrix bounding 4
%patch $336C4 $0006W        #Animation speed

Sprite positioning and attack range

The Orbatrix spawns 1.5 tiles higher than where placed, allowing it to float above the ground. It will also only attack Keen via bouncing if closer than 5 tiles left or right of him. (See Patch:Jump conditions.)

Keen 6

#Orbatrix spawn height
%patch $1150E [$FE80W] #1.5 tiles up

#Orbatrix attack range
%patch $11592 [$FB00W] {$7E} #Closer than 5 tiles left
%patch $11598 [$0500W] {$7D} #Closer than 5 tiles right

Clipping and foreground

The Orbatrix has a foreground variable of 1, meaning it appears behind foreground tiles, required for consistency when it bounces into things.

Keen 6

#Orbatrix foreground variable
%patch $114FC [$0000W]

Probability and randomness

There is a small chance that when floating the Orbatrix will chase Keen or attack him via curling (depending on how close he is.) The higher this probability the more aggressive it will be.

Keen 6

#Chance of Orbatrix chasing Keen\Curling
%patch $1155C [$0020W]

Sprite-tile interaction

The Orbatrix has two unique tile interaction codes. The first is used when bounding and lets it bounce off of walls and floors. The second is used when 'floating'. This is not just the main floating actions, but the curling up actions and all but the first two uncurling actions.

The first two uncurling actions are special and use a generic draw sprite' interaction. This is what can cause Orbatrix to get stuck in walls or floors if they uncurl at the wrong time.

Sprite tile interactions

%patch $3352E $10CC090CRL
%patch $3354C $10CC090CRL

#Curling up
%patch $3356A $10CC090CRL
%patch $33588 $10CC090CRL
%patch $335A6 $10CC090CRL

%patch $335C4 $08F4180ARL
%patch $335E2 $08F4180ARL
%patch $33600 $10CC090CRL
%patch $3361E $10CC090CRL
%patch $3363C $10CC090CRL
%patch $3365A $10CC090CRL

%patch $33678 $10CC0962RL
%patch $33696 $10CC0962RL
%patch $336B4 $10CC0962RL
%patch $336D2 $10CC0962RL

Action type

When floating the Orbatrix needs to move smoothly, it thus uses action type 1. When bounding it must also react and animate and so uses action type 3. This is also used for most curling\uncurling actions.

There are two 'adjustment' actions, one each for curling and uncurling. These are type 2 and allow the Orbatrix to move into the right place.

Sprite action types

%patch $3351A [$0001W]
%patch $33538 [$0001W]

#Curling up
%patch $33556 [$0003W]
%patch $33574 [$0003W]
%patch $33592 [$0002W]

%patch $335B0 [$0002W]
%patch $335CE [$0000W]
%patch $335EC [$0003W]
%patch $3360A [$0003W]
%patch $33628 [$0003W]
%patch $33646 [$0003W]

%patch $33664 [$0003W]
%patch $33682 [$0003W]
%patch $336A0 [$0003W]
%patch $336BE [$0003W]

Deprotect and stick to ground

The Orbatrix sticks to the ground in many of its actions (such as when floating, allowing it to float down hills.) This may seem a bit odd,but prevents it getting 'stuck' too high in he air.

Sprite deprotect, stick

%patch $3351C [$0000W $0001W]
%patch $3353A [$0000W $0001W]

#Curling up
%patch $33558 [$0000W $0001W]
%patch $33576 [$0000W $0001W]
%patch $33594 [$0000W $0001W]

%patch $335B2 [$0000W $0000W]
%patch $335D0 [$0000W $0000W]
%patch $335EE [$0000W $0001W]
%patch $3360C [$0000W $0001W]
%patch $3362A [$0000W $0001W]
%patch $33648 [$0000W $0001W]

%patch $33666 [$0000W $0000W]
%patch $33684 [$0000W $0000W]
%patch $336A2 [$0000W $0000W]
%patch $336C0 [$0000W $0000W]