Patch:Youth (Keen 3)

From KeenWiki
Jump to: navigation, search

Youths, also known as 'Vortikids' are harmless but annoying enemies found in Keen 3 as well as Keen 2. This page lists patches relating to Keen 3 Youth sprites. It is divided into sections relating to the various sprite properties the patches involve. Being fluent with various sprite patch pages will help when working with these patches.

For patches relating to Youths in Keen 2 see Patch:Youth (Keen 2). For patches relating to the stunning effect the youths have, including patches to stop them stunning under certain conditions, see Patch:Keen stunned as well as Patch:G O D Cheat and Patch:Ankh.


Sprite Type

Youths use sprite type 3 which means they stun Keen on contact but are harmless to everything else. This can be changed at the Keen 3 sprite collision list.

Patch: Keen 3
#Youth sprite type:
%patch $3C8D $03


Sprite Behavior

The Youth has only two behaviors, walking\jumping, and falling\sliding. The Youth will jump randomly when walking. After jumping the Youth will fall and slide along the ground before returning to walking.

Behaviors:
$4311W #Walk, jump randomly, turn when hitting walls
$4391W #Youth fall or slide along ground
$43D9W #Youth collision

Patch: When spawned
%patch $3CB0 $4311W

Patch: In level
%patch $4360 $4391W 
#Fall\slide after hitting walls
%patch $4374 $4391W
#Fall\slide after randomly jumping
%patch $43BC $4311W
#Walk after fall\slide
%patch $3CB5 $43D9W
#Youth collision


Jump frequency

This patch controls how often the Youth jumps. The blue value is the number; by default the higher it is, the less the Youth jumps. The yellow value is the jump condition; it is 'if larger or equal' and shouldn't need to be patched. Changing it to $90 $90 will make the Youth jump all the time.

Patch: Youth Jump frequency
#Youth Jump frequency
%patch $434C $D0 $73


Youths don't jump

This patch stops the Youth jumping entirely.

Patch: Youth don't jump
#Youth don't jump
%patch $434D $EB


Complete running code

This is the complete code for the Youth's running\jumping behavior. As it contains many patches elsewhere on this page, it is incompatible with them. This includes the previous jump section.

The first line check direction and sets the Youth's animation at the end of the line and the start of line 2. Next is the animation speed and the number of frames of animation involved in walking, set on line 3. At the end of line 4 is the jump height. All of these values are blue.

At the end of line 5 is the jump\fall action used after the Youth has jumped; it is in brown. Following this are two $E8 $xxxxW calls to gravity and tile collision. Replacing the first with $90 $90 $90 makes the Youth fly, replacing the second makes it ghost through tiles. both can be replaced.

At the start of line 7, in brown, is the jump\fall behavior set again, this time for Youths that have run off an edge. At the end of the line, in blue, is the (left) speed of Youths that have hit a right wall. Finally line 8 contains the (right) speed of Youths that hit left walls.

Patch: Youth Complete running code
#Youth run\jump code
%patch $4311 $55 $8B $EC $56 $83 $3E $30 $99 $00 $7E $08 $C7 $06 $38 $99 $0033W $EB $06 $C7 $06 $38 $99 $002FW $A1 $61 $53 $B1 $04 $D3 $E8 $25 $0003W $8B $16 $38 $99 $03 $D0 $89 $16 $38 $99 $E8 $8803W $50 $A1 $40 $5D $BA $03 $00 $F7 $EA $5A $3B $D0 $73 $13 $B8 $0190W $50 $E8 $877CW $59 $F7 $D8 $A3 $32 $99 $C7 $06 $42 $99 $4391W $E8 $1F4FW $E8 $1F8FW $8B $F0 $F7 $C6 $02 $00 $75 $06 $C7 $06 $42 $99 $4391W $F7 $C6 $04 $00 $74 $06 $C7 $06 $30 $99 $FF06W $F7 $C6 $01 $00 $74 $06 $C7 $06 $30 $99 $00FAW $5E $5D $C3


Complete falling code

This is the complete code for the Youth's falling behavior. As it contains many patches elsewhere on this page, it is incompatible with them. It is however much simpler than the above running\jumping code.

The first line checks the Youth's direction and sets its animation at the end of the line and the start of line 2. Following this are two $E8 $xxxxW calls, in brown, to gravity and tile collision. Replacing the first with $90 $90 $90 makes the Youth fly when it jumps, replacing the second makes it ghost through tiles. both can be replaced.

On line 3 the Youth checks if it has solid ground under itself, and if so returns to running\jumping. Otherwise it will change its speed if it hits a wall, left if it hits a right wall and vice versa. (Both of these values marked in blue.)

Patch: Youth fall code
#Youth fall code
%patch $4391 $55 $8B $EC $56 $83 $3E $30 $99 $00 $7E $08 $C7 $06 $38 $99 $0036W $EB $06 $C7 $06 $38 $99 $0032W $E8 $1F07W $E8 $1F47W $8B $F0 $F7 $C6 $02 $00 $74 $06 $C7 $06 $42 $99 $4311W $F7 $C6 $04 $00 $74 $06 $C7 $06 $30 $99 $FF06W $F7 $C6 $01 $00 $74 $06 $C7 $06 $30 $99 $00FAW $5E $5D $C3


Youths just jump up and down

This stops Youths moving left and right, they just sit on the spot, jumping up and down randomly. This also reduces the number of animations they use as well as freeing up some code space. (It will be noticed that this aptch contains simlified versions of the code above.)

