修复没开濒死特效时濒死音效也没有,整理代码修复几个之前重构导致的变量泄露
This commit is contained in:
@@ -3,8 +3,9 @@ local data=love.data
|
|||||||
|
|
||||||
local fs=love.filesystem
|
local fs=love.filesystem
|
||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local gc_setColor,gc_circle=gc.setColor,gc.circle
|
local gc_setColor,gc_setLineWidth,gc_setShader=gc.setColor,gc.setLineWidth,gc.setShader
|
||||||
|
local gc_push,gc_pop,gc_origin=gc.push,gc.pop,gc.origin
|
||||||
|
local gc_draw,gc_rectangle,gc_circle=gc.draw,gc.rectangle,gc.circle
|
||||||
local max,int,rnd=math.max,math.floor,math.random
|
local max,int,rnd=math.max,math.floor,math.random
|
||||||
local sub=string.sub
|
local sub=string.sub
|
||||||
local char,byte=string.char,string.byte
|
local char,byte=string.char,string.byte
|
||||||
@@ -361,7 +362,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Game draw
|
--Virtualkey
|
||||||
local VK=virtualkey
|
local VK=virtualkey
|
||||||
function drawVirtualkeys()
|
function drawVirtualkeys()
|
||||||
if SETTING.VKSwitch then
|
if SETTING.VKSwitch then
|
||||||
@@ -373,11 +374,11 @@ function drawVirtualkeys()
|
|||||||
if VK[i].ava then
|
if VK[i].ava then
|
||||||
local B=VK[i]
|
local B=VK[i]
|
||||||
gc_setColor(1,1,1,a)
|
gc_setColor(1,1,1,a)
|
||||||
gc.setLineWidth(B.r*.07)
|
gc_setLineWidth(B.r*.07)
|
||||||
gc_circle("line",B.x,B.y,B.r,10)--Button outline
|
gc_circle("line",B.x,B.y,B.r,10)--Button outline
|
||||||
_=VK[i].pressTime
|
_=VK[i].pressTime
|
||||||
gc_setColor(B.color[1],B.color[2],B.color[3],a)
|
gc_setColor(B.color[1],B.color[2],B.color[3],a)
|
||||||
gc.draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--Icon
|
gc_draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--Icon
|
||||||
if _>0 then
|
if _>0 then
|
||||||
gc_setColor(1,1,1,a*_*.08)
|
gc_setColor(1,1,1,a*_*.08)
|
||||||
gc_circle("fill",B.x,B.y,B.r*.94,10)--Glow when press
|
gc_circle("fill",B.x,B.y,B.r*.94,10)--Glow when press
|
||||||
@@ -390,7 +391,7 @@ function drawVirtualkeys()
|
|||||||
if VK[i].ava then
|
if VK[i].ava then
|
||||||
local B=VK[i]
|
local B=VK[i]
|
||||||
gc_setColor(1,1,1,a)
|
gc_setColor(1,1,1,a)
|
||||||
gc.setLineWidth(B.r*.07)
|
gc_setLineWidth(B.r*.07)
|
||||||
gc_circle("line",B.x,B.y,B.r,10)
|
gc_circle("line",B.x,B.y,B.r,10)
|
||||||
_=VK[i].pressTime
|
_=VK[i].pressTime
|
||||||
if _>0 then
|
if _>0 then
|
||||||
@@ -446,7 +447,7 @@ end
|
|||||||
function updateVirtualkey()
|
function updateVirtualkey()
|
||||||
if SETTING.VKSwitch then
|
if SETTING.VKSwitch then
|
||||||
for i=1,#VK do
|
for i=1,#VK do
|
||||||
_=VK[i]
|
local _=VK[i]
|
||||||
if _.pressTime>0 then
|
if _.pressTime>0 then
|
||||||
_.pressTime=_.pressTime-1
|
_.pressTime=_.pressTime-1
|
||||||
end
|
end
|
||||||
@@ -795,7 +796,7 @@ end
|
|||||||
function checkWarning()
|
function checkWarning()
|
||||||
local P1=PLAYERS[1]
|
local P1=PLAYERS[1]
|
||||||
if P1.alive then
|
if P1.alive then
|
||||||
if GAME.frame%26==0 and SETTING.warn then
|
if GAME.frame%26==0 then
|
||||||
local F=P1.field
|
local F=P1.field
|
||||||
local height=0--Max height of row 4~7
|
local height=0--Max height of row 4~7
|
||||||
for x=4,7 do
|
for x=4,7 do
|
||||||
@@ -810,7 +811,7 @@ function checkWarning()
|
|||||||
end
|
end
|
||||||
GAME.warnLVL0=math.log(height-15+P1.atkBuffer.sum*.8)
|
GAME.warnLVL0=math.log(height-15+P1.atkBuffer.sum*.8)
|
||||||
end
|
end
|
||||||
_=GAME.warnLVL
|
local _=GAME.warnLVL
|
||||||
if _<GAME.warnLVL0 then
|
if _<GAME.warnLVL0 then
|
||||||
_=_*.95+GAME.warnLVL0*.05
|
_=_*.95+GAME.warnLVL0*.05
|
||||||
elseif _>0 then
|
elseif _>0 then
|
||||||
@@ -969,6 +970,21 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Game draw
|
||||||
|
function drawWarning()
|
||||||
|
if SETTING.warn and GAME.warnLVL>0 then
|
||||||
|
gc_push("transform")
|
||||||
|
gc_origin()
|
||||||
|
SHADER.warning:send("level",GAME.warnLVL)
|
||||||
|
gc_setShader(SHADER.warning)
|
||||||
|
gc_rectangle("fill",0,0,SCR.w,SCR.h)
|
||||||
|
gc_setShader()
|
||||||
|
gc_pop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Widget function shortcuts
|
--Widget function shortcuts
|
||||||
function backScene()SCN.back()end
|
function backScene()SCN.back()end
|
||||||
do--function goScene(name,style)
|
do--function goScene(name,style)
|
||||||
|
|||||||
@@ -312,15 +312,7 @@ function scene.draw()
|
|||||||
drawVirtualkeys()
|
drawVirtualkeys()
|
||||||
|
|
||||||
--Warning
|
--Warning
|
||||||
gc.push("transform")
|
drawWarning()
|
||||||
gc.origin()
|
|
||||||
if GAME.warnLVL>0 then
|
|
||||||
SHADER.warning:send("level",GAME.warnLVL)
|
|
||||||
gc.setShader(SHADER.warning)
|
|
||||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
|
||||||
gc.setShader()
|
|
||||||
end
|
|
||||||
gc.pop()
|
|
||||||
|
|
||||||
--New message
|
--New message
|
||||||
if textBox.new and hideChatBox then
|
if textBox.new and hideChatBox then
|
||||||
|
|||||||
@@ -226,15 +226,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Warning
|
--Warning
|
||||||
gc.push("transform")
|
drawWarning()
|
||||||
gc.origin()
|
|
||||||
if GAME.warnLVL>0 then
|
|
||||||
SHADER.warning:send("level",GAME.warnLVL)
|
|
||||||
gc.setShader(SHADER.warning)
|
|
||||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
|
||||||
gc.setShader()
|
|
||||||
end
|
|
||||||
gc.pop()
|
|
||||||
end
|
end
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newKey{name="restart",fText="R",x=380,y=35,w=60,font=40,code=restart},
|
WIDGET.newKey{name="restart",fText="R",x=380,y=35,w=60,font=40,code=restart},
|
||||||
|
|||||||
Reference in New Issue
Block a user