Compare commits

..

No commits in common. "69dab5482a27e2008a65a9242a34886ffc6e1cad" and "e00bce0426d4077dcf5a2ce884e0cd01605f7827" have entirely different histories.

3 changed files with 41 additions and 113 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
.DS_Store .DS_Store
.vscode/settings.json

22
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#65c89b",
"activityBar.background": "#65c89b",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#945bc4",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#65c89b",
"statusBar.background": "#42b883",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#359268",
"statusBarItem.remoteBackground": "#42b883",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#42b883",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#42b88399",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#42b883"
}

View File

@ -411,11 +411,6 @@ function newtitle()
end end
}, },
bg.new{c=1}, bg.new{c=1},
bg.new{
y=28,
h=72,
c=5,
},
box, box,
toyphin.new(), toyphin.new(),
{ {
@ -478,11 +473,6 @@ phin_uw_pal = {
[7]=135, [7]=135,
[12]=140, [12]=140,
} }
phin_err_pal = {
[2]=2,
[7]=7,
[12]=8,
}
phinstate_nrm = { phinstate_nrm = {
s={4, 36, 4, 9}, s={4, 36, 4, 9},
@ -546,13 +536,6 @@ phinstate_return = {
phinstate_rise_wax = phinstate_dive_wane phinstate_rise_wax = phinstate_dive_wane
phinstate_rise_full = phinstate_dive_full phinstate_rise_full = phinstate_dive_full
phinstate_error = {
s={17},
ws=1,
hs=2,
p=phin_err_pal,
}
-- coordinates are the notional -- coordinates are the notional
-- center point of the dolphin. -- center point of the dolphin.
-- many states are off-center. -- many states are off-center.
@ -564,118 +547,43 @@ toyphin = {
} }
mknew(toyphin) mknew(toyphin)
function dive_splash(x)
-- TODO: sfx, vfx for dive input
end
function jump_splash(x)
-- TODO: sfx, vfx for jump input
end
function surfacing_splash(x, force, harder)
-- TODO: sfx, vfx for surfacing from a dive
end
function landing_splash(x, force, harder)
-- TODO: sfx, vfx for landing from a jump
end
function toyphin:update() function toyphin:update()
local x, y, dy = self.x, self.y, self.dy
-- entry mode? -- entry mode?
if not self.entered then if not self.entered then
x += 1 self.x += 1
self.entered = x >= 16 self.entered = self.x >= 16
elseif self.exiting then elseif self.exiting then
if x > 128 then if self.x > 128 then
self.exited = true self.exited = true
else else
x += 1 self.x += 1
end end
end end
-- button handling -- button handling
if self.entered and not self.exiting then if self.entered and not self.exiting and not self.launching then
if y >= 61 and y <= 67 and dy < 1 and dy > -1 then if self.state.idle then
if (btn(2)) then if (btnp(0)) then
jump_splash(x) --TODO: launch upwards
dy=-3.8 elseif (btnp(1)) then
elseif (btn(3)) then --TODO: launch downwards
dive_splash(x)
dy=3.8
end end
else else
dy += (btn(3) and 0.125 or 0) - (btn(2) and 0.125 or 0) --TODO: nudge momentum
end end
end end
if self.launching then
if (y > 64) dy -= 0.3 --TODO: advance launch mode
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 > -3.8))
if btn(2) then
-- maybe boost
if dy > -3.8 then
new_y = 64 + ((dy + y - 64)/dy * -3.8)
dy = -3.8
else
dy = (dy - 7.6) / 3
end
else
-- brake
if dy > -1 then
--stabilize
new_y = 64
dy = 0
else
dy /= 2
end
end
elseif new_y >= 64 and y < 64 then
-- landing
landing_splash(x, dy, btn(3) and (dy < 3.8))
if btn(3) then
-- maybe boost
if dy < 3.8 then
new_y = 64 - ((dy - y + 64)/dy * 3.8)
dy = 3.8
else
dy = (7.6 + dy) / 3
end
else
--brake
if dy < 1 then
--stabilize
new_y = 64
dy = 0
else
dy /= 2
end
end
end
y=new_y
local wet, st = y > 64, phinstate_error
if dy < -2.5 then
st = wet and phinstate_rise_full or phinstate_jump_full
elseif dy <= -1.5 then
st = wet and phinstate_rise_wax or phinstate_jump_wane
elseif dy < 1.5 then
-- handle idle special case later
st = wet and phinstate_return or phinstate_crest
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
end end
if (y == 64 and dy == 0) st = phinstate_nrm if not self.state.idle then
end
--TODO: gravity
--TODO: crossing 64
-- test mode -- test mode
--if (btn(5)) self.exiting = true --if (btn(5)) self.exiting = true
self.x, self.y, self.dy, self.state = x, y, dy, st
end end
-- hitbox for current state -- hitbox for current state
@ -686,7 +594,6 @@ end
function toyphin:draw() function toyphin:draw()
local st, y = self.state, self.y local st, y = self.state, self.y
pal(st.p, 1)
if (st.idle) y += wave() if (st.idle) y += wave()
spr(st.s[1+(((t()<<1)&0x0.FFFF*#st.s)&0x7FFF)], self.x + st.xo, y + st.yo, self.state.ws, self.state.hs) spr(st.s[1+(((t()<<1)&0x0.FFFF*#st.s)&0x7FFF)], self.x + st.xo, y + st.yo, self.state.ws, self.state.hs)
end end