Patch: Youths just jump up and down
#Youth just jumps up and down (Free $4377-$43D8)
#Youth has no speed when it starts
%patch $3CBC $C7 $44 $28 $002FW $5E $5D $C3
#Youth run\jump code - simply jump up and down
%patch $4311 $55 $8B $EC $56 $C7 $06 $38 $99 $002FW $A1 $61 $53 $B1 $04 $D3 $E8 $25 $0003W $8B $16 $38 $99 $03 $D0 $89 $16 $38 $99 $E8 $8812W $50 $A1 $40 $5D $BA $03 $00 $F7 $EA $5A $3B $D0 $73 $13 $B8 $0190W $50 $E8 $878BW $59 $F7 $D8 $A3 $32 $99 $C7 $06 $42 $99 $435CW $E8 $1F5EW $E8 $1F9EW $5E $5D $C3
#Youth fall code
%patch $435C $55 $8B $EC $56 $E8 $1F51W $E8 $1F91W $8B $F0 $F7 $C6 $02 $00 $74 $06 $C7 $06 $42 $99 $4311W $5E $5D $C3


Speed and Jump Height

The default speed of Youths is +-250 when walking. They will head towards Keen when spawned by default. See also the above behavior section to alter Youths' jump frequency or disable jumping entirely.

Patch: Starting speeds
%patch $3CDA $00FAW 
#If left of Keen (Move right)
%patch $3CD3 $FF06W
#If right of Keen (Move left)

Patch: In level
#When walking\jumping
%patch $438C $00FAW
#Hits left wall (Go right)
%patch $4380 $FF06W
#Hits right wall (Go left)
%patch $4350 $0190W
#Jump height
#When falling\sliding
%patch $43D4 $00FAW
#Hits left wall (Go right)
%patch $43C8 $FF06W
#Hits right wall (Go left)


Youths always jump the same height

By default the Youths jump at random heights with a certain maximum. This patch makes it so that all of their jumps are the same, maximum, height.

Patch: Youth
#Derandomize Vorticon Youth jump heights
%patch $4353 $90 $90 $90


Sprite Collision

Youths interact with Keen's shots. This produces a shot Youth. (See behavior section.) The shot Youth also resets its collision and behavior, the new collision, used for most dead sprites ignores all other sprites, the new behavior likewise is just 'fall an animate'

Patch: Youth
%patch $3CB5 $43D9W   
#Youth collision
%patch $43E4 $3F $0F
#Youth killed by Keen's shot
%patch $4407 $7EC0W
#Dead Youth behavior
%patch $4402 $6A00W
#Dead Youth collision


Complete collision code

This is the complete collision code for the Youth; it contains, and is thus incompatible with, the above collision patches.

The first line is what the Youth reacts to, in this case Keen's shot. On the second line is the sound produced. (Replacing $E8 $857AW $59 with $90 $90 $90 $90 will stop the sound playing.) The following three blue marked values set the Youth's animation counter to 0, its death animation to $0037W and sets two frames for the length of the death cycle. Finally its collision is set to 'nothing' and its behavior to 'shot sprite'.

Patch: Youth collision code
#Youth collision code
%patch $43D9 $55 $8B $EC $56 $8B $76 $04 $8B $5E $06 $83 $3F $0F $75 $21 $B8 $0027W $50 $E8 $857AW $59 $C7 $44 $2A $0000W $C7 $44 $2C $0002W $C7 $44 $28 $0037W $C7 $44 $34 $6A00W $C7 $44 $32 $7EC0W $5E $5D $C3


Animations

Patch: When spawned
%patch $3CDF $002FW 
#Start

Patch: In level
%patch $4320 $0033W 
#Walking right
%patch $4328 $002FW
#Walking left
%patch $4332 $03
#And next 3 frames
%patch $43A0 $0036W
#Jumping right
%patch $43A8 $0032W
#Jumping left
%patch $43FD $0037W
#When shot
%patch $43F8 $02
#Frames used


Sounds

These are the sounds the sprite uses. The Youth has an unusually large number of sounds to choose from.

Patch: Keen 3
%patch $43E9 $27 
#Youth death
#Don't make sounds:
%patch $43EC $90 $90 $90 $90
#Youth death


Sprite spawning

This is the complete code for the Youth's spawning. As it contains many patches elsewhere on this page, it is incompatible with them.

The Youth has a normal sort of spawn code. its sprite type is set to 3, its behavior to running Youth, its collision to 'make shot Youth' with a strength of 1. Finally it looks for keen and moves towards him using a speed of +-250.

Patch: Youth spawn
#Youth initiation pointer
%patch $3BFC $3AE9W
#Initiation - Youth (Code at $3AE9 + $194 + 5 = $3C82)
%patch $3AE9 $56 $57 $E8 $0194W $59 $59 $E9 $00C7W
#Youth spawn
%patch $3C82 $55 $8B $EC $56 $E8 $2334W $8B $F0 $C7 $04 $0003W $8B $46 $04
#Sprite type = 3
$99 $B1 $0C $E8 $AF29W $89 $44 $04 $89 $54 $06 $8B $46 $06 $99 $B1 $0C $E8 $AF1AW $89 $44 $08 $89 $54 $0A $C7 $44 $32 $4311W
#Behavior = $4311
$C7 $44 $34 $43D9W $C7 $44 $24 $0001W $8B $44 $06 $8B $54 $04
#Collision = $43D9, health = 1
$3B $06 $0C $71 $7C $0F $7F $06 $3B $16 $0A $71 $76 $07 $C7 $44 $20 $FF06W $EB $05 $C7 $44 $20 $00FAW $C7 $44 $28 $002FW $5E
#Speed +-250, sprite = 2F
$5D $C3