# Patch:Slopes

This page deals with the eight kinds of slopes present in the Keen Dreams and Galaxy games. (For Keen Vorticons there is a patch that allows the creation of arbitrary slopes, the Vorticons 2 patch.) For patches relating to tile properties (Deadly tiles, etc.) see Patch:Tiles.

## How slopes work

Keen Dreams and Galaxy have eight different 'slopes' coded. (Given values 0-7) In order these are 'nothing\cradle', 'flat', 'Top to Middle', 'Middle to Bottom', 'Top to Bottom', 'Middle to Top', 'Bottom to Middle' and 'Bottom to Top'.

In this case 'bottom' refers to the bottom row of a 16x16 tile, 'middle' the 8th row and 'top' the topmost row. It can be seen then that two 'slopes' are flat, two are at 45 degrees (One tile up\down, one across.) and the remaining four are at 22.5 degrees (Half a tile up\down 1 tile across.)

These slopes apply to both the top and bottom of tiles; all that changes it what 'side' of the slope Keen is on. (Keen cannot fall through the top slope of a tile or rise through the bottom slope.)

Tile tops and bottoms can have any value between 0-255; what matters here is the value mod 8; Values of 1, 9, 17 and so on are all 'flat' since they divide by 8 with 1 left over.(This is important for things like deadly tiles and conveyor belts which use the 'flat' slope with an additional property.)

The exception to this is the 'cradle' slope; Keen will pass through tile tops\bottoms of value 0 but not those of 8, 16 and so on.

## Displacements

The actual shape of slopes is controlled by 8 32-byte or 16-word arrays. Each governs how many 16ths of a pixel something is displaced up (or down) when at a certain horizontal location in the tile. The most simple example is that of the 'flat' slope, which consists of 16 \$0100W values. This means that for each of the tile's 16 pixels Keen is displaced upwards 256/16 or 16 pixels, so he stands atop the tile.

The 'cradle' by contrast has 16 \$0000W values; on the nonzero types things will sink completely into the tile, yet not fall out of the bottom (Or be able to rise through the top.) The other slopes are more complex, rising or falling in pixel (\$10) or half-pixel (\$08) increments.

By altering these arrays it is possible to create any sort of slope desired, even ones with 'holes','jags' or direction changes mid-tile. The 'cradle' slope is especially useful since it can be altered without affecting the other default slope types into something unique.

### Slop displacements

#Slope displacements -Keen 4
%patch \$2F60C [\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W] #Cradle
[\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W]
%patch \$2F62C [\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W] #Flat
[\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W]
%patch \$2F64C [\$0000W \$0008W \$0010W \$0018W \$0020W \$0028W \$0030W \$0038W] #Top > Middle
[\$0040W \$0048W \$0050W \$0058W \$0060W \$0068W \$0070W \$0078W]
%patch \$2F66C [\$0080W \$0088W \$0090W \$0098W \$00A0W \$00A8W \$00B0W \$00B8W] #Middle > Bottom
[\$00C0W \$00C8W \$00D0W \$00D8W \$00E0W \$00E8W \$00F0W \$00F8W]
%patch \$2F68C [\$0000W \$0010W \$0020W \$0030W \$0040W \$0050W \$0060W \$0070W] #Top > Bottom
[\$0080W \$0090W \$00A0W \$00B0W \$00C0W \$00D0W \$00E0W \$00F0W]
%patch \$2F6AC [\$0078W \$0070W \$0068W \$0060W \$0058W \$0050W \$0048W \$0040W] #Middle > Top
[\$0038W \$0030W \$0028W \$0020W \$0018W \$0010W \$0008W \$0000W]
%patch \$2F6CC [\$00F8W \$00F0W \$00E8W \$00E0W \$00D8W \$00D0W \$00C8W \$00C0W] #Bottom > Middle
[\$00B8W \$00B0W \$00A8W \$00A0W \$0098W \$0090W \$0088W \$0080W]
%patch \$2F6EC [\$00F0W \$00E0W \$00D0W \$00C0W \$00B0W \$00A0W \$0090W \$0080W] #Bottom > Top
[\$0070W \$0060W \$0050W \$0040W \$0030W \$0020W \$0010W \$0000W]

