Compare commits
No commits in common. "69dab5482a27e2008a65a9242a34886ffc6e1cad" and "dcd1d54f1304068080d814e530da3da82ad9f212" have entirely different histories.
69dab5482a
...
dcd1d54f13
42
vacation.p8
42
vacation.p8
@ -596,33 +596,33 @@ function toyphin:update()
|
||||
|
||||
-- button handling
|
||||
if self.entered and not self.exiting then
|
||||
if y >= 61 and y <= 67 and dy < 1 and dy > -1 then
|
||||
if self.state.idle then
|
||||
if (btn(2)) then
|
||||
jump_splash(x)
|
||||
dy=-3.8
|
||||
dy=-4.125
|
||||
elseif (btn(3)) then
|
||||
dive_splash(x)
|
||||
dy=3.8
|
||||
dy=4.125
|
||||
end
|
||||
else
|
||||
dy += (btn(3) and 0.125 or 0) - (btn(2) and 0.125 or 0)
|
||||
dy += (btn(3) and 0.1875 or 0) - (btn(2) and 0.1875 or 0)
|
||||
end
|
||||
end
|
||||
|
||||
if (y > 64) dy -= 0.3
|
||||
if (y < 64) dy += 0.3
|
||||
if (y > 64) dy -= 0.375
|
||||
if (y < 64) dy += 0.375
|
||||
|
||||
local new_y = y + dy
|
||||
if new_y <= 64 and y > 64 then
|
||||
-- surfacing
|
||||
surfacing_splash(x, -dy, btn(2) and (dy > -3.8))
|
||||
surfacing_splash(x, -dy, btn(2) and (dy > -4.125))
|
||||
if btn(2) then
|
||||
-- maybe boost
|
||||
if dy > -3.8 then
|
||||
new_y = 64 + ((dy + y - 64)/dy * -3.8)
|
||||
dy = -3.8
|
||||
if dy > -4.125 then
|
||||
new_y = 64 + ((dy + y - 64)/dy * -4.125)
|
||||
dy = -4.125
|
||||
else
|
||||
dy = (dy - 7.6) / 3
|
||||
dy = (dy - 4.125) / 2
|
||||
end
|
||||
else
|
||||
-- brake
|
||||
@ -632,18 +632,19 @@ function toyphin:update()
|
||||
dy = 0
|
||||
else
|
||||
dy /= 2
|
||||
new_y = 32 + new_y/2
|
||||
end
|
||||
end
|
||||
elseif new_y >= 64 and y < 64 then
|
||||
-- landing
|
||||
landing_splash(x, dy, btn(3) and (dy < 3.8))
|
||||
landing_splash(x, dy, btn(3) and (dy < 4.125))
|
||||
if btn(3) then
|
||||
-- maybe boost
|
||||
if dy < 3.8 then
|
||||
new_y = 64 - ((dy - y + 64)/dy * 3.8)
|
||||
dy = 3.8
|
||||
if dy < 4.125 then
|
||||
new_y = 64 - ((dy - y + 64)/dy * 4.125)
|
||||
dy = 4.125
|
||||
else
|
||||
dy = (7.6 + dy) / 3
|
||||
dy = (4.125 + dy) / 2
|
||||
end
|
||||
else
|
||||
--brake
|
||||
@ -653,20 +654,21 @@ function toyphin:update()
|
||||
dy = 0
|
||||
else
|
||||
dy /= 2
|
||||
new_y = 96 - new_y/2
|
||||
end
|
||||
end
|
||||
end
|
||||
y=new_y
|
||||
|
||||
local wet, st = y > 64, phinstate_error
|
||||
if dy < -2.5 then
|
||||
if dy < -1.5 then
|
||||
st = wet and phinstate_rise_full or phinstate_jump_full
|
||||
elseif dy <= -1.5 then
|
||||
elseif dy <= -0.5 then
|
||||
st = wet and phinstate_rise_wax or phinstate_jump_wane
|
||||
elseif dy < 1.5 then
|
||||
elseif dy < 0.5 then
|
||||
-- handle idle special case later
|
||||
st = wet and phinstate_return or phinstate_crest
|
||||
elseif dy <= 2.5 then
|
||||
elseif dy <= 1.5 then
|
||||
st = wet and phinstate_dive_wane or phinstate_fall_wax
|
||||
else
|
||||
st = wet and phinstate_dive_full or phinstate_fall_full
|
||||
|
Loading…
Reference in New Issue
Block a user