Compare commits
2 Commits
dcd1d54f13
...
69dab5482a
Author | SHA1 | Date | |
---|---|---|---|
69dab5482a | |||
373d1d6b11 |
42
vacation.p8
42
vacation.p8
@ -596,33 +596,33 @@ function toyphin:update()
|
||||
|
||||
-- button handling
|
||||
if self.entered and not self.exiting then
|
||||
if self.state.idle then
|
||||
if y >= 61 and y <= 67 and dy < 1 and dy > -1 then
|
||||
if (btn(2)) then
|
||||
jump_splash(x)
|
||||
dy=-4.125
|
||||
dy=-3.8
|
||||
elseif (btn(3)) then
|
||||
dive_splash(x)
|
||||
dy=4.125
|
||||
dy=3.8
|
||||
end
|
||||
else
|
||||
dy += (btn(3) and 0.1875 or 0) - (btn(2) and 0.1875 or 0)
|
||||
dy += (btn(3) and 0.125 or 0) - (btn(2) and 0.125 or 0)
|
||||
end
|
||||
end
|
||||
|
||||
if (y > 64) dy -= 0.375
|
||||
if (y < 64) dy += 0.375
|
||||
if (y > 64) dy -= 0.3
|
||||
if (y < 64) dy += 0.3
|
||||
|
||||
local new_y = y + dy
|
||||
if new_y <= 64 and y > 64 then
|
||||
-- surfacing
|
||||
surfacing_splash(x, -dy, btn(2) and (dy > -4.125))
|
||||
surfacing_splash(x, -dy, btn(2) and (dy > -3.8))
|
||||
if btn(2) then
|
||||
-- maybe boost
|
||||
if dy > -4.125 then
|
||||
new_y = 64 + ((dy + y - 64)/dy * -4.125)
|
||||
dy = -4.125
|
||||
if dy > -3.8 then
|
||||
new_y = 64 + ((dy + y - 64)/dy * -3.8)
|
||||
dy = -3.8
|
||||
else
|
||||
dy = (dy - 4.125) / 2
|
||||
dy = (dy - 7.6) / 3
|
||||
end
|
||||
else
|
||||
-- brake
|
||||
@ -632,19 +632,18 @@ 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 < 4.125))
|
||||
landing_splash(x, dy, btn(3) and (dy < 3.8))
|
||||
if btn(3) then
|
||||
-- maybe boost
|
||||
if dy < 4.125 then
|
||||
new_y = 64 - ((dy - y + 64)/dy * 4.125)
|
||||
dy = 4.125
|
||||
if dy < 3.8 then
|
||||
new_y = 64 - ((dy - y + 64)/dy * 3.8)
|
||||
dy = 3.8
|
||||
else
|
||||
dy = (4.125 + dy) / 2
|
||||
dy = (7.6 + dy) / 3
|
||||
end
|
||||
else
|
||||
--brake
|
||||
@ -654,21 +653,20 @@ 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 < -1.5 then
|
||||
if dy < -2.5 then
|
||||
st = wet and phinstate_rise_full or phinstate_jump_full
|
||||
elseif dy <= -0.5 then
|
||||
elseif dy <= -1.5 then
|
||||
st = wet and phinstate_rise_wax or phinstate_jump_wane
|
||||
elseif dy < 0.5 then
|
||||
elseif dy < 1.5 then
|
||||
-- handle idle special case later
|
||||
st = wet and phinstate_return or phinstate_crest
|
||||
elseif dy <= 1.5 then
|
||||
elseif dy <= 2.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