Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30bbf1b1db |
62
button.lua
@@ -58,15 +58,15 @@ Buttons={
|
||||
{x=540,y=490,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[8]end,code=function()gamepadsetting,keysetting=8 end,up=16,down=18,left=8,right=28},
|
||||
{x=540,y=550,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[9]end,code=function()gamepadsetting,keysetting=9 end,up=17,down=27,left=9,right=28},
|
||||
--10~18
|
||||
{x=745,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,hold=true,left=10,right=20,down=23},
|
||||
{x=910,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,hold=true,left=19,right=21,down=24},
|
||||
{x=960,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,hold=true,left=20,right=22,down=25},
|
||||
{x=1125,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,hold=true,left=21,down=26},
|
||||
{x=745,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,left=10,right=20,down=23},
|
||||
{x=910,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,left=19,right=21,down=24},
|
||||
{x=960,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,left=20,right=22,down=25},
|
||||
{x=1125,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,left=21,down=26},
|
||||
--19~22
|
||||
{x=745,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sddas=(setting.sddas-1)%11 end,hold=true,up=19,down=28,left=10,right=24},
|
||||
{x=910,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sddas=(setting.sddas+1)%11 end,hold=true,up=20,down=28,left=23,right=25},
|
||||
{x=960,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sdarr=(setting.sdarr-1)%6 end,hold=true,up=21,down=28,left=24,right=26},
|
||||
{x=1125,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sdarr=(setting.sdarr+1)%4 end,hold=true,up=22,down=28,left=25},
|
||||
{x=745,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sddas=(setting.sddas-1)%11 end,up=19,down=28,left=10,right=24},
|
||||
{x=910,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sddas=(setting.sddas+1)%11 end,up=20,down=28,left=23,right=25},
|
||||
{x=960,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sdarr=(setting.sdarr-1)%6 end,up=21,down=28,left=24,right=26},
|
||||
{x=1125,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sdarr=(setting.sdarr+1)%4 end,up=22,down=28,left=25},
|
||||
--23~26
|
||||
{x=405,y=630,w=130,h=60,rgb=color.white,t="Reset",code=function()for i=1,#setting.key do setting.key[i]=gameEnv0.key[i] end end,up=9,right=28},
|
||||
{x=840,y=630,w=180,h=60,rgb=color.white,t="Back",code=function()keysetting=nil;back()end,up=9,left=27},
|
||||
@@ -78,32 +78,34 @@ Buttons={
|
||||
stat={
|
||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end},
|
||||
},
|
||||
sel=nil,--selected button Obj
|
||||
pressing=0,--pressing time
|
||||
sel=nil,--selected button id(integer)
|
||||
}
|
||||
for k,v in pairs(Buttons)do
|
||||
if type(v)=="table"then
|
||||
for i=1,#v do
|
||||
v[i].alpha=0
|
||||
end
|
||||
for i=1,#v do
|
||||
v[i].alpha=0
|
||||
end
|
||||
end
|
||||
|
||||
gamePad={
|
||||
{x=0,y=0,r=60},--moveLeft
|
||||
{x=0,y=0,r=60},--moveRight
|
||||
{x=0,y=0,r=60},--rotLeft
|
||||
{x=0,y=0,r=60},--rotRight
|
||||
{x=0,y=0,r=60},--rotFlip
|
||||
{x=0,y=0,r=60},--hardDrop
|
||||
{x=0,y=0,r=60},--softDrop
|
||||
{x=0,y=0,r=60},--hold
|
||||
{x=0,y=0,r=60},--restart
|
||||
{x=0,y=0,r=60},--toLeft
|
||||
{x=0,y=0,r=60},--toRight
|
||||
{x=0,y=0,r=60},--toDown
|
||||
gamepad={
|
||||
{x=80,y=-80,r=80},--moveLeft
|
||||
{x=240,y=-80,r=80},--moveRight
|
||||
{x=-240,y=-80,r=80},--rotRight
|
||||
{x=-400,y=-80,r=80},--rotLeft
|
||||
{x=-240,y=-240,r=80},--rotFlip
|
||||
{x=-80,y=-80,r=80},--hardDrop
|
||||
{x=-80,y=-240,r=80},--softDrop
|
||||
{x=-80,y=-400,r=80},--hold
|
||||
{x=80,y=80,r=80},--restart
|
||||
}
|
||||
for i=1,#gamePad do
|
||||
gamePad[i].press=false
|
||||
gamePad[i].r=gamePad[i].r^2
|
||||
--[[
|
||||
{x=0,y=0,r=0},--toLeft
|
||||
{x=0,y=0,r=0},--toRight
|
||||
{x=0,y=0,r=0},--toDown
|
||||
]]
|
||||
for i=1,#gamepad do
|
||||
gamepad[i].press=false
|
||||
if gamepad[i].x<0 then gamepad[i].x=1280+gamepad[i].x end
|
||||
if gamepad[i].y<0 then gamepad[i].y=720+gamepad[i].y end
|
||||
gamepad[i].r0=gamepad[i].r
|
||||
gamepad[i].r=gamepad[i].r0^2
|
||||
end
|
||||
2
conf.lua
@@ -9,7 +9,7 @@ function love.conf(t)
|
||||
t.gammacorrect=true
|
||||
-- t.audio.mixwithsystem=true--Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||
|
||||
t.window.title="Techmino Alpha"
|
||||
t.window.title="Techmino V0.2"
|
||||
t.window.icon="/image/icon.png"
|
||||
t.window.width=1280
|
||||
t.window.height=720
|
||||
|
||||
99
control.lua
@@ -1,5 +1,4 @@
|
||||
function buttonControl_key(i)
|
||||
mouseShow=false
|
||||
if i=="up"or i=="down"or i=="left"or i=="right"then
|
||||
if not Buttons.sel then
|
||||
Buttons.sel=1
|
||||
@@ -14,10 +13,10 @@ function buttonControl_key(i)
|
||||
sysSFX("button")
|
||||
end
|
||||
end
|
||||
mouseShow=false
|
||||
end
|
||||
function buttonControl_gamepad(i)
|
||||
if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
|
||||
|
||||
if not Buttons.sel then
|
||||
Buttons.sel=1
|
||||
mouseShow=false
|
||||
@@ -27,65 +26,91 @@ function buttonControl_gamepad(i)
|
||||
elseif i=="start"then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons[scene][Buttons.sel]
|
||||
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||
B.code()
|
||||
B.alpha=1
|
||||
sysSFX("button")
|
||||
end
|
||||
end
|
||||
mouseShow=false
|
||||
end
|
||||
|
||||
function love.mousemoved(x,y)
|
||||
mouseShow=true
|
||||
mx,my=mouseConvert(x,y)
|
||||
Buttons.sel=nil
|
||||
for i=1,#Buttons[scene]do
|
||||
local B=Buttons[scene][i]
|
||||
if not(B.hide and B.hide())then
|
||||
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then
|
||||
Buttons.sel=i
|
||||
return nil
|
||||
function love.mousemoved(x,y,dx,dy,t)
|
||||
if not t then
|
||||
mouseShow=true
|
||||
mx,my=convert(x,y)
|
||||
Buttons.sel=nil
|
||||
for i=1,#Buttons[scene]do
|
||||
local B=Buttons[scene][i]
|
||||
if not(B.hide and B.hide())then
|
||||
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then
|
||||
Buttons.sel=i
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if not Buttons.sel then Buttons.pressing=0 end
|
||||
end
|
||||
function love.mousepressed(x,y,k)
|
||||
mouseShow=true
|
||||
mx,my=mouseConvert(x,y)
|
||||
if mouseDown[scene]then mouseDown[scene](mx,my,k)end
|
||||
if k==1 then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons[scene][Buttons.sel]
|
||||
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
love.mousemoved(x,y)
|
||||
sysSFX("button")
|
||||
function love.mousepressed(x,y,k,t,num)
|
||||
if not t then
|
||||
mouseShow=true
|
||||
mx,my=convert(x,y)
|
||||
if mouseDown[scene]then mouseDown[scene](mx,my,k)end
|
||||
if k==1 then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons[scene][Buttons.sel]
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
love.mousemoved(x,y)
|
||||
sysSFX("button")
|
||||
end
|
||||
elseif k==3 then
|
||||
back()
|
||||
end
|
||||
elseif k==3 then
|
||||
back()
|
||||
end
|
||||
end
|
||||
function love.mousereleased(x,y,k)
|
||||
Buttons.pressing=0
|
||||
function love.mousereleased(x,y,k,t,num)
|
||||
end
|
||||
|
||||
function love.touchpressed(id,x,y)
|
||||
ins(touches,id)
|
||||
if not touching then
|
||||
touching=id
|
||||
love.mousemoved(x,y)
|
||||
end
|
||||
mouseShow=false
|
||||
end
|
||||
function love.touchrealeased(id,x,y)
|
||||
for i=1,#touches do
|
||||
if touches[i]==id then rem(touches,i)break end
|
||||
function love.touchreleased(id,x,y)
|
||||
if id==touching then
|
||||
touching=nil
|
||||
if Buttons.sel then
|
||||
local B=Buttons[scene][Buttons.sel]
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
end
|
||||
Buttons.sel=nil
|
||||
mouseShow=false
|
||||
end
|
||||
if scene=="play"and #tc.getTouches()==0 then
|
||||
for K=1,#gamepad do
|
||||
if gamepad[K].press then
|
||||
releaseKey(K)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function love.touchmoved(id,x,y,dx,dy)
|
||||
love.mousemoved(x,y)
|
||||
mouseShow=false
|
||||
if not Buttons.sel then
|
||||
touching=nil
|
||||
end
|
||||
end
|
||||
|
||||
function love.keypressed(i)
|
||||
if keyDown[scene]then keyDown[scene](i)
|
||||
elseif i=="escape"then back()
|
||||
elseif i=="escape"or i=="back"then back()
|
||||
else buttonControl_key(i)
|
||||
end
|
||||
end
|
||||
@@ -106,7 +131,6 @@ function love.gamepadpressed(joystick,i)
|
||||
elseif i=="start"then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons[scene][Buttons.sel]
|
||||
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||
B.code()
|
||||
B.alpha=1
|
||||
sysSFX("button")
|
||||
@@ -115,6 +139,7 @@ function love.gamepadpressed(joystick,i)
|
||||
end
|
||||
if gamepadDown[scene]then return gamepadDown[scene](i)
|
||||
elseif i=="back"then return back()
|
||||
else buttonControl_gamepad(i)
|
||||
end
|
||||
end
|
||||
function love.gamepadreleased(joystick,i)
|
||||
|
||||
@@ -2,7 +2,6 @@ game={}
|
||||
function game.load()
|
||||
scene="load"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
loading=1--Loading mode
|
||||
loadnum=1--Loading counter
|
||||
loadprogress=0--Loading bar
|
||||
@@ -10,18 +9,15 @@ end
|
||||
function game.intro()
|
||||
scene="intro"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
end
|
||||
function game.main()
|
||||
scene="main"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
end
|
||||
function game.mode()
|
||||
scene="mode"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
end
|
||||
function game.play()
|
||||
@@ -29,6 +25,7 @@ function game.play()
|
||||
--curBG="game1"
|
||||
resetGameData()
|
||||
sysSFX("ready")
|
||||
mouseShow=false
|
||||
end
|
||||
function game.setting()
|
||||
scene="setting"
|
||||
|
||||
|
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
|
Before Width: | Height: | Size: 882 B After Width: | Height: | Size: 882 B |
|
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 973 B |
BIN
image/gamepadIcon/hardDrop.png
Normal file
|
After Width: | Height: | Size: 212 B |
BIN
image/gamepadIcon/hold.png
Normal file
|
After Width: | Height: | Size: 272 B |
BIN
image/gamepadIcon/moveLeft.png
Normal file
|
After Width: | Height: | Size: 219 B |
BIN
image/gamepadIcon/moveRight.png
Normal file
|
After Width: | Height: | Size: 219 B |
BIN
image/gamepadIcon/restart.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
image/gamepadIcon/rotFlip.png
Normal file
|
After Width: | Height: | Size: 261 B |
BIN
image/gamepadIcon/rotLeft.png
Normal file
|
After Width: | Height: | Size: 227 B |
BIN
image/gamepadIcon/rotRight.png
Normal file
|
After Width: | Height: | Size: 235 B |
BIN
image/gamepadIcon/softDrop.png
Normal file
|
After Width: | Height: | Size: 220 B |
BIN
image/mouseIcon.png
Normal file
|
After Width: | Height: | Size: 638 B |
BIN
image/title.png
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 60 KiB |
BIN
image/title1.png
Normal file
|
After Width: | Height: | Size: 201 B |
@@ -1,8 +1,8 @@
|
||||
loseReason={"Finished","Block out"}
|
||||
blockName={"Z","S","L","J","T","O","I"}
|
||||
clearName={"Single","Double","Triple"}
|
||||
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","restart","toLeft","toRight"}
|
||||
actName_show={"move left","move right","rotate right","rotate left","rotate flip","hard drop","soft drop","hold","restart","toLeft","toRight"}
|
||||
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","restart","toLeft","toRight","toDown"}
|
||||
actName_show={"move left","move right","rotate right","rotate left","rotate flip","hard drop","soft drop","hold","restart","toLeft","toRight","toDown"}
|
||||
blockPos={4,4,4,4,4,5,4}
|
||||
renATK={[0]=0,0,0,1,1,2,2,3,3,3}--4 else
|
||||
b2bATK={3,5,8}
|
||||
|
||||
134
main.lua
@@ -3,12 +3,8 @@ toN,toS=tonumber,tostring
|
||||
int,ceil,abs,rnd,max,min,sin,cos,atan,pi=math.floor,math.ceil,math.abs,math.random,math.max,math.min,math.sin,math.cos,math.atan,math.pi
|
||||
sub,gsub,find,format,byte,char=string.sub,string.gsub,string.find,string.format,string.byte,string.char
|
||||
ins,rem,sort=table.insert,table.remove,table.sort
|
||||
--[[
|
||||
freeRow={}
|
||||
for i=1,50 do
|
||||
freeRow[i]={0,0,0,0,0,0,0,0,0,0}
|
||||
end
|
||||
]]--Reset freeRow,in resetGameData
|
||||
|
||||
--{0,0,0,0,0,0,0,0,0,0}s in freeRow are reset in resetGameData()
|
||||
function getNewRow(val)
|
||||
if not val then val=0 end
|
||||
local t=rem(freeRow)
|
||||
@@ -45,10 +41,18 @@ end
|
||||
ww,wh=gc.getWidth(),gc.getHeight()
|
||||
|
||||
Timer=tm.getTime--Easy get time
|
||||
mx,my,mouseShow=-10,-10,true
|
||||
pause=0--pause countdown(frame)
|
||||
mx,my,mouseShow=-20,-20,false
|
||||
focus=true
|
||||
touches={}--touch ids
|
||||
|
||||
do
|
||||
local l={
|
||||
Windows=1,
|
||||
Android=2,
|
||||
}
|
||||
system=l[love.system.getOS()]
|
||||
touching=nil--touching ID
|
||||
l=nil
|
||||
end
|
||||
|
||||
scene=""
|
||||
gamemode=""
|
||||
@@ -165,12 +169,6 @@ bgm={
|
||||
"push",
|
||||
"reason",
|
||||
}
|
||||
img={
|
||||
title={
|
||||
eng=gc.newImage("/image/title/eng.png"),
|
||||
chi=gc.newImage("/image/title/chi.png"),
|
||||
}
|
||||
}
|
||||
FX={
|
||||
flash=0,--Black screen(frame)
|
||||
shake=0,--Screen shake(frame)
|
||||
@@ -267,8 +265,8 @@ gameEnv0={
|
||||
sequence=1,visible=1,
|
||||
_20G=false,target=9e99,
|
||||
freshLimit=9e99,
|
||||
key={"left","right","x","z","c","up","down","space","LEFT","RIGHT"},
|
||||
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT"},
|
||||
key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT","DOWN"},
|
||||
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT","DOWN"},
|
||||
reach=function()end,--Called when reach row target
|
||||
}
|
||||
randomMethod={
|
||||
@@ -574,8 +572,8 @@ setting={
|
||||
das=10,arr=2,
|
||||
sddas=0,sdarr=2,
|
||||
ghost=true,center=true,
|
||||
key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT"},
|
||||
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT"},
|
||||
key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT","DOWN"},
|
||||
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT","DOWN"},
|
||||
}
|
||||
stat={
|
||||
run=0,
|
||||
@@ -624,12 +622,8 @@ function nextLanguage()
|
||||
end
|
||||
end
|
||||
function mStr(s,x,y)gc.printf(s,x-500,y,1000,"center")end
|
||||
function mouseConvert(x,y)
|
||||
if wh/ww<=720/1280 then
|
||||
return 640+(x-ww*.5)*720/wh,y*720/wh
|
||||
else
|
||||
return x*1280/ww,360+(y-wh*.5)*1280/ww
|
||||
end
|
||||
function convert(x,y)
|
||||
return x*screenK,(y-screenM)*screenK
|
||||
end
|
||||
function sysSFX(s,v)
|
||||
if setting.sfx then
|
||||
@@ -1268,28 +1262,6 @@ function love.update(dt)
|
||||
end
|
||||
--Background blocks update
|
||||
|
||||
for i=1,#touches do
|
||||
local x,y=tc.getPosition(touches[i])
|
||||
for K=1,#gamePad do
|
||||
local b=gamePad[K]
|
||||
local press=false
|
||||
if (x-b.x)^2+(y-b.y)^2<b.r then--Radios already squared
|
||||
press=true
|
||||
end
|
||||
if b.press~=press then
|
||||
(press and pressKey or releaseKey)(K)
|
||||
b.press=press
|
||||
end
|
||||
end
|
||||
end
|
||||
--Touch system
|
||||
|
||||
if Buttons.pressing>0 then
|
||||
Buttons.pressing=Buttons.pressing+1
|
||||
if Buttons.pressing>35 and Buttons.pressing%6==0 then love.mousepressed(ms.getX(),ms.getY(),1)end
|
||||
end
|
||||
--DAP button
|
||||
|
||||
if sceneSwaping then
|
||||
sceneSwaping.time=sceneSwaping.time-1
|
||||
if sceneSwaping.time==sceneSwaping.mid then
|
||||
@@ -1298,7 +1270,6 @@ function love.update(dt)
|
||||
end--Reset buttons' state
|
||||
game[sceneSwaping.tar]()
|
||||
Buttons.sel=nil
|
||||
love.mousemoved(ms.getX(),ms.getY())
|
||||
elseif sceneSwaping.time==0 then
|
||||
sceneSwaping=nil
|
||||
end
|
||||
@@ -1307,7 +1278,7 @@ function love.update(dt)
|
||||
end
|
||||
--scene swapping & Timer
|
||||
end
|
||||
function love.draw()
|
||||
function love.draw()print(mouseShow)
|
||||
Pnt.BG[curBG]()
|
||||
gc.setColor(1,1,1,.3)
|
||||
for n=1,#BGblock do
|
||||
@@ -1322,19 +1293,16 @@ function love.draw()
|
||||
if Pnt[scene]then Pnt[scene]()end
|
||||
setFont(40)
|
||||
drawButton()
|
||||
if mouseShow then
|
||||
gc.setColor(1,.5,0,.7)
|
||||
gc.circle("fill",mx,my,6)
|
||||
if mouseShow and not touching then
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(mouseIcon,mx,my,nil,nil,nil,10,10)
|
||||
end
|
||||
if sceneSwaping then sceneSwaping.draw()end
|
||||
|
||||
gc.setColor(0,0,0)
|
||||
if wh/ww>=720/1280 then
|
||||
gc.rectangle("fill",0,0,1280,-(wh*1280/ww-720)*.5)
|
||||
gc.rectangle("fill",0,720,1280,(wh*1280/ww-720)*.5)
|
||||
else
|
||||
gc.rectangle("fill",0,0,-(ww*720/wh-1280)*.5,720)
|
||||
gc.rectangle("fill",1280,0,(ww*720/wh-1280)*.5,720)
|
||||
if screenM>0 then
|
||||
gc.rectangle("fill",0,0,1280,-screenM)
|
||||
gc.rectangle("fill",0,720,1280,screenM)
|
||||
end--Draw black side
|
||||
|
||||
numFont(20)gc.setColor(1,1,1)
|
||||
@@ -1346,35 +1314,29 @@ function love.draw()
|
||||
--if gcinfo()>500 then collectgarbage()end
|
||||
end
|
||||
function love.resize(x,y)
|
||||
ww,wh=x,y
|
||||
screenK=1280/gc.getWidth()
|
||||
screenM=(gc.getHeight()*16/9-gc.getWidth())/2
|
||||
gc.origin()
|
||||
gc.translate(ww*.5,wh*.5)
|
||||
if wh/ww>=.6 then
|
||||
gc.scale(ww/1280)
|
||||
else
|
||||
gc.scale(wh/720)
|
||||
end
|
||||
gc.translate(-640,-360)
|
||||
gc.scale(1/screenK,1/screenK)
|
||||
gc.translate(0,screenM)
|
||||
end
|
||||
function love.focus(f)
|
||||
focus=f
|
||||
if f then
|
||||
focus=true
|
||||
ms.setVisible(false)
|
||||
if bgmPlaying then bgm[bgmPlaying]:play()end
|
||||
else
|
||||
if scene=="play"then pause=20 end
|
||||
focus=false
|
||||
ms.setVisible(true)
|
||||
if bgmPlaying then bgm[bgmPlaying]:pause()end
|
||||
end
|
||||
end
|
||||
function love.run()
|
||||
local frameT,dt=Timer()
|
||||
love.focus(true)
|
||||
local frameT=Timer()
|
||||
tm.step()
|
||||
love.resize(1280,720)
|
||||
game.load()--Launch
|
||||
math.randomseed(os.time()*626)--true ultheur's I D!
|
||||
-- while true do
|
||||
love.resize(nil,gc.getHeight())
|
||||
game.load()--System scene Launch
|
||||
math.randomseed(os.time()*626)--true A-lthour's ID!
|
||||
return function()
|
||||
love.event.pump()
|
||||
for name,a,b,c,d,e,f in love.event.poll()do
|
||||
@@ -1384,15 +1346,13 @@ function love.run()
|
||||
end
|
||||
love.handlers[name](a,b,c,d,e,f)
|
||||
end
|
||||
if focus or pause==20 then
|
||||
-- if focus then
|
||||
tm.step()
|
||||
love.update(tm.getDelta())
|
||||
if gc.isActive()then
|
||||
gc.clear(1,1,1)
|
||||
love.draw()--Draw all things
|
||||
gc.present()
|
||||
end
|
||||
end
|
||||
gc.clear(1,1,1)
|
||||
love.draw()
|
||||
gc.present()
|
||||
-- end
|
||||
while Timer()-frameT<1/60 do end
|
||||
frameT=Timer()
|
||||
end
|
||||
@@ -1400,6 +1360,7 @@ end
|
||||
--System callbacks
|
||||
|
||||
do--Texture/Image
|
||||
mouseIcon=gc.newImage("/image/mouseIcon.png")
|
||||
local p=gc.newImage("/image/block.png")
|
||||
local l={}
|
||||
gc.setColor(1,1,1)
|
||||
@@ -1417,6 +1378,11 @@ do--Texture/Image
|
||||
gc.draw(p,nil,nil,nil,12,12)
|
||||
end
|
||||
background=l
|
||||
gamepadIcon={}
|
||||
for i=1,9 do
|
||||
gamepadIcon[i]=gc.newImage("/image/gamepadIcon/"..(actName[i])..".png")
|
||||
end
|
||||
titleImage=gc.newImage("/image/title.png")
|
||||
gc.setCanvas()
|
||||
end
|
||||
do--Particle
|
||||
@@ -1432,19 +1398,19 @@ do--Particle
|
||||
--Dust particles
|
||||
|
||||
PTC.attack={}
|
||||
PTC.attack[1]=gc.newParticleSystem(gc.newImage("/image/attack_1.png"),200)
|
||||
PTC.attack[1]=gc.newParticleSystem(gc.newImage("/image/attack/1.png"),200)
|
||||
PTC.attack[1]:setParticleLifetime(.25)
|
||||
PTC.attack[1]:setEmissionRate(0)
|
||||
PTC.attack[1]:setSpin(10)
|
||||
PTC.attack[1]:setColors(1,1,1,.7,1,1,1,0)
|
||||
|
||||
PTC.attack[2]=gc.newParticleSystem(gc.newImage("/image/attack_2.png"),200)
|
||||
PTC.attack[2]=gc.newParticleSystem(gc.newImage("/image/attack/2.png"),200)
|
||||
PTC.attack[2]:setParticleLifetime(.3)
|
||||
PTC.attack[2]:setEmissionRate(0)
|
||||
PTC.attack[2]:setSpin(8)
|
||||
PTC.attack[2]:setColors(1,1,1,.7,1,1,1,0)
|
||||
|
||||
PTC.attack[3]=gc.newParticleSystem(gc.newImage("/image/attack_3.png"),200)
|
||||
PTC.attack[3]=gc.newParticleSystem(gc.newImage("/image/attack/3.png"),200)
|
||||
PTC.attack[3]:setParticleLifetime(.4)
|
||||
PTC.attack[3]:setEmissionRate(0)
|
||||
PTC.attack[3]:setSpin(6)
|
||||
|
||||
58
paint.lua
@@ -10,26 +10,26 @@ swapDeck_data={
|
||||
{7,0,8,9},{1,0,2,8},{5,2,4,8},{6,0,15,8},
|
||||
}--Block id [ZSLJTOI] ,dir,x,y
|
||||
swap={
|
||||
none={2,1,d=function()end},
|
||||
flash={8,1,d=function()gc.clear(1,1,1)end},
|
||||
deck={42,1,d=function()
|
||||
local t=sceneSwaping.time
|
||||
gc.setColor(1,1,1)
|
||||
if t>6 then
|
||||
for i=1,43-t do
|
||||
local bn=swapDeck_data[i][1]
|
||||
local b=blocks[bn][swapDeck_data[i][2]]
|
||||
local cx,cy=swapDeck_data[i][3],swapDeck_data[i][4]
|
||||
for y=1,#b do for x=1,#b[1]do
|
||||
if b[y][x]>0 then
|
||||
gc.draw(blockSkin[bn],80*(cx+x-2),80*(10-cy-y),nil,8/3)
|
||||
end
|
||||
end end
|
||||
none={2,1,d=function()end},
|
||||
flash={8,1,d=function()gc.clear(1,1,1)end},
|
||||
deck={42,1,d=function()
|
||||
local t=sceneSwaping.time
|
||||
gc.setColor(1,1,1)
|
||||
if t>6 then
|
||||
for i=1,43-t do
|
||||
local bn=swapDeck_data[i][1]
|
||||
local b=blocks[bn][swapDeck_data[i][2]]
|
||||
local cx,cy=swapDeck_data[i][3],swapDeck_data[i][4]
|
||||
for y=1,#b do for x=1,#b[1]do
|
||||
if b[y][x]>0 then
|
||||
gc.draw(blockSkin[bn],80*(cx+x-2),80*(10-cy-y),nil,8/3)
|
||||
end
|
||||
end end
|
||||
end
|
||||
else
|
||||
gc.clear(1,1,1)
|
||||
end
|
||||
else
|
||||
gc.clear(1,1,1)
|
||||
end
|
||||
end
|
||||
},
|
||||
}--Scene swapping animations
|
||||
|
||||
@@ -109,8 +109,11 @@ end
|
||||
function Pnt.main()
|
||||
gc.setColor(1,1,1)
|
||||
setFont(30)
|
||||
gc.print("Alpha 0.1+",370,150)
|
||||
gc.draw(img.title[setting.lang],30,30)
|
||||
gc.print("Alpha V0.2",370,150)
|
||||
if system==2 then
|
||||
gc.print("Android",530,110)
|
||||
end
|
||||
gc.draw(titleImage,30,30)
|
||||
end
|
||||
function Pnt.play()
|
||||
for p=1,#players do
|
||||
@@ -264,12 +267,21 @@ function Pnt.play()
|
||||
gc.draw(PTC.attack[i])
|
||||
end
|
||||
setmetatable(_G,nil)
|
||||
if system==2 then
|
||||
gc.setColor(1,1,1,.8)
|
||||
gc.setLineWidth(5)
|
||||
for i=1,#gamepad do
|
||||
local k=gamepad[i]
|
||||
gc.circle("line",k.x,k.y,k.r0)
|
||||
gc.draw(gamepadIcon[i],k.x,k.y,nil,3,nil,18,18)
|
||||
end
|
||||
end
|
||||
end
|
||||
function Pnt.setting2()
|
||||
gc.setColor(1,1,1)
|
||||
setFont(18)
|
||||
mStr("softdropDAS:"..setting.sddas,828,138)
|
||||
mStr("softdropARR:"..setting.sdarr,1043,138)
|
||||
mStr("softdropDAS:"..setting.sddas,828,140)
|
||||
mStr("softdropARR:"..setting.sdarr,1043,140)
|
||||
setFont(35)
|
||||
mStr("DAS:"..setting.das,828,73)
|
||||
mStr("ARR:"..setting.arr,1043,73)
|
||||
@@ -306,5 +318,5 @@ function Pnt.stat()
|
||||
gc.print(stat.hold,600,380)
|
||||
gc.print(stat.spin,600,420)
|
||||
|
||||
gc.draw(img.title[setting.lang],180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
||||
gc.draw(img.title[setting.lang],260,570,.2+.07*sin(Timer()*3),.8,nil,250,60)
|
||||
end
|
||||
22
timer.lua
@@ -55,6 +55,24 @@ function Tmr.play(dt)
|
||||
PTC.attack[i]:update(dt)
|
||||
end
|
||||
-- Update attack beam
|
||||
|
||||
local list=tc.getTouches()
|
||||
for K=1,#gamepad do
|
||||
local b=gamepad[K]
|
||||
local press=false
|
||||
for k,v in ipairs(list)do
|
||||
local x,y=convert(tc.getPosition(v))
|
||||
if (x-b.x)^2+(y-b.y)^2<b.r then
|
||||
press=true
|
||||
end
|
||||
end
|
||||
if b.press~=press then
|
||||
(press and pressKey or releaseKey)(K)
|
||||
b.press=press
|
||||
end
|
||||
end
|
||||
--Touch system
|
||||
|
||||
if count then
|
||||
count=count-1
|
||||
if count==0 then
|
||||
@@ -116,6 +134,7 @@ function Tmr.play(dt)
|
||||
end end
|
||||
--Fresh visible time
|
||||
if keyPressing[1]or keyPressing[2]then
|
||||
P.moving=moving+sgn(moving)
|
||||
local d=abs(moving)-gameEnv.das
|
||||
if d>1 then
|
||||
if gameEnv.arr>0 then
|
||||
@@ -126,11 +145,11 @@ function Tmr.play(dt)
|
||||
act[moving>0 and"toRight"or"toLeft"]()
|
||||
end
|
||||
end
|
||||
P.moving=moving+sgn(moving)
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
if keyPressing[7]then
|
||||
P.downing=downing+1
|
||||
local d=abs(downing)-gameEnv.sddas
|
||||
if d>1 then
|
||||
if gameEnv.sdarr>0 then
|
||||
@@ -141,7 +160,6 @@ function Tmr.play(dt)
|
||||
act.toDown()
|
||||
end
|
||||
end
|
||||
P.downing=downing+1
|
||||
else
|
||||
P.downing=0
|
||||
end
|
||||
|
||||