# Patch:Ledges

(Redirected from Patch:Keen grabs ledge)

This page contains patches that relate to Keen grabbing ledges and pulling himself up from them in Keen Galaxy as well as the circumstances under which he does so. The page can be divided into two sections, the first dealing with what triggers Keen's ledge grabbing the second section dealing with Keen's ledge-related sprites, their properties, actions and suchlike. Related patches can be found in Patch:Keen (Keen 4), Patch:Keen (Keen 5) and Patch:Keen (Keen 6).

# When Keen grabs ledges

## Disable ledge gripping

These patches stop Keen being able to grip ledges either right or left (Or both.)

 Patch: Keen 4 #Keen cannot grip ledges... %patch $D5D3$EB #Left %patch $D6B9$EB #Right

# Ledge-related sprites

This section deals with the properties of Keen's ledge-related sprites, their behavior, actions and suchlike. Patches in this section do not alter how Keen starts mooning, but rather what happens when he does or what happens afterwards. The ledge-recovery sequence consists of seven actions (Using five animations.)

## Sprite Actions

Keen's ledge sequence starts when he is falling past a ledge and moving in its direction. As such there are two ways for him to start gripping a ledge; one when moving left and one when moving right. The 'start gripping' action goes directly to Keen's gripping action which will do nothing without the player's input.

When ledge gripping the player can move down or away from the ledge, which will cause Keen to fall or can move up or towards the ledge which will cause him to pull himself up. The pulling up sequence is five actions long and ends with Keen returning to standing.

When gripping ledges or pulling himself up and thus using his second sprite collision Keen can be disturbed by Platforms or Bounders; in both cases he will revert to his falling action.

