Patch:Sprite positioning

From KeenWiki
Jump to: navigation, search

Sprite positioning refers to how sprites are positioned in level relative to their sprite value placement or other sprites. As an example, since the game is divided into 16x16 tiles, a sprite whose height is NOT a multiple of 16 cannot be placed so that its feet touch the ground. This can be a problem with sprites that must sit or need to touch the floor. While changing sprites and hitboxes can solve this, the original games often use a parameter to add (Or subtract) height from the sprite so it will sit on the ground. Other patches relate to where a sprite spawns from another sprite, such as the Foot in Keen 4. These are more likely to include a horizontal component to make things look nicer.

Position values work the same way as all variables in Keen games; positive values are down or right and negative values are up or left.

Positioning in Vorticons

In Keen Vorticons it appears the value is a three byte patch composed of two parts. The first is a one byte value giving the number of pixels in the position. The second is a two byte value where each 1 change is worth 256 pixels.

An example patch is the horizontal and vertical positioning of the Ankh shield in Keen 3:

Patch: Keen 3
#Plenty of time shield
%patch $851A $F8
#Vertical position
%patch $851C $FFFFW %patch $852A $F8
#Horizontal position
%patch $852C $FFFFW

In this case the shield appears at $FFFFF8, $FFFFF8 relative to the player's sprite (That is, 8 pixels above and 8 pixels left of the player.) Notice how the two values add together; this is important. A naive patcher may think that in order to make the shield appear 8 pixels down and left of the player all they would need to do would be to change $F8 to $08. However this would make both values $FFFF08, or 248 pixels left and above the player, far offscreen. Instead the $FFFFW should be changed to $0000W To give both variables the value of $000008W.

Positioning in Galaxy and Dreams

In Keen Galaxy (and Dreams) this parameter is present for most sprites and is a two byte (word) patch that gives the added height in 16ths of a pixel (Thus one pixel down is $0010W) Positive values move a sprite down to the ground, negative values move it up. Sometimes these values can be 'reversed' due to a quirk of the game. The following is an example of a Galaxy patch, using default values.

Patch: Keen 4
#Arachnut spawn height:
%patch $1053E $FE8FW
#1 tile, 7 pixels up