### work in progress

First we will define some variables and provide the memory location the game uses to reference them.
variable namememory locationdescription
x speed7e0408,2spositive is moving to the right
y speed7e040a,2spositive is falling
x pos7e0404,2uthe farther to the right the higher
y pos7e0406,2uthe lower the higher
str len7e0604,1sthe amount of line out, possible to make negative somehow
str stretch7e0602,1uthe length of the line stretched
x hook7e0500,2ux location of tip of hook (in pixels)
y hook7e0502,2u
x dim(pixels)7e040c,2ux dim / 64
y dim(pixels)7e040e,2u
Note this is not the actual order things are evaluated in

### Movement

Every frame:
• x dim = x dim + x speed
• y dim = y dim + y speed
• if hit wall x speed = 0
• if hit floor/ceiling y speed = 0

### Gravity

• y speed = y speed + 18

### Speed limits

• if any dimensions speed > 384 then that dimensions speed = 384

### Horizontal Control

• note horizontal control will not exceed a speed of 96
• if on ground and pressing left/right then
• if moving x speed += 8
• else x speed += 16
• if in air and pressing left/right then speed += 4

### Vertical Control

• if just jumped y speed = -256
• if just walked off a cliff y speed = 80

### Friction

• if in air x speed -= 1 (once every 4 frames)
• if on ground x speed -= 8 (unless walking under 96)
• if on ground and crouching x speed -= 16 (instead of 8)

### Rope

• rope travels at 4 pixels per second
• returns at 8 pixels per second
• max rope length = ~104, at this length it will begin to return
• min rope length = unknown (possible to get negative using sea horse in f36)
• breaks when a certain force or length is reached

### Rope control

• After holding down (and not left/right) for about 10 frames rope will suck in at 2 per second
• After holding up (and not left/right) for about 10 frames rope will release at 2 per second TODO: Double check)
• Cannot pull in rope if force is too strong (unknown exact value / formula)

### Rope forces

• if str stretch > str len then do nothing
• else a realistic forumla is used, exact formula not known but it is something like this:
• xspeed += sin(angle) * (str stretch - str len) * 2
• yspeed += cos(angle) * (str stretch - str len) * 2
• max acceleration (due to rope) = 60
• TODO: Be more accurate, I forget what the number 72 has to do with this

### Miscellaneous

• if near ladder / exit door and press up/down then x speed = 56 in that direction
• if get off ladder then x speed = 64
• the fish hook is a solid object and has length, it is what causes you to move away from the wall when bouncing up and down

### TODO

down, clip, lag

GameResources/SNES/UmiharaKawase/Physics last edited by on 1/1/2022 6:13 PM