Compare commits
6 Commits
e00bce0426
...
69dab5482a
Author | SHA1 | Date | |
---|---|---|---|
69dab5482a | |||
373d1d6b11 | |||
dcd1d54f13 | |||
258a3ef66b | |||
16469f0863 | |||
525c7e0cb6 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.DS_Store
|
||||
.vscode/settings.json
|
||||
|
22
.vscode/settings.json
vendored
22
.vscode/settings.json
vendored
@ -1,22 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
131
vacation.p8
131
vacation.p8
@ -411,6 +411,11 @@ function newtitle()
|
||||
end
|
||||
},
|
||||
bg.new{c=1},
|
||||
bg.new{
|
||||
y=28,
|
||||
h=72,
|
||||
c=5,
|
||||
},
|
||||
box,
|
||||
toyphin.new(),
|
||||
{
|
||||
@ -473,6 +478,11 @@ phin_uw_pal = {
|
||||
[7]=135,
|
||||
[12]=140,
|
||||
}
|
||||
phin_err_pal = {
|
||||
[2]=2,
|
||||
[7]=7,
|
||||
[12]=8,
|
||||
}
|
||||
|
||||
phinstate_nrm = {
|
||||
s={4, 36, 4, 9},
|
||||
@ -536,6 +546,13 @@ phinstate_return = {
|
||||
phinstate_rise_wax = phinstate_dive_wane
|
||||
phinstate_rise_full = phinstate_dive_full
|
||||
|
||||
phinstate_error = {
|
||||
s={17},
|
||||
ws=1,
|
||||
hs=2,
|
||||
p=phin_err_pal,
|
||||
}
|
||||
|
||||
-- coordinates are the notional
|
||||
-- center point of the dolphin.
|
||||
-- many states are off-center.
|
||||
@ -547,43 +564,118 @@ 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()
|
||||
local x, y, dy = self.x, self.y, self.dy
|
||||
-- entry mode?
|
||||
if not self.entered then
|
||||
self.x += 1
|
||||
self.entered = self.x >= 16
|
||||
x += 1
|
||||
self.entered = x >= 16
|
||||
elseif self.exiting then
|
||||
if self.x > 128 then
|
||||
if x > 128 then
|
||||
self.exited = true
|
||||
else
|
||||
self.x += 1
|
||||
x += 1
|
||||
end
|
||||
end
|
||||
|
||||
-- button handling
|
||||
if self.entered and not self.exiting and not self.launching then
|
||||
if self.state.idle then
|
||||
if (btnp(0)) then
|
||||
--TODO: launch upwards
|
||||
elseif (btnp(1)) then
|
||||
--TODO: launch downwards
|
||||
if self.entered and not self.exiting then
|
||||
if y >= 61 and y <= 67 and dy < 1 and dy > -1 then
|
||||
if (btn(2)) then
|
||||
jump_splash(x)
|
||||
dy=-3.8
|
||||
elseif (btn(3)) then
|
||||
dive_splash(x)
|
||||
dy=3.8
|
||||
end
|
||||
else
|
||||
--TODO: nudge momentum
|
||||
dy += (btn(3) and 0.125 or 0) - (btn(2) and 0.125 or 0)
|
||||
end
|
||||
end
|
||||
if self.launching then
|
||||
--TODO: advance launch mode
|
||||
|
||||
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 > -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
|
||||
|
||||
if not self.state.idle then
|
||||
end
|
||||
--TODO: gravity
|
||||
--TODO: crossing 64
|
||||
|
||||
if (y == 64 and dy == 0) st = phinstate_nrm
|
||||
-- test mode
|
||||
--if (btn(5)) self.exiting = true
|
||||
|
||||
self.x, self.y, self.dy, self.state = x, y, dy, st
|
||||
end
|
||||
|
||||
-- hitbox for current state
|
||||
@ -594,6 +686,7 @@ end
|
||||
|
||||
function toyphin:draw()
|
||||
local st, y = self.state, self.y
|
||||
pal(st.p, 1)
|
||||
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)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user