Finally the in-level camera has certain exceptions that stop it following the player; this stops the ledge gripping and recovery sequence appearing 'jerky' (Since the camera relies on the position of Keen's head.) each single action is excepted from this except for ledge gripping itself. (Since the game would look odd if Keen could grip a ledge and freeze the camera.)

For a complete list of Keen's actions see Patch:Keen (Keen 4)#Sprite_Actions.

Actions:
$12ECW #Keen start gripping ledge$130AW #Keen gripping ledge
$1328W #Keen pulls himself up from ledgegripping 1$1346W #Keen pulls himself up from ledgegripping 2
$1364W #Keen pulls himself up from ledgegripping 3$1382W #Keen pulls himself up from ledgegripping 4
$13A0W #Keen standing on air (After pulling himself up. Doesn't fall)   Patch: Keen 4 #When Keen starts gripping ledges %patch$D752 $12ECW #Keen starts gripping ledge left %patch$D67B $12ECW #Keen starts gripping ledge right #What Keen starting to grip ledges does %patch$30178 $130AW #What Keen gripping a ledge does by himself %patch$30196 $0000W #What the player can do while gripping a ledge %patch$C98A $11A2W #Move away from ledge (Fall) %patch$C8FB $1328W #Move towards ledge (Pull Keen up) #Keen pull himself up sequence %patch$301B4 $1346W %patch$301D2 $1364W %patch$301F0 $1382W %patch$3020E $13A0W %patch$3022C $098CW #Be disturbed by %patch$CE54 $11A2W #Platforms %patch$CE8C $11A2W #Bounders #Camera exceptions %patch$87BF $12ECW #Gripping ledge %patch$87C9 $1328W #Pulling up from a ledge 1 %patch$87D3 $1346W #Pulling up from a ledge 2 %patch$87DD $1364W #Pulling up from a ledge 3 %patch$87E7 $1382W #Pulling up from a ledge 4 ## Sprite Behavior Keen has too many possible behaviors to list here. However they can be found by clicking this section's title. The first frame of ledge gripping has no behavior, meaning once Keen starts gripping a ledge he cannot be interrupted. The same thing applies to the last frame of picking himself up. Every other frame of the pulling up sequence is the same (can't be interrupted.) but has its own behavior.  Patch: Mooning Keen behaviors #Ledgegripping start %patch$3016C $00000000L #Ledgegripping %patch$3018A $0B8010E0RL #Keen pull himself up sequence %patch$301A8 $0B80134ARL %patch$301C6 $0B801369RL %patch$301E4 $0B801394RL %patch$30202 $0B80139FRL %patch$30220 $00000000L ### Ledge gripping behavior This behavior is the most complex ledge-related behavior; it deals with the various inputs hanging Keen responds to. As noted above they fall into two broad categories, those that make him fall and those that make him climb up. The climbing up action is highlighted in blue on the second line, falling down on the second to last line in the second section. On the first line a check is made to see if the up key ($A7D0W = $FF) is being pressed. If so the next check is skipped. (Keen goes to climbing up.) If not then a comparison is made involving Keen's horizontal direction and the left\right arrow keys ($A7CEW) If Keen is moving in the same way he is facing (That is, towards the ledge) he will climb up, else he will fall down. The total sum of these checks is to make Keen fall if he pressed down or moves away from the edge or climb up if pressing up or towards the ledge.

On the end of the second line and start of the third a horizontal direction check is made. This has an unknown function but it is followed on the sixth line by a second direction check. This changes Keen's position when he pulls himself up (Which of course depends on whether he is facing left or right.) A final check occurs that determines whether Keen's foreground variable should be set to 3 (Appear in front of all tiles.) so as not to look odd.

In the second section dealing with Keen going to falling is far simpler. Three checks are made, the first is the check for the down key which if being passed will skip the next two checks. The next two checks relate to the left\right arrow keys since the third is the same check as was performed in the first line of the behavior. The second check ensures that the arrow keys are being pressed (Are not 0) and the third (unnecessarily) checks that Keen is moving away from the ledge.

If Keen is going to fall his clipping variable is set to 1 and his action to falling.

 Patch: Keen 4 #Complete ledge gripping behavior - Keen 4 %patch $C8E0$55 $8B$EC $56$57 $8B$7E $06$83 $3E$A7D0W $FF$74 $09$8B $45$0E $3B$06 $A7CEW$75 $78$C7 $45$1C $1328W$83 $7D$0E $01$75 $1E$8B $5D$2E $4B$D1 $E3$8B $9F$25 $C9$D1 $EB$D1 $E3$8E $06$E9 $A7$8B $45$30 $D1$E0 $03$D8 $26$8B $17$EB $1C$8B $5D$2E $4B$D1 $E3$8B $9F$25 $C9$D1 $EB$D1 $E3$8E $06$E9 $A7$8B $45$2C $D1$E0 $03$D8 $26$8B $17$83 $7D$0E $01$75 $08$C7 $06$C921W $FF00W$EB $06$C7 $06$C921W $FF80W$8B $DA$8E $06$A1 $C8$26 $8A$87 $A6$44 $B4$00 $80A9W$00 $75$2E $C7$45 $20$0003W $5F$5E $5D$CB $5F$5E $5D$CB #Falling section $83$3E $A7D0W$01 $74$10 $83$3E $A7CEW$00 $74$13 $8B$45 $0E$3B $06$A7CEW $74$0A $C7$45 $1C$11A2W $C7$45 $06$0001W $5F$5E $5D$CB

#### Keen can't fall from gripping by pressing down

This patch removes the ability to press down to let go of a ledge. Only moving away from the ledge will work.

## Speed and Jump Height

Keen gripping a ledge is still by default, not using any motion. His position changes but this is not motion.

## Sprite positioning

Keen must be carefully positioned so that he can be in a good looking position when grabbing a ledge and then be in the right location as he pulls himself up. As such each frame of his ledge gripping sequence has its own vertical and horizontal positioning, as well as there being positioning when Keen grabs a ledge. The change in positions can be seen in the sprite behavior codes above.