arm小程序删除答错自动清空
整理代码 框架跟进
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
|
||||
local int,rnd=math.floor,math.random
|
||||
local floor,rnd=math.floor,math.random
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -81,7 +81,7 @@ local function tapBoard(x,y,key)
|
||||
if pathVis then
|
||||
SYSFX.newShade(6,x-5,y-5,11,11,1,1,1)
|
||||
end
|
||||
x,y=int((x-320)/160)+1,int((y-40)/160)+1
|
||||
x,y=floor((x-320)/160)+1,floor((y-40)/160)+1
|
||||
end
|
||||
local b=board
|
||||
local moves=0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc,kb=love.graphics,love.keyboard
|
||||
local setColor,rectangle=gc.setColor,gc.rectangle
|
||||
|
||||
local int,abs=math.floor,math.abs
|
||||
local floor,abs=math.floor,math.abs
|
||||
local rnd,min=math.random,math.min
|
||||
local ins=table.insert
|
||||
local setFont=FONT.set
|
||||
@@ -400,7 +400,7 @@ function scene.draw()
|
||||
-- Board
|
||||
for i=1,16 do
|
||||
if board[i] then
|
||||
local x,y=1+(i-1)%4,int((i+3)/4)
|
||||
local x,y=1+(i-1)%4,floor((i+3)/4)
|
||||
local N=board[i]
|
||||
if i~=prevPos or prevSpawnTime==1 then
|
||||
if not invis or i==prevPos then
|
||||
@@ -460,7 +460,7 @@ function scene.draw()
|
||||
end
|
||||
|
||||
-- New tile position
|
||||
local x,y=1+(prevPos-1)%4,int((prevPos+3)/4)
|
||||
local x,y=1+(prevPos-1)%4,floor((prevPos+3)/4)
|
||||
gc.setLineWidth(8)
|
||||
setColor(.2,.8,0,prevSpawnTime)
|
||||
local d=25-prevSpawnTime*25
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local int=math.floor
|
||||
local floor=math.floor
|
||||
|
||||
local lines={
|
||||
{1,2,3},
|
||||
@@ -103,8 +103,8 @@ function scene.enter()
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
x,y=int((x-280)/80),int(y/80)
|
||||
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1
|
||||
x,y=floor((x-280)/80),floor(y/80)
|
||||
curX,curx=floor(x/3)+floor(y/3)*3+1,x%3+y%3*3+1
|
||||
if
|
||||
x<0 or x>8 or
|
||||
y<0 or y>8 or
|
||||
@@ -143,7 +143,7 @@ function scene.draw()
|
||||
-- Draw target area
|
||||
gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)*.1+.15)
|
||||
if target then
|
||||
gc.rectangle('fill',(target-1)%3*30,int((target-1)/3)*30,30,30)
|
||||
gc.rectangle('fill',(target-1)%3*30,floor((target-1)/3)*30,30,30)
|
||||
elseif not gameover then
|
||||
gc.rectangle('fill',0,0,90,90)
|
||||
end
|
||||
@@ -151,7 +151,7 @@ function scene.draw()
|
||||
-- Draw cursor
|
||||
if curX then
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,int((curX-1)/3)*30+int((curx-1)/3)*10-.5,11,11)
|
||||
gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,floor((curX-1)/3)*30+floor((curx-1)/3)*10-.5,11,11)
|
||||
end
|
||||
|
||||
gc.setLineWidth(.8)
|
||||
@@ -164,13 +164,13 @@ function scene.draw()
|
||||
else
|
||||
gc.setColor(COLOR.D)
|
||||
end
|
||||
gc.rectangle('fill',(X-1)%3*30,int((X-1)/3)*30,30,30)
|
||||
gc.rectangle('fill',(X-1)%3*30,floor((X-1)/3)*30,30,30)
|
||||
end
|
||||
for x=1,9 do
|
||||
local c=board[X][x]
|
||||
if c then
|
||||
local _x=(X-1)%3*30+(x-1)%3*10
|
||||
local _y=int((X-1)/3)*30+int((x-1)/3)*10
|
||||
local _y=floor((X-1)/3)*30+floor((x-1)/3)*10
|
||||
if c==0 then
|
||||
gc.setColor(1,.2,.2)
|
||||
gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5)
|
||||
@@ -195,7 +195,7 @@ function scene.draw()
|
||||
if lastX then
|
||||
gc.setColor(.5,1,.4,.8)
|
||||
local r=.5+.5*math.sin(TIME()*6.26)
|
||||
gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,int((lastX-1)/3)*30+int((lastx-1)/3)*10-r,10+2*r,10+2*r)
|
||||
gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,floor((lastX-1)/3)*30+floor((lastx-1)/3)*10-r,10+2*r,10+2*r)
|
||||
end
|
||||
gc.pop()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local int,ceil=math.floor,math.ceil
|
||||
local floor,ceil=math.floor,math.ceil
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local timing,time
|
||||
@@ -10,22 +10,22 @@ local function b8(i) return STRING.toOct(i).."₈" end
|
||||
local function b16(i) return STRING.toHex(i).."₁₆" end
|
||||
|
||||
local charData={
|
||||
["0"]={5,40, 15,40,20,35,20,5, 15,0, 5,0, 0,5, 0,35, 5,40},
|
||||
["1"]={2,8, 10,0, 10,40, 2,40, 1,40, 2,40, 18,40},
|
||||
["2"]={0,5, 5,0, 15,0, 20,5, 20,20,0,39, 0,40, 25,40},
|
||||
["3"]={0,5, 5,0, 15,0, 20,5, 20,15,15,20,5,20, 4,20, 5,20, 15,20,20,25,20,35,15,40,5,40,0,35},
|
||||
["4"]={20,20,0,20, 13,0, 13,40},
|
||||
["5"]={20,0, 0,0, 0,20, 5,15, 15,15,20,20,20,35,15,40,5,40, 0,35},
|
||||
["6"]={20,5, 15,0, 5,0, 0,5, 0,35, 5,40, 15,40,20,35,20,20,15,15,5,15, 0,20},
|
||||
["7"]={0,0, 20,0, 5,40},
|
||||
["8"]={5,0, 15,0, 20,5, 20,15,15,20,5,20, 0,25, 0,35, 5,40, 15,40,20,35,20,25,15,20,5,20,0,15,0,5,5,0},
|
||||
["9"]={20,15,15,20,5,20, 0,15, 0,5, 5,0, 15,0, 20,5, 20,35,15,40,5,40, 0,35},
|
||||
A={0,40, 10,0, 20,40,0,0, 20,40,15,20,5,20},
|
||||
B={0,40, 0,0, 15,0, 20,5, 20,15,15,20,0,20, -1,20,0,20, 15,20,20,25,20,35,15,40,0,40},
|
||||
C={20,35,15,40,5,40, 0,35, 0,5, 5,0, 15,0, 20,5},
|
||||
D={0,40, 0,0, 10,0, 20,10,20,30,10,40,0,40},
|
||||
E={20,0, 0,0, 0,20, 15,20,20,20,0,20, 0,40,20,40},
|
||||
F={20,0, 0,0, 0,20, 15,20,20,20,0,20, 0,40}
|
||||
["0"]={5,40,15,40,20,35,20,5,15,0,5,0,0,5,0,35,5,40},
|
||||
["1"]={2,8,10,0,10,40,2,40,1,40,2,40,18,40},
|
||||
["2"]={0,5,5,0,15,0,20,5,20,20,0,39,0,40,25,40},
|
||||
["3"]={0,5,5,0,15,0,20,5,20,15,15,20,5,20,4,20,5,20,15,20,20,25,20,35,15,40,5,40,0,35},
|
||||
["4"]={20,20,0,20,13,0,13,40},
|
||||
["5"]={20,0,0,0,0,20,5,15,15,15,20,20,20,35,15,40,5,40,0,35},
|
||||
["6"]={20,5,15,0,5,0,0,5,0,35,5,40,15,40,20,35,20,20,15,15,5,15,0,20},
|
||||
["7"]={0,0,20,0,5,40},
|
||||
["8"]={5,0,15,0,20,5,20,15,15,20,5,20,0,25,0,35,5,40,15,40,20,35,20,25,15,20,5,20,0,15,0,5,5,0},
|
||||
["9"]={20,15,15,20,5,20,0,15,0,5,5,0,15,0,20,5,20,35,15,40,5,40,0,35},
|
||||
["A"]={0,40,10,0,20,40,0,0,20,40,15,20,5,20},
|
||||
["B"]={0,40,0,0,15,0,20,5,20,15,15,20,0,20,-1,20,0,20,15,20,20,25,20,35,15,40,0,40},
|
||||
["C"]={20,35,15,40,5,40,0,35,0,5,5,0,15,0,20,5},
|
||||
["D"]={0,40,0,0,10,0,20,10,20,30,10,40,0,40},
|
||||
["E"]={20,0,0,0,0,20,15,20,20,20,0,20,0,40,20,40},
|
||||
["F"]={20,0,0,0,0,20,15,20,20,20,0,20,0,40}
|
||||
}
|
||||
local drawing
|
||||
local drawLines,drawVel,indexes
|
||||
@@ -66,7 +66,7 @@ local levels={
|
||||
end,nil,nil,
|
||||
function()-- 4~6 <+> [,20]
|
||||
local s=rnd(10,18)
|
||||
local a=rnd(s-9,int(s/2))
|
||||
local a=rnd(s-9,floor(s/2))
|
||||
return a.."+"..s-a,s,function()
|
||||
drawChar(a,600,200)
|
||||
drawChar(s-a,600,350)
|
||||
@@ -77,7 +77,7 @@ local levels={
|
||||
end,nil,nil,
|
||||
function()-- 7~9 <+> [,100]
|
||||
local s=rnd(22,99)
|
||||
local a=rnd(11,int(s/2))
|
||||
local a=rnd(11,floor(s/2))
|
||||
return a.."+"..s-a,s,function()
|
||||
drawChar(a,600,200)
|
||||
drawChar(s-a,600,350)
|
||||
@@ -98,7 +98,7 @@ local levels={
|
||||
end,nil,nil,
|
||||
function()-- 13~15 <-> [,100]
|
||||
local s=rnd(22,99)
|
||||
local a=rnd(11,int(s/2))
|
||||
local a=rnd(11,floor(s/2))
|
||||
return s.."-"..a,s-a,function()
|
||||
drawChar(s,600,200)
|
||||
drawChar(a,600,350)
|
||||
@@ -122,7 +122,7 @@ local levels={
|
||||
function()-- 21~25 <*> [,100]
|
||||
local b=rnd(21,89)
|
||||
local a=rnd(ceil(b/10),9)
|
||||
b=int(b/a)
|
||||
b=floor(b/a)
|
||||
return a.."*"..b,a*b,function()
|
||||
drawChar(a>b and a or b,600,200)
|
||||
drawChar(a>b and b or a,600,350)
|
||||
@@ -144,7 +144,7 @@ local levels={
|
||||
function()-- 29~33 </> [,100]
|
||||
local b=rnd(21,89)
|
||||
local a=rnd(ceil(b/10),9)
|
||||
b=int(b/a)
|
||||
b=floor(b/a)
|
||||
return a*b.."/"..a,b,function()
|
||||
drawChar(a*b,560,300,1,true)
|
||||
drawChar(a,400,300)
|
||||
@@ -172,7 +172,7 @@ local levels={
|
||||
local a=rnd(2,9)
|
||||
return {COLOR.N,b2(a)},a,function()
|
||||
local b=STRING.toBin(a)
|
||||
local l=math.floor(math.log(a,2)+1)
|
||||
local l=floor(math.log(a,2)+1)
|
||||
for i=1,l do
|
||||
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
|
||||
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
||||
@@ -191,7 +191,7 @@ local levels={
|
||||
local a=rnd(9,63)
|
||||
return {COLOR.lR,b8(a)},a,function()
|
||||
local b=STRING.toOct(a)
|
||||
local l=math.floor(math.log(a,8)+1)
|
||||
local l=floor(math.log(a,8)+1)
|
||||
for i=1,l do
|
||||
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
|
||||
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
||||
@@ -210,7 +210,7 @@ local levels={
|
||||
local a=rnd(17,255)
|
||||
return {COLOR.J,b16(a)},a,function()
|
||||
local b=STRING.toHex(a)
|
||||
local l=math.floor(math.log(a,16)+1)
|
||||
local l=floor(math.log(a,16)+1)
|
||||
for i=1,l do
|
||||
local c=string.sub(b,i,i)
|
||||
if ("0123456789"):find(c,nil,true) then
|
||||
@@ -233,14 +233,14 @@ local levels={
|
||||
end,nil,nil,
|
||||
function()-- 54~58 <b+>
|
||||
local s=rnd(9,31)
|
||||
local a=rnd(5,int(s/2))
|
||||
local a=rnd(5,floor(s/2))
|
||||
return {COLOR.N,b2(a),COLOR.Z,"+",COLOR.N,b2(s-a)},s,function()
|
||||
drawChar(tonumber(STRING.toBin(a)),220,200,.6)
|
||||
drawChar(tonumber(STRING.toBin(s-a)),220,335,.6)
|
||||
ins(drawLines,{0,470,300,470})
|
||||
ins(drawLines,{320,470,400,470})
|
||||
ins(drawLines,{360,430,360,510})
|
||||
local l=math.floor(math.log(s,2)+1)
|
||||
local l=floor(math.log(s,2)+1)
|
||||
for i=1,l do
|
||||
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
|
||||
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
|
||||
@@ -256,14 +256,14 @@ local levels={
|
||||
end,nil,nil,nil,nil,
|
||||
function()-- 59~62 <o+>
|
||||
local s=rnd(18,63)
|
||||
local a=rnd(9,int(s/2))
|
||||
local a=rnd(9,floor(s/2))
|
||||
return {COLOR.lR,b8(a),COLOR.Z,"+",COLOR.lR,b8(s-a)},s,function()
|
||||
drawChar(tonumber(STRING.toOct(a)),220,200,.6)
|
||||
drawChar(tonumber(STRING.toOct(s-a)),220,335,.6)
|
||||
ins(drawLines,{0,470,300,470})
|
||||
ins(drawLines,{320,470,400,470})
|
||||
ins(drawLines,{360,430,360,510})
|
||||
local l=math.floor(math.log(s,8)+1)
|
||||
local l=floor(math.log(s,8)+1)
|
||||
for i=1,l do
|
||||
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
|
||||
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
|
||||
@@ -279,14 +279,14 @@ local levels={
|
||||
end,nil,nil,nil,
|
||||
function()-- 63~65 <h+>
|
||||
local s=rnd(34,255)
|
||||
local a=rnd(17,int(s/2))
|
||||
local a=rnd(17,floor(s/2))
|
||||
return {COLOR.J,b16(a),COLOR.Z,"+",COLOR.J,b16(s-a)},s,function()
|
||||
drawChar(tonumber(STRING.toHex(a)),220,200,.6)
|
||||
drawChar(tonumber(STRING.toHex(s-a)),220,335,.6)
|
||||
ins(drawLines,{0,470,300,470})
|
||||
ins(drawLines,{320,470,400,470})
|
||||
ins(drawLines,{360,430,360,510})
|
||||
local l=math.floor(math.log(s,16)+1)
|
||||
local l=floor(math.log(s,16)+1)
|
||||
for i=1,l do
|
||||
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
|
||||
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
|
||||
@@ -346,27 +346,11 @@ local function check(val)
|
||||
until newQ~=question
|
||||
question=newQ
|
||||
SFX.play('reach')
|
||||
else
|
||||
if #tostring(val)==#tostring(answer) then
|
||||
SFX.play('finesseError_long')
|
||||
input=""
|
||||
inputTime=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function isDrawing() return drawing end -- for hiding widgets
|
||||
local function isntDrawing() return not drawing end
|
||||
local function drawDrawing()
|
||||
gc.setLineWidth(10)
|
||||
-- gc.setLineWidth(drawVel[i][(j+1)/2]) (couldn't implement without weird looking disjointed lines)
|
||||
gc.setLineJoin('bevel')
|
||||
for i=1,#drawLines do
|
||||
if #drawLines[i]>=4 then
|
||||
gc.line(drawLines[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local scene={}
|
||||
@@ -493,7 +477,15 @@ function scene.update(dt)
|
||||
end
|
||||
function scene.draw()
|
||||
gc.setColor(drawing and COLOR.Z or COLOR.H)
|
||||
drawDrawing()
|
||||
gc.setLineWidth(10)
|
||||
-- gc.setLineWidth(drawVel[i][(j+1)/2]) (couldn't implement without weird looking disjointed lines)
|
||||
gc.setLineJoin('bevel')
|
||||
for i=1,#drawLines do
|
||||
if #drawLines[i]>=4 then
|
||||
gc.line(drawLines[i])
|
||||
end
|
||||
end
|
||||
|
||||
gc.setColor(COLOR.Z)
|
||||
if not drawing then
|
||||
FONT.set(45)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local int,rnd,abs,sin,cos=math.floor,math.random,math.abs,math.sin,math.cos
|
||||
local floor,rnd,abs,sin,cos=math.floor,math.random,math.abs,math.sin,math.cos
|
||||
|
||||
local pow,ang
|
||||
local state,timer,score,combo
|
||||
@@ -61,7 +61,7 @@ function scene.update()
|
||||
end
|
||||
if x>1280 or y>720 then
|
||||
if score>0 then
|
||||
score=score-int(score/10)
|
||||
score=score-floor(score/10)
|
||||
end
|
||||
SFX.play('finesseError')
|
||||
combo=0
|
||||
@@ -110,7 +110,7 @@ function scene.draw()
|
||||
gc.setColor(1,1,.6)
|
||||
gc.print("x"..combo,300,80)
|
||||
end
|
||||
gc.setColor(COLOR[scoreColor[int(score/20)+1] or 'D'])
|
||||
gc.setColor(COLOR[scoreColor[floor(score/20)+1] or 'D'])
|
||||
gc.print(score,300,30)
|
||||
|
||||
-- Cannon ball
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc,kb,tc=love.graphics,love.keyboard,love.touch
|
||||
local rnd,int,abs=math.random,math.floor,math.abs
|
||||
local rnd,floor,abs=math.random,math.floor,math.abs
|
||||
local max,min=math.max,math.min
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
@@ -36,7 +36,7 @@ local function hurt(i)
|
||||
menu,play=1,false
|
||||
speed=speed*.5
|
||||
moveDir=0
|
||||
score=int(score)
|
||||
score=floor(score)
|
||||
SFX.play('clear_4')
|
||||
else
|
||||
SFX.play('clear_2')
|
||||
@@ -206,7 +206,7 @@ function scene.update(dt)
|
||||
local t=love.system.getClipboardText()
|
||||
if type(t)=='string' then
|
||||
t=t:lower():match("^s=(%d+)$")
|
||||
t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and int(tonumber(t))
|
||||
t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and floor(tonumber(t))
|
||||
end
|
||||
score=type(t)=='number' and t or 0
|
||||
life=1000
|
||||
@@ -276,8 +276,8 @@ function scene.draw()
|
||||
-- Draw menu
|
||||
if play then
|
||||
setFont(60)
|
||||
mStr(int(score),-300,-640)
|
||||
mStr(int(score),300,-640)
|
||||
mStr(floor(score),-300,-640)
|
||||
mStr(floor(score),300,-640)
|
||||
if score%1000>920 then
|
||||
gc.setColor(1,1,1,abs(score%1000-970)*8)
|
||||
setFont(70)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local rnd,int,max=math.random,math.floor,math.max
|
||||
local rnd,floor,max=math.random,math.floor,math.max
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
-- This mini-game is written for TI-nSpire CX CAS many years ago.
|
||||
@@ -176,7 +176,7 @@ end
|
||||
setmetatable(backColor,backColor)
|
||||
function scene.draw()
|
||||
-- Background
|
||||
local lv,height=int(camY/700),camY%700
|
||||
local lv,height=floor(camY/700),camY%700
|
||||
gc.setColor(backColor[lv+1] or COLOR.D)
|
||||
gc.rectangle('fill',0,720,1280,height-700)
|
||||
gc.setColor(backColor[lv+2] or COLOR.D)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
local int,rnd=math.floor,math.random
|
||||
local floor,rnd=math.floor,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local targets={
|
||||
@@ -274,7 +274,7 @@ function scene.mouseDown(x)
|
||||
end
|
||||
function scene.touchDown(x)
|
||||
if state==2 then return end
|
||||
x=int((x-300)/170+1)
|
||||
x=floor((x-300)/170+1)
|
||||
if x>=1 and x<=4 then
|
||||
touch(x)
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ local gc=love.graphics
|
||||
local gc_setColor,gc_rectangle,gc_draw=gc.setColor,gc.rectangle,gc.draw
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
local int,rnd,abs=math.floor,math.random,math.abs
|
||||
local floor,rnd,abs=math.floor,math.random,math.abs
|
||||
local max,min=math.max,math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
@@ -73,7 +73,7 @@ local function resetBoard()
|
||||
field.c,field.r=levels[level].c,levels[level].r
|
||||
|
||||
local total=field.r*field.c/2-- Total cell count
|
||||
local pool=TABLE.new(int(total/colors),colors)
|
||||
local pool=TABLE.new(floor(total/colors),colors)
|
||||
for i=1,total%colors do pool[i]=pool[i]+1 end
|
||||
for i=1,#pool do pool[i]=pool[i]*2 end
|
||||
field.remain=total
|
||||
@@ -186,7 +186,7 @@ local function tap(x,y)
|
||||
field.full=false
|
||||
|
||||
-- Score
|
||||
local s=1000+int(combo^.9)
|
||||
local s=1000+floor(combo^.9)
|
||||
score=score+s
|
||||
TEXT.show("+"..s,1205,600,20,'score')
|
||||
|
||||
@@ -206,7 +206,7 @@ local function tap(x,y)
|
||||
SFX.play('clear_4')
|
||||
TEXT.show("FULL COMBO",640,360,100,'beat',.626)
|
||||
comboTime=comboTime+3
|
||||
score=int(score*1.1)
|
||||
score=floor(score*1.1)
|
||||
end
|
||||
ins(progress,
|
||||
noComboBreak and
|
||||
@@ -270,8 +270,8 @@ function scene.keyDown(key,isRep)
|
||||
end
|
||||
end
|
||||
local function touch(x,y)
|
||||
x=int((x-field.x)/field.w*field.c+1)
|
||||
y=int((y-field.y)/field.h*field.r+1)
|
||||
x=floor((x-field.x)/field.w*field.c+1)
|
||||
y=floor((y-field.y)/field.h*field.r+1)
|
||||
tap(x,y)
|
||||
end
|
||||
function scene.mouseDown(x,y,k) if k==1 or k==2 or not k then touch(x,y) end end
|
||||
@@ -283,7 +283,7 @@ function scene.update(dt)
|
||||
if state==1 then
|
||||
time=TIME()-startTime
|
||||
comboTime=max(comboTime-dt,0)
|
||||
score1=score1+MATH.sign(score-score1)+int((score-score1)*.1+.5)
|
||||
score1=score1+MATH.sign(score-score1)+floor((score-score1)*.1+.5)
|
||||
end
|
||||
|
||||
for i=#lines,1,-1 do
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc,ms=love.graphics,love.mouse
|
||||
local int,rnd=math.floor,math.random
|
||||
local floor,rnd=math.floor,math.random
|
||||
local rem=table.remove
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
@@ -45,8 +45,8 @@ local function tapBoard(x,y)
|
||||
startTime=TIME()
|
||||
progress=0
|
||||
elseif state==1 then
|
||||
local X=int((x-320)/640*R)
|
||||
local Y=int((y-40)/640*R)
|
||||
local X=floor((x-320)/640*R)
|
||||
local Y=floor((y-40)/640*R)
|
||||
x=R*Y+X+1
|
||||
if board[x]==progress+1 then
|
||||
progress=progress+1
|
||||
|
||||
@@ -2,7 +2,7 @@ local gc=love.graphics
|
||||
local msIsDown,kbIsDown,tcTouches=love.mouse.isDown,love.keyboard.isDown,love.touch.getTouches
|
||||
local setColor,rectangle=gc.setColor,gc.rectangle
|
||||
|
||||
local int,rnd=math.floor,math.random
|
||||
local floor,rnd=math.floor,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
@@ -90,7 +90,7 @@ local function merge()
|
||||
until not connected[1]
|
||||
if count>1 then
|
||||
board[cy][cx]=chosen+1
|
||||
local getScore=3^(chosen-1)*math.min(int(.5+count/2),4)
|
||||
local getScore=3^(chosen-1)*math.min(floor(.5+count/2),4)
|
||||
score=score+getScore
|
||||
TEXT.show(getScore,cx*128+256,cy*128-40,40,'score')
|
||||
SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128)
|
||||
@@ -163,7 +163,7 @@ function scene.keyDown(key,isRep)
|
||||
end
|
||||
end
|
||||
function scene.mouseMove(x,y)
|
||||
cx,cy=int((x-192)/128),int((y+88)/128)
|
||||
cx,cy=floor((x-192)/128),floor((y+88)/128)
|
||||
if cx<1 or cx>5 or cy<1 or cy>5 then
|
||||
cx,cy=false
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local setColor,rectangle=gc.setColor,gc.rectangle
|
||||
|
||||
local int,rnd=math.floor,math.random
|
||||
local floor,rnd=math.floor,math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
@@ -270,7 +270,7 @@ function scene.enter()
|
||||
end
|
||||
|
||||
function scene.mouseClick(x,y)
|
||||
x,y=int((x-player.x)/100)+1,int((y-player.y)/100)+1
|
||||
x,y=floor((x-player.x)/100)+1,floor((y-player.y)/100)+1
|
||||
if x>=1 and x<=6 and y>=1 and y<=6 then
|
||||
player:click(y,x)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc,kb,sys=love.graphics,love.keyboard,love.system
|
||||
local int=math.floor
|
||||
local floor=math.floor
|
||||
local CUSTOMENV=CUSTOMENV
|
||||
|
||||
local sList={
|
||||
@@ -132,7 +132,7 @@ function scene.draw()
|
||||
|
||||
-- Sequence
|
||||
if #MISSION>0 then
|
||||
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(TIME()*6.26)%2)
|
||||
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,floor(TIME()*6.26)%2)
|
||||
gc.print("#"..#MISSION,70,220)
|
||||
end
|
||||
|
||||
@@ -157,14 +157,14 @@ function scene.draw()
|
||||
end end
|
||||
gc.pop()
|
||||
if #FIELD>1 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.setColor(1,1,floor(TIME()*6.26)%2)
|
||||
gc.print("+"..#FIELD-1,490,220)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sequence
|
||||
if #BAG>0 then
|
||||
gc.setColor(1,1,int(TIME()*6.26)%2)
|
||||
gc.setColor(1,1,floor(TIME()*6.26)%2)
|
||||
gc.print("#"..#BAG,615,220)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc,sys=love.graphics,love.system
|
||||
local kb=love.keyboard
|
||||
|
||||
local max,min,int=math.max,math.min,math.floor
|
||||
local max,min,floor=math.max,math.min,math.floor
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local FIELD=FIELD
|
||||
@@ -129,7 +129,7 @@ function scene.leave()
|
||||
end
|
||||
|
||||
function scene.mouseMove(x,y)
|
||||
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
|
||||
local sx,sy=floor((x-200)/30)+1,20-floor((y-60)/30)
|
||||
if sx>=1 and sx<=10 and sy>=1 and sy<=20 then
|
||||
penX,penY=sx,sy
|
||||
if curPen then
|
||||
@@ -434,7 +434,7 @@ function scene.draw()
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,7 do
|
||||
local skin=SETTING.skin[i]-1
|
||||
GC.mStr(text.block[i],580+(skin%8)*80,90+80*int(skin/8))
|
||||
GC.mStr(text.block[i],580+(skin%8)*80,90+80*floor(skin/8))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc,sys=love.graphics,love.system
|
||||
local kb=love.keyboard
|
||||
|
||||
local int,sin=math.floor,math.sin
|
||||
local floor,sin=math.floor,math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local scene={}
|
||||
@@ -151,7 +151,7 @@ function scene.draw()
|
||||
end
|
||||
if i<=j then
|
||||
setFont(35)
|
||||
local N=int(L[i]*.1)
|
||||
local N=floor(L[i]*.1)
|
||||
if N>0 then
|
||||
gc.setColor(libColor[set[N]])
|
||||
elseif L[i]>4 then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
|
||||
local int,abs=math.floor,math.abs
|
||||
local floor,abs=math.floor,math.abs
|
||||
local ins=table.insert
|
||||
local find=string.find
|
||||
|
||||
@@ -287,7 +287,7 @@ function scene.draw()
|
||||
|
||||
if searchWait>0 then
|
||||
local r=TIME()*2
|
||||
local R=int(r)%7+1
|
||||
local R=floor(r)%7+1
|
||||
gc.setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc.draw(TEXTURE.miniBlock[R],821,140,TIME()*10%6.2832,7,7,2*DSCP[R][0][2]+1,2*(#BLOCKS[R][0]-DSCP[R][0][1])-1)
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ local gc_rectangle,gc_circle=GC.rectangle,GC.circle
|
||||
|
||||
local isDown=love.keyboard.isDown
|
||||
|
||||
local int,max,min=math.floor,math.max,math.min
|
||||
local floor,max,min=math.floor,math.max,math.min
|
||||
|
||||
local mStr=GC.mStr
|
||||
|
||||
@@ -169,7 +169,7 @@ local function press(x,y)
|
||||
end
|
||||
|
||||
function scene.touchDown(x,y)
|
||||
x,y=int((x-pad.x)/80),int((y-pad.y)/80)
|
||||
x,y=floor((x-pad.x)/80),floor((y-pad.y)/80)
|
||||
if x>=0 and x<=8 and y>=0 and y<=7 then
|
||||
press(x,y+1)
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ local gc_print,gc_printf=GC.print,GC.printf
|
||||
local ms,kb,tc=love.mouse,love.keyboard,love.touch
|
||||
|
||||
local max,min=math.max,math.min
|
||||
local int,abs=math.floor,math.abs
|
||||
local floor,abs=math.floor,math.abs
|
||||
|
||||
local mapCam={
|
||||
sel=false,-- Selected mode ID
|
||||
@@ -319,7 +319,7 @@ function scene.draw()
|
||||
elseif L[1] then
|
||||
for i=1,#L do
|
||||
local t=M.scoreDisp(L[i])
|
||||
local f=int((30-#t*.5)/5)*5
|
||||
local f=floor((30-#t*.5)/5)*5
|
||||
setFont(f)
|
||||
gc_print(t,955,275+25*i+17-f*.7)
|
||||
_=L[i].date
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local int=math.floor
|
||||
local floor=math.floor
|
||||
local sin=math.sin
|
||||
|
||||
local selRS
|
||||
@@ -119,7 +119,7 @@ scene.widgetList={
|
||||
SETTING.face[i]=0
|
||||
end
|
||||
for i=1,7 do
|
||||
minoRot0[i]=(int(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853
|
||||
minoRot0[i]=(floor(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853
|
||||
end
|
||||
SFX.play('hold')
|
||||
end},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc,ms=love.graphics,love.mouse
|
||||
local int,sin=math.floor,math.sin
|
||||
local floor,sin=math.floor,math.sin
|
||||
local VK_ORG=VK_ORG
|
||||
|
||||
local scene={}
|
||||
@@ -74,7 +74,7 @@ end
|
||||
function scene.touchUp()
|
||||
if selected then
|
||||
local B=VK_ORG[selected]
|
||||
B.x,B.y=int(B.x/snapUnit+.5)*snapUnit,int(B.y/snapUnit+.5)*snapUnit
|
||||
B.x,B.y=floor(B.x/snapUnit+.5)*snapUnit,floor(B.y/snapUnit+.5)*snapUnit
|
||||
end
|
||||
end
|
||||
function scene.touchMove(_,_,dx,dy)
|
||||
|
||||
Reference in New Issue
Block a user