Patch:Heart

From KeenWiki
Jump to: navigation, search

The Heart is a red, harmless sprite found in Keen 3. It is the core of the Mangling Machine. This page lists patches relating to Heart 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.

A related sprite is the Spark.


Sprite Type

Hearts use type 13, also used by Sparks. This does not affect any other sprite in any way. There is also the Zap-zot sprites produced when the Mangling Machine is destroyed; these use type 19, a similarly ineffectual property.

Patch: Keen 3
#Spark sprite type:
%patch $40AE $0D
#Heart
%patch $4F5D $13
#MM destroyed zap-zots


Sprite Behavior

Hearts have only one behavior, they sit in place and animate. This never changes.

Behaviors:
$4E02W #Spark sit
$4EBEW #Heart collision

Patch: When spawned
#Heart behavior
%patch $40D1 $4EA6W

Patch: In level
#Heart collision
%patch $40D6 $4EBEW


Complete Heart behavior

This is the complete code for the Heart's behavior, which is exceedingly simple. It merely sits in place and animates. The blue values are the number of animation frames and start animation in that order.

Patch: Complete Heart behavior
#Complete Heart behavior
%patch $4EA6 $55 $8B $EC $A1 $61 $53 $BB $18 $00 $33 $D2 $F7 $F3 $25 $0001W $05 $0092W $A3 $38 $99 $5D $C3


Sprite Collision and points given when shot

Hearts have an interesting sprite collision; if a certain number of them are destroyed then an area of the level will be destroyed also. This is used to destroy the Mangling Machine's arms when six Sparks are shot. Further patches can be found on the Mangling Machine's page. The Heart is only damaged by Keen's shot and vanishes when shot.

The Hearts give 1000 points each when destroyed

Patch: Keen 3
%patch $40D6 $4EBEW  
#Heart collision
%patch $4EC7 $3F $0F
#Heart killed by Keen's shot

Patch: Points given when destroyed
#Points you get for shooting a heart
%patch $4EE9 $03E8W


Complete collision code

The Heart's complete collision code is quite complex. In the first line it checks to see if it is being contacted by Keen's shot (Type $0F) and if so, executes all following lines.

In the second line Keen's shot's sprite type is set to 0, making Keen's shot vanish. A new meta sprite is created (the Heart itself is now ignored!) of type 4, behavior $8048W and variant 0. It is unknown what this does. On the third line Keen's score is increased by 1'000.

The following two lines have unknown function, followed by the creation of a second metasprite, this one used to destroy the Mangling Machine's body. It is type 9, behavior $5063W and is placed at $00000002 in the level. Without this sprite the level will not end when Keen destroys the Heart.

Patch: Keen 3
#Heart collision code
%patch $4EBE $55 $8B $EC $56 $57 $8B $5E $06 $83 $3F $0F $74 $02 $EB $74 $8B
#Check Keen's shot
$5E $04 $C7 $07 $0000W $E8 $1131W $8B $F0 $C7 $44 $08 $0004W
#Remove shot, new metasprite
$C7 $44 $22 $8048W $C7 $44 $0A $0000W $B8 $03E8W $50 $E8
#Inc score
$BED6W $59 $33 $FF $EB $20 $8B $C7 $BA $0024W $F7 $EA $8B $D8 $83 $BF $CE $96 $07 $75 $0F $8B $C7 $BA $0024W $F7 $EA $8B $D8 $C7 $87 $CE $96 $0000W $47 $3B $3E $06 $99 $7C $DA $E8 $10EBW $8B
#Second new metasprite
$F0 $C7 $44 $08 $0009W $C7 $44 $22 $5063W $C7 $44 $04 $0002W $C7 $44 $06 $0000W $33 $C0 $89 $44 $0C $89 $44 $0A $C7 $06 $E0 $5F $0001W $5F $5E $5D $C3


Animations

The Heart's start sprite cannot yet be patched. This can cause problems. It has only one animation cycle of two frames.

Patch: In level
%patch $4EB7 $0092W 
#Heart
%patch $4EB4 $01
#Frames used