整理代码
This commit is contained in:
@@ -1,18 +1,19 @@
|
|||||||
local floatWheel=0
|
local love=love
|
||||||
|
local max,min=math.max,math.min
|
||||||
|
local float=0
|
||||||
return function(y,key1,key2)
|
return function(y,key1,key2)
|
||||||
if y>0 then
|
if y>0 then
|
||||||
if floatWheel<0 then floatWheel=0 end
|
float=max(float,0)+y^1.2
|
||||||
floatWheel=floatWheel+y^1.2
|
|
||||||
elseif y<0 then
|
elseif y<0 then
|
||||||
if floatWheel>0 then floatWheel=0 end
|
if float>0 then float=0 end
|
||||||
floatWheel=floatWheel-(-y)^1.2
|
float=min(float,0)-(-y)^1.2
|
||||||
end
|
end
|
||||||
while floatWheel>=1 do
|
while float>=1 do
|
||||||
love.keypressed(key1 or"up")
|
love.keypressed(key1 or"up")
|
||||||
floatWheel=floatWheel-1
|
float=float-1
|
||||||
end
|
end
|
||||||
while floatWheel<=-1 do
|
while float<=-1 do
|
||||||
love.keypressed(key2 or"down")
|
love.keypressed(key2 or"down")
|
||||||
floatWheel=floatWheel+1
|
float=float+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user