Patch:Carrot Courier

From KeenWiki
Jump to: navigation, search

Carrot Couriers are brown, extremely fast-moving creatures found in many levels in Tuberia in Keen Dreams. They will move back and forth faster than Keen can run, jumping whenever they run out of ground to move across. They are also capable of pushing Keen around.

Carrots are prime targets for the dropping enemy bug which can crash the game if it is abused. This is especially noticeable in the first level.

Sprite Type

Carrots use type 7 which has no impact on any other sprites save for making them transform into Wilted Flowers properly. It also affects how Keen reacts to it.

Patch: Keen Dreams
#Broccolash sprite type
%patch $83F0 $07

Sprite Actions

The Carrot has a simple set of actions. It is spawned in the first frame of its running cycle and continues running until it reaches the edge of a platform as which point it jumps. When jumping the Carrot does nothing until it hits ground, returning to running.

$1B82W #Carrot run 1
$1BA0W #Carrot run 2
$1BBEW #Carrot run 3
$1BDCW #Carrot run 4
$1BFAW #Carrot jump

Patch: Keen Dreams
#Place Carrot in level
%patch $8142 $1B82W
#Running cycle
%patch $2560E $1BA0W %patch $2562C $1BBEW %patch $2564A $1BDCW %patch $25668 $1B82W
#At the end of platforms, jump
%patch $847B $1BFAW
#While jumping don't change
%patch $25686 $0000W
#When landing go to running
%patch $84BD $1B82W

Sprite Behavior

The Carrot does not have any behaviors of its own; it uses no behavior at all when running and it uses a general 'move through the air' behavior when jumping.

Patch: Keen Dreams
#Carrot Courier run
%patch $25602 $00000000L %patch $25620 $00000000L %patch $2563E $00000000L %patch $2565C $00000000L
#Carrot Courier jump
%patch $2567A $07C501A4RL


The carrot has animation motion governing how fast it moves back and forth.

Patch: Animation motion
#Carrot run
%patch $255FE $0080W $0000W %patch $2561C $0080W $0000W %patch $2563A $0080W $0000W %patch $25658 $0080W $0000W
#Carrot jump
%patch $25676 $0000W $0000W

Sprite collision

Like nearly all sprites in Keen Dreams the Carrot does not have a sprite collision. Instead Keen and his shots react to them and their sprite types.

Patch: Keen Dreams
#Carrot Courier run
%patch $25606 $00000000L %patch $25624 $00000000L %patch $25642 $00000000L %patch $25660 $00000000L
#Carrot Courier jump
%patch $2567E $00000000L


The Carrot has a simple animation cycle, running back and forth using 4 frames each, and a jumping frame using one frame.

Patch: Keen Dreams
%patch $23E7C $0105W
#Carrot cache start
%patch $23EA8 $010EW
#Carrot cache end
#Carrot run
%patch $255F2 $0105W $010AW %patch $255FC $0005W
#Animation speed
%patch $25610 $0106W $010BW %patch $2561A $0005W
#Animation speed
%patch $2562E $0107W $010CW %patch $25638 $0005W
#Animation speed
%patch $2564C $0108W $010DW %patch $25656 $0005W
#Animation speed
#Carrot jump
%patch $2566A $0109W $010EW %patch $25674 $0000W
#Animation speed

Sprite positioning

The Carrot spawns 16 pixels (1 tile) higher then where it is placed in-level. This should be changed with its sprite height as it is used to make the Carrot move along the ground. Otherwise it will spawn jumping.

Patch: Keen Dreams
#Carrot spawn height
%patch $8402 $FF00W
#16 pixels upwards

Sprite-tile interaction

The Carrot uses two of its own tile interactions. When running it uses one that causes it to turn at walls, move up or down hills and become a jumping Carrot at platform edges. When jumping it uses an interaction that returns it to running when it hits a floor.

Patch: Keen Dreams
#Carrot run
%patch $2560A $07C507DCRL %patch $25628 $07C507DCRL %patch $25646 $07C507DCRL %patch $25664 $07C507DCRL
#Carrot jump
%patch $25682 $07C50854RL

Sprite spawn code

There is one type of Carrot Courier. In its initiation code its cache is set in $C7 $06 $70C0W $0001W.

The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $07 $xxxxW sets the sprite type, $C7 $47 $06 $xxxxW sets the |clipping, and $C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, seldom used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. Keen always starts moving downwards. The Carrot spawns facing down and right.

Finally $D3 $E0 $05 $xxxxW is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything. The Carrot Courier spawns 16 pixels or 1 tile higher than where it is placed, this needs to be changed if its sprite height changes or the Carrot will spawn jumping.

Patch: Keen Dreams
#Carrot Courier initiation pointer
%patch $4A31 $0376W
#Carrot Courier (At $4846)
#Carrot Courier initiation code
%patch $4846 $FF $36 $7052W $FF $36 $7050W $9A $07C5078DRL $83 $C4 $04 $8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70C0W $0001W $E9 $0164W
#Carrot Courier spawn code
%patch $83DD $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E $70 $C7 $07 $0007W $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 $FF00W $89 $47 $0C $C7 $47 $0E $0001W $C7 $47 $10 $0001W $B8 $1B82W $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $8B $1E $3E $70 $C7 $47 $36 $0001W $5D $CB