Patch:Apel

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

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.

Actions:
$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

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} #Down
%patch $902D {$21B8W} #Up

#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

Behaviors:
$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.

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.

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.

Animation motion

#Apel walk
%patch $25BDA [$0080W $0000W]
%patch $25BF8 [$0080W $0000W]
%patch $25C16 [$0080W $0000W]

#Apel climb up poles
%patch $25C34 [$0000W $FFF0W]
%patch $25C52 [$0000W $FFF0W]

#Apel climb down poles
%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.

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


Animations

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

Keen Dreams

#Cache
%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 climb up poles
%patch $25C28 $014FW $014FW
%patch $25C32 $0006W        #Animation speed
%patch $25C46 $0150W $0150W
%patch $25C50 $0006W        #Animation speed

#Apel climb down poles
%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.

Keen Dreams

#Apel spawn height
%patch $8F6D [$FF00W] #16 pixels upwards


Sprite-tile interaction

The walking Apel uses a generic 'stay on platforms' interaction also used by many other walking sprites. Unique interactions are used for moving up poles, moving down poles and falling. These allow the Apel to interact with poles and land on the ground.

Sprite tile interactions

#Apel walk
%patch $25BE6 $07C50299RL
%patch $25C04 $07C50299RL
%patch $25C22 $07C50299RL

#Apel climb up poles
%patch $25C40 $08680A79RL
%patch $25C5E $08680A79RL

#Apel climb down poles
%patch $25C7C $08680AB1RL
%patch $25C9A $08680AB1RL
%patch $25CB8 $08680AB1RL
%patch $25CD6 $08680AB1RL

#Apel fall
%patch $25CF4 $08680AB1RL


Action type

Walking Apel actions are type 0, requiring little. When moving up and down poles type 1 actions are used to make the movement more smooth. When falling the Apel's action is type 2, allowing it to fall smoothly and respond quickly to landing.

Sprite action types

#Apel walk
%patch $25BD2 [$0000W]
%patch $25BF0 [$0000W]
%patch $25C0E [$0000W]

#Apel climb up poles
%patch $25C2C [$0001W]
%patch $25C4A [$0001W]

#Apel climb down poles
%patch $25C68 [$0001W]
%patch $25C86 [$0001W]
%patch $25CA4 [$0001W]
%patch $25CC2 [$0001W]

#Apel fall
%patch $25CE0 [$0002W]


Deprotect and stick to ground

The Apel needs to stick tot he ground when walking and so has a value of 1 for that variable in its walking actions only.

Sprite deprotect, stick

#Apel walk
%patch $25BD4 [$0000W $0001W]
%patch $25BF2 [$0000W $0001W]
%patch $25C10 [$0000W $0001W]

#Apel climb up poles
%patch $25C2E [$0000W $0000W]
%patch $25C4C [$0000W $0000W]

#Apel climb down poles
%patch $25C6A [$0000W $0000W]
%patch $25C88 [$0000W $0000W]
%patch $25CA6 [$0000W $0000W]
%patch $25CC4 [$0000W $0000W]

#Apel fall
%patch $25CE2 [$0000W $0000W]


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.

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