#Slope displacements -Keen 5
%patch \$309C8 [\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W] #Cradle
[\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W]
%patch \$309E8 [\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W] #Flat
[\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W]
%patch \$30A08 [\$0000W \$0008W \$0010W \$0018W \$0020W \$0028W \$0030W \$0038W] #Top > Middle
[\$0040W \$0048W \$0050W \$0058W \$0060W \$0068W \$0070W \$0078W]
%patch \$30A28 [\$0080W \$0088W \$0090W \$0098W \$00A0W \$00A8W \$00B0W \$00B8W] #Middle > Bottom
[\$00C0W \$00C8W \$00D0W \$00D8W \$00E0W \$00E8W \$00F0W \$00F8W]
%patch \$30A48 [\$0000W \$0010W \$0020W \$0030W \$0040W \$0050W \$0060W \$0070W] #Top > Bottom
[\$0080W \$0090W \$00A0W \$00B0W \$00C0W \$00D0W \$00E0W \$00F0W]
%patch \$30A68 [\$0078W \$0070W \$0068W \$0060W \$0058W \$0050W \$0048W \$0040W] #Middle > Top
[\$0038W \$0030W \$0028W \$0020W \$0018W \$0010W \$0008W \$0000W]
%patch \$30A88 [\$00F8W \$00F0W \$00E8W \$00E0W \$00D8W \$00D0W \$00C8W \$00C0W] #Bottom > Middle
[\$00B8W \$00B0W \$00A8W \$00A0W \$0098W \$0090W \$0088W \$0080W]
%patch \$30AA8 [\$00F0W \$00E0W \$00D0W \$00C0W \$00B0W \$00A0W \$0090W \$0080W] #Bottom > Top
[\$0070W \$0060W \$0050W \$0040W \$0030W \$0020W \$0010W \$0000W]

#Slope displacements -Keen 6
%patch \$313B0 [\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W] #Cradle
[\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W]
%patch \$313D0 [\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W] #Flat
[\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W]
%patch \$313F0 [\$0000W \$0008W \$0010W \$0018W \$0020W \$0028W \$0030W \$0038W] #Top > Middle
[\$0040W \$0048W \$0050W \$0058W \$0060W \$0068W \$0070W \$0078W]
%patch \$31410 [\$0080W \$0088W \$0090W \$0098W \$00A0W \$00A8W \$00B0W \$00B8W] #Middle > Bottom
[\$00C0W \$00C8W \$00D0W \$00D8W \$00E0W \$00E8W \$00F0W \$00F8W]
%patch \$31430 [\$0000W \$0010W \$0020W \$0030W \$0040W \$0050W \$0060W \$0070W] #Top > Bottom
[\$0080W \$0090W \$00A0W \$00B0W \$00C0W \$00D0W \$00E0W \$00F0W]
%patch \$31450 [\$0078W \$0070W \$0068W \$0060W \$0058W \$0050W \$0048W \$0040W] #Middle > Top
[\$0038W \$0030W \$0028W \$0020W \$0018W \$0010W \$0008W \$0000W]
%patch \$31470 [\$00F8W \$00F0W \$00E8W \$00E0W \$00D8W \$00D0W \$00C8W \$00C0W] #Bottom > Middle
[\$00B8W \$00B0W \$00A8W \$00A0W \$0098W \$0090W \$0088W \$0080W]
%patch \$31490 [\$00F0W \$00E0W \$00D0W \$00C0W \$00B0W \$00A0W \$0090W \$0080W] #Bottom > Top
[\$0070W \$0060W \$0050W \$0040W \$0030W \$0020W \$0010W \$0000W]

#Slope displacements -Keen Dreams
%patch \$23ECA [\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W] #Cradle
[\$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W \$0100W]
%patch \$23EEA [\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W] #Flat
[\$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W \$0000W]
%patch \$23F0A [\$0000W \$0008W \$0010W \$0018W \$0020W \$0028W \$0030W \$0038W] #Top > Middle
[\$0040W \$0048W \$0050W \$0058W \$0060W \$0068W \$0070W \$0078W]
%patch \$23F2A [\$0080W \$0088W \$0090W \$0098W \$00A0W \$00A8W \$00B0W \$00B8W] #Middle > Bottom
[\$00C0W \$00C8W \$00D0W \$00D8W \$00E0W \$00E8W \$00F0W \$00F8W]
%patch \$23F4A [\$0000W \$0010W \$0020W \$0030W \$0040W \$0050W \$0060W \$0070W] #Top > Bottom
[\$0080W \$0090W \$00A0W \$00B0W \$00C0W \$00D0W \$00E0W \$00F0W]
%patch \$23F6A [\$0078W \$0070W \$0068W \$0060W \$0058W \$0050W \$0048W \$0040W] #Middle > Top
[\$0038W \$0030W \$0028W \$0020W \$0018W \$0010W \$0008W \$0000W]
%patch \$23F8A [\$00F8W \$00F0W \$00E8W \$00E0W \$00D8W \$00D0W \$00C8W \$00C0W] #Bottom > Middle
[\$00B8W \$00B0W \$00A8W \$00A0W \$0098W \$0090W \$0088W \$0080W]
%patch \$23FAA [\$00F0W \$00E0W \$00D0W \$00C0W \$00B0W \$00A0W \$0090W \$0080W] #Bottom > Top
[\$0070W \$0060W \$0050W \$0040W \$0030W \$0020W \$0010W \$0000W]