Skip to content

Commit

Permalink
框架跟进
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Sep 20, 2023
1 parent 716a0dd commit 8a4a24d
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 3 files
+4 −4 bgm.lua
+58 −12 mathExtend.lua
+9 −9 tableExtend.lua
2 changes: 1 addition & 1 deletion assets/game/mechanicLib/common/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local timer_drawFunc={
float=function(_,time,time0)
FONT.set(100,'bold')
local text=("%.1f"):format(time/1000)
local alpha=MATH.listMix(floatMixList,time/time0)
local alpha=MATH.listLerp(floatMixList,time/time0)
gc.setColor(0,0,0,alpha)
GC.mStr(text,-2,-69,'center')
GC.mStr(text,-1,-68,'center')
Expand Down
20 changes: 10 additions & 10 deletions assets/game/mechanicLib/mino/survivor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ function survivor.b2b_event_always(P)

local wave=md.wave
md.curWaveTime=math.floor(
wave<=40 and MATH.interpolate(wave,0,6000,40,4000) or
wave<=80 and MATH.interpolate(wave,40,4000,80,1500) or
max(MATH.interpolate(wave,80,1500,150,800),800)
wave<=40 and MATH.interpolate(0,6000,40,4000,wave) or
wave<=80 and MATH.interpolate(40,4000,80,1500,wave) or
max(MATH.interpolate(80,1500,150,800,wave),800)
)
md.waveTimer=md.curWaveTime
GAME.send(nil,GAME.initAtk{
Expand All @@ -66,8 +66,8 @@ function survivor.cheese_event_always(P)

local wave=md.wave
md.curWaveTime=math.floor(
wave<=80 and MATH.interpolate(wave,0,3000,80,2000) or
wave<=150 and MATH.interpolate(wave,80,2000,150,2500) or
wave<=80 and MATH.interpolate(0,3000,80,2000,wave) or
wave<=150 and MATH.interpolate(80,2000,150,2500,wave) or
math.max(2000-(wave-150)*10,1000)
)
md.waveTimer=md.curWaveTime
Expand All @@ -79,8 +79,8 @@ function survivor.cheese_event_always(P)
time=wave<50 and 100e3/(50+wave)-1000 or 0,
fatal=MATH.clamp(
(
wave<100 and MATH.interpolate(wave,0,20,100,60) or
wave<200 and MATH.interpolate(wave,100,60,200,100) or
wave<100 and MATH.interpolate(0,20,100,60,wave) or
wave<200 and MATH.interpolate(100,60,200,100,wave) or
100
)+math.floor((P:random()*2-1)*min(wave,100)/5),
0,100
Expand All @@ -100,9 +100,9 @@ function survivor.spike_event_always(P)

local wave=md.wave
md.curWaveTime=floor(
wave<=10 and MATH.interpolate(wave,0,20e3,10,15e3) or
wave<=30 and MATH.interpolate(wave,10,15e3,30,12e3) or
max(MATH.interpolate(wave,30,12e3,60,10e3),10e3)
wave<=10 and MATH.interpolate(0,20e3,10,15e3,wave) or
wave<=30 and MATH.interpolate(10,15e3,30,12e3,wave) or
max(MATH.interpolate(30,12e3,60,10e3,wave),10e3)
)
md.waveTimer=md.curWaveTime
for i=1,3 do
Expand Down
20 changes: 12 additions & 8 deletions assets/game/minomap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_draw,gc_line=gc.draw,gc.line
local gc_circle,gc_polygon=gc.circle,gc.polygon

local linear=MATH.interpolate
local expAppr=MATH.expApproach
local dist=MATH.distance
local tau=MATH.tau


-- Y X
-- *
Expand Down Expand Up @@ -104,7 +109,7 @@ local bridges={}
local function _newBridge(m1,m2)
local x1,y1=m1.x,m1.y
local x2,y2=m2.x,m2.y
local dist=MATH.distance(x1,y1,x2,y2)
local dist=dist(x1,y1,x2,y2)

-- Cut in-mode parts
local p1,p2=(m1.r*1.2)/dist,1-(m2.r*1.2)/dist
Expand Down Expand Up @@ -237,7 +242,7 @@ local function _onMode(x,y)
x,y=SCR.xOy_m:inverseTransformPoint(x,y)
x,y=cam.transform:inverseTransformPoint(x,y-100)
for _,m in next,modes do
if m.enable and MATH.distance(x,y,m.x,m.y)<m.r*1.26 then
if m.enable and dist(x,y,m.x,m.y)<m.r*1.26 then
return m
end
end
Expand Down Expand Up @@ -316,7 +321,7 @@ function map:update(dt)
-- end
for _,m in next,modes do
if m.enable then
m.active=MATH.expApproach(m.active,(m==focused) and 1 or 0,dt*6)
m.active=expAppr(m.active,(m==focused) and 1 or 0,dt*6)
end
end
for _,b in next,bridges do
Expand Down Expand Up @@ -366,7 +371,6 @@ function map:update(dt)
end
end

local tau=MATH.tau
function map:draw()
gc_replaceTransform(SCR.xOy_m)
gc_translate(0,100)
Expand All @@ -377,8 +381,8 @@ function map:draw()
if b.enable then
local x1,y1,x2,y2=b.x1,b.y1,b.x2,b.y2
if animations[b] then
local t=MATH.expApproach(0,1,animations[b].t*2.6)
x2,y2=MATH.interpolate(t,0,x1,1,x2),MATH.interpolate(t,0,y1,1,y2)
local t=expAppr(0,1,animations[b].t*2.6)
x2,y2=linear(0,x1,1,x2,t),linear(0,y1,1,y2,t)
end
if x1~=x2 or y1~=y2 then
gc_setColor(1,1,1,.8)
Expand All @@ -390,7 +394,7 @@ function map:draw()
for i=0,.75,.25 do
local t=(b.timer/2.6+i)%1
gc_setColor(1,1,1,-t*(t-1)*4)
gc_circle('fill',MATH.interpolate(t,0,x1,1,x2),MATH.interpolate(t,0,y1,1,y2),6,6)
gc_circle('fill',linear(0,x1,1,x2,t),linear(0,y1,1,y2,t),6,6)
end
end
end
Expand All @@ -403,7 +407,7 @@ function map:draw()
gc_translate(m.x,m.y)
gc_scale(1+m.active*.1)
if animations[m] then
gc_scale(MATH.expApproach(0,1,animations[m].t*6.26))
gc_scale(expAppr(0,1,animations[m].t*6.26))
end
gc_rotate(-cam.a)

Expand Down
4 changes: 2 additions & 2 deletions assets/game/mode/mino/exterior/sprint_hide_40.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ return {
event={
afterSpawn=function(P)
local pieceCount=MATH.clamp(#P.dropHistory,0,99)
P.settings.pieceVisTime=math.floor(MATH.interpolate(pieceCount,0,6e3,99,2e3))
P.settings.pieceFadeTime=math.floor(MATH.interpolate(pieceCount,0,3e3,99,1e3))
P.settings.pieceVisTime=math.floor(MATH.interpolate(0,6e3,99,2e3,pieceCount))
P.settings.pieceFadeTime=math.floor(MATH.interpolate(0,3e3,99,1e3,pieceCount))
end,
afterClear={
mechLib.mino.sprint.event_afterClear[40],
Expand Down
6 changes: 3 additions & 3 deletions assets/game/mode/mino/interior/dig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ return {
if P and P.finished=='AC' then
PROGRESS.setInteriorScore('dig',
P.gameTime<=30e3 and 160 or
P.gameTime<=60e3 and MATH.interpolate(P.gameTime,60e3,120,30e3,160) or
P.gameTime<=120e3 and MATH.interpolate(P.gameTime,120e3,90,60e3,120) or
math.max(MATH.interpolate(P.gameTime,200e3,40,120e3,90),0)
P.gameTime<=60e3 and MATH.interpolate(60e3,120,30e3,160,P.gameTime) or
P.gameTime<=120e3 and MATH.interpolate(120e3,90,60e3,120,P.gameTime) or
math.max(MATH.interpolate(200e3,40,120e3,90,P.gameTime),0)
)
end
end,
Expand Down
8 changes: 4 additions & 4 deletions assets/game/mode/mino/interior/marathon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ return {
PROGRESS.setInteriorScore('sprint',math.min(P.modeData.stat.line*4/3,40))
PROGRESS.setInteriorScore('marathon',
P.modeData.stat.line>=200 and 160 or
P.modeData.stat.line>=130 and MATH.interpolate(P.modeData.stat.line,130,120,200,160) or
P.modeData.stat.line>=80 and MATH.interpolate(P.modeData.stat.line,80,90,130,120) or
P.modeData.stat.line>=40 and MATH.interpolate(P.modeData.stat.line,40,40,80,90) or
MATH.interpolate(P.modeData.stat.line,0,0,40,40)
P.modeData.stat.line>=130 and MATH.interpolate(130,120,200,160,P.modeData.stat.line) or
P.modeData.stat.line>=80 and MATH.interpolate(80,90,130,120,P.modeData.stat.line) or
P.modeData.stat.line>=40 and MATH.interpolate(40,40,80,90,P.modeData.stat.line) or
MATH.interpolate(0,0,40,40,P.modeData.stat.line)
)
end,
resultPage=function(time)
Expand Down
6 changes: 3 additions & 3 deletions assets/game/mode/mino/interior/sprint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ return {
PROGRESS.setInteriorScore('marathon',30)
PROGRESS.setInteriorScore('sprint',
P.gameTime<60e3 and 200 or
P.gameTime<90e3 and MATH.interpolate(P.gameTime,90e3,140,60e3,200) or
P.gameTime<180e3 and MATH.interpolate(P.gameTime,180e3,90,90e3,140) or
P.gameTime<300e3 and MATH.interpolate(P.gameTime,300e3,40,180e3,90) or
P.gameTime<90e3 and MATH.interpolate(90e3,140,60e3,200,P.gameTime) or
P.gameTime<180e3 and MATH.interpolate(180e3,90,90e3,140,P.gameTime) or
P.gameTime<300e3 and MATH.interpolate(300e3,40,180e3,90,P.gameTime) or
40
)
else
Expand Down
4 changes: 2 additions & 2 deletions assets/scene/zeta_input_method.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ local function parseStroke(input)-- 横 竖 撇 捺 折
if s[1]<areaX-areaR and s[#s-1]<areaX-areaR or s[1]>areaX+areaR and s[#s-1]>areaX+areaR then return end
if s[2]<areaY-areaR and s[#s]<areaY-areaR or s[2]>areaY+areaR and s[#s]>areaY+areaR then return end

w[1]=-w[5]+min(MATH.interpolate(width/height,1/2.6,0,2.6,1),1)
w[2]=-w[5]+min(MATH.interpolate(height/width,1.6,0,2.6,1),1)
w[1]=-w[5]+min(MATH.interpolate(1/2.6,0,2.6,1,width/height),1)
w[2]=-w[5]+min(MATH.interpolate(1.6,0,2.6,1,height/width),1)
w[3]=-w[5]*.62+1-abs(dir/pi-.8)*3
w[4]=-w[5]*.62+1-abs(dir/pi-.4)

Expand Down

0 comments on commit 8a4a24d

Please sign in to comment.