Gravity and jumps

Completed patches for Keen4.
Post Reply
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Gravity and jumps

Post by levellass »

Whilst looking at Xky's jump patches I found a few things of interest and some in need of further explanation. I have added a large number of jump heights to the Speed section of the patch index.

Gravity:

Gravity controls the fall rates of all sprites; it is surprisingly complex, consisting of several speeds. Firstly there is the 'basic' gravity; everything has this and falls at a certain rate, added to this is an extra speed for things that fall a long way (More than 4 tiles) and taken away from this is a third speed used during short jumps (Bounder, Keen, etc)

Code: Select all

%patch $B0AB  $46 $00 #'Base' gravity (Other gravities are added to this.)
%patch $B124  $46     #This taken away from things falling a short distance (I.e Keen's jumps)
%patch $B12A  $46 $00 #This added to things falling a long way down
There are also a number of 'speeds' for things that are 'hovering'; such as when a sprite reaches the top of its jump, or hits the ceiling. These apply for 4 gameticks and are usually unnoticeable... unless they're altered:

Code: Select all

%patch $B116  $00 $00 #This makes things pause at the top of their jump (Don't move for a sec)
%patch $B097  $00 $00 #This does the same thing
%patch $B097  $00 $00 #Extra boost shot sprites get when shot (Makes 'em bounce)
%patch $B6F8  $00 $00 #Speed of sprites when they hit a ceiling
If for example you make the last speed negative, all sprites that hit a ceiling will stick there. If the third speed is made positive, shot sprites will plummet groundwards extra fast. They are fun to play with, my favorite being to make the shot sprites whizz up into the air when shot.

Finally there is the speed buffer; on easy things jump slightly higher, including Keen, and fall slower. What controls this is two variables that at a bit of $00 $00 to all things falling. They both add to $00 $00 and the bigger both numbers are, the stronger the gravity is. Xky's 'low gravity' patch sets these at their lowest values, 1 and FF; setting them lower results in antigravity.These work only on easy, unless you use the patch to make Keen jump just as high on medium and hard.

Code: Select all

%patch $B109  $FD #Gravity strength (These both add to 00; they control speed buffering;
%patch $B120  $03 #and only on easy (unless using Keen's 'easy-hard' pogo patch)
Keen:

There are just as many speeds controlling Keen's speed and jumps. Most are self explainitory:

Code: Select all

%patch $C4D3  $D0 $FF #The height of Keen's -initial- pogo jump
%patch $D830  $D0 $FF #Height of Keen's other pogo jumps
%patch $D7FC  $00 $00 #Pogo Keen's speed when he hits a ceiling (Pause, then fall)

%patch $BAF0  $D8 $FF #Keen's jump height
%patch $BF0A  $D8 $FF #Keen's jump-while-walking height
%patch $C373  $D8 $FF #Jump cheat height (Both when he jumps off ground, and in the air.)
%patch $D4C7  $00 $00 #How fast Keen moves when he jumps and hits a ceiling (Pause then fall)
Do note that if you set the Jump cheat height to $01, Keen can't jump with the cheat on, but can hover in the air when falling (And pressing jump) If you make the ceiling hit speeds positive, Keen will 'bounce' off of ceilings. (Indeed it is almost possible, using the gravity patches to make a reverse gravity Keen.)

Then there's this from Xky:

Code: Select all

%patch $C55F  $90 $90 #Keen pogoes the same height in med and hard as in easy
%patch $8D7D  $EB     #Keen pogoes the same height in easy as in med and hard
And finally some misc:

Code: Select all

%patch $CCA0  $D8 $FF #Dead Keen bounce height
%patch $CCA5  $10 $00 #Dead Keen h speed

%patch $D2CA  $00 $00 #How 'extra' fast Keen falls with 'no clipping' cheat
%patch $D387  $00 $00 #How 'extra' fast Keen falls when he walks of an edge

Pretty much all the other sprite jump heights can be found at: http://levellord.toxicsheep.com/Index/K ... 20Patches/ under 'section 6.) Speeds'

I hope you enjoy!
User avatar
XkyRauh
Posts: 1114
Joined: Sun Aug 31, 2003 9:14 pm
Location: San Diego, California

Post by XkyRauh »

Wow; nice work! :)
Post Reply