From KeenWiki
Jump to: navigation, search

Apels (sometimes also called Apples) are apelike creatures (in that they walk on their knuckles) found in Apple Acres in Tuberia in Keen Dreams. They can climb up and down poles and will follow Keen if they can, hoping to knock him off as they climb much faster than he does.

Sprite Type

Apel use type 5 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 $8F5B $14

Sprite Actions

The Apel has quite a complex set of actions. It is spawned walking; a three action loop that it remains in until it finds a pole that leads it to Keen. When it encounters a pole it can climb up or down depending on Keen's location.

Pole climbing up is a two action loop and pole climbing down is a four action loop. Both of these will continue as long as the Apel is on a pole. At the top or bottom of poles Apel will fall off the pole, a one action loop that ends with the Apel landing on the ground and returning to walking. Apel will also go to walking when they touch flat ground while on a pole.

$215EW #Apel walk 1
$217CW #Apel walk 2
$219AW #Apel walk 3
$21B8W #Apel poleclimb up 1
$21D6W #Apel poleclimb up 2
$21F4W #Apel poleclimb down 1
$2212W #Apel poleclimb down 2
$2230W #Apel poleclimb down 3
$224EW #Apel poleclimb down 4
$226CW #Apel fall

Patch: Apel actions
#When spawned
%patch $8F7D $215EW
#Walk loop
%patch $25BEA $217CW %patch $25C08 $219AW %patch $25C26 $215EW
#Apel start pole climbing
%patch $9026 $21F2W
%patch $902D $21B8W
#Pole climb upwards loop
%patch $25C44 $21D6W %patch $25C62 $21B8W
#Pole climb downwards loop
%patch $25C80 $2212W %patch $25C9E $2230W %patch $25CBC $224EW %patch $25CDA $21F4W
#Apel reach top of poles and fall off
%patch $90A2 $226CW
#Apel reach bottom of poles and fall off
%patch $90F2 $226CW
#Apel leaves pole for flat ground
%patch $9107 $226CW
#Apel falling, wait to hit ground
%patch $25CF8 $0000W
#Land on ground
%patch $913F $215EW

Sprite Behavior

$07C501A4RL #Move through the air
$0868090ERL #Apel walk
$086809D9RL #Apel climb up poles
$08680A29RL #Apel climb down poles

The Apel has three unique behaviors. It uses the first when walking, the second while moving up poles and the third when moving down poles. The unknown action uses a general 'move through the air' behavior.

Patch: Keen Dreams
#Apel Walk
%patch $25BDE $0868090ERL %patch $25BFC $0868090ERL %patch $25C1A $0868090ERL
#Apel climb up poles
%patch $25C38 $086809D9RL %patch $25C56 $086809D9RL
#Apel climb down poles
%patch $25C74 $08680A29RL %patch $25C92 $08680A29RL %patch $25CB0 $08680A29RL %patch $25CCE $08680A29RL
#Apel fall
%patch $25CEC $07C501A4RL

Apel don't leave poles

This patch makes it so that Apel will never leave poles once they start climbing. (They can be shot off however.) The first two lines stop them leaving from pole tops, the next two, pole bottoms, and the final line stops them walking onto flat ground.

Patch: Apel don't climb off poles
#Apel don't climb off poles
%patch $909D $00 %patch $90A2 $2212W
#At pole tops
%patch $90ED $00 %patch $90F2 $21D6W
#At pole bottoms
%patch $9104 $EB

Speed and Jump Height

The Apel's motion is nearly entirely determined by its animation motion meaning that its animation speed can impact its actual speeds. The walking Apel has a horizontal speed while the poleclimbing Apel have a vertical speed (in opposite directions.) Only the falling Apel has no animation motion, instead simply responding to gravity.

Patch: Animation motion
#Apel walk
%patch $25BDA $0080W $0000W %patch $25BF8 $0080W $0000W %patch $25C16 $0080W $0000W
#Apel poleclimb up
%patch $25C34 $0000W $FFF0W %patch $25C52 $0000W $FFF0W
#Apel poleclimb down
%patch $25C70 $0000W $0010W %patch $25C8E $0000W $0010W %patch $25CAC $0000W $0010W %patch $25CCA $0000W $0010W
#Apel fall
%patch $25CE8 $0000W $0000W

Sprite collision

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

Patch: Keen Dreams
#Apel Walk
%patch $25BE2 $00000000L %patch $25C00 $00000000L %patch $25C1E $00000000L
#Apel climb up poles
%patch $25C3C $00000000L %patch $25C5A $00000000L
#Apel climb down poles
%patch $25C78 $00000000L %patch $25C96 $00000000L %patch $25CB4 $00000000L %patch $25CD2 $00000000L
#Apel fall
%patch $25CF0 $00000000L


The Apel has four sets of animations: walking left and right, climbing up poles, moving down poles and falling. They are relatively straightforward.

Patch: Keen Dreams
%patch $23E8C $0149W
#Apel cache start
%patch $23EB8 $0154W
#Apel cache end
#Apel walk
%patch $25BCE $014CW $0149W %patch $25BD8 $000AW
#Animation speed
%patch $25BEC $014DW $014AW %patch $25BF6 $000AW
#Animation speed
%patch $25C0A $014EW $014BW %patch $25C14 $000AW
#Animation speed
#Apel poleclimb up
%patch $25C28 $014FW $014FW %patch $25C32 $0006W
#Animation speed
%patch $25C46 $0150W $0150W %patch $25C50 $0006W
#Animation speed
#Apel poleclimb down
%patch $25C64 $0151W $0151W %patch $25C6E $0006W
#Animation speed
%patch $25C82 $0152W $0152W %patch $25C8C $0006W
#Animation speed
%patch $25CA0 $0153W $0153W %patch $25CAA $0006W
#Animation speed
%patch $25CBE $0154W $0154W %patch $25CC8 $0006W
#Animation speed
#Apel fall
%patch $25CDC $014CW $0149W %patch $25CE6 $0000W
#Animation speed

Sprite positioning

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

Patch: Keen Dreams
#Apel spawn height
%patch $8F6D $FF00W
#16 pixels upwards

Sprite spawn code

In the initiation code notice the Apel cache being set ($C7 $06 $70D0W $0001W.)

In the spawning code 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, while $D3 $E0 $05 $xxxx 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 Apel always starts the level moving down and right. $C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction.

Patch: Keen Dreams
#Location of initiation code
%patch $4A4F $0483W
#Apel (At $4953)
#Apel Initiation code
%patch $4953 $FF $36 $7052W $FF $36 $7050W $9A $086808C8RL $83 $C4 $04 $8B $1E $3E $70 $C7 $47 $02 $0000W $C7 $06 $70D0W $0001W $EB $58
#Apel spawning code
%patch $8F48 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL $44 $44 $8B $1E $3E $70 $C7 $07 $0014W $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 $215EW $50 $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $5D $CB