Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd7beca9ce | ||
|
|
30bbf1b1db |
99
button.lua
@@ -34,8 +34,9 @@ Buttons={
|
||||
end,
|
||||
up=4,down=7,left=6
|
||||
},
|
||||
{x=435,y=250,w=320,h=60,rgb=color.white,t="Advanced settings",code=function()gotoScene("setting2")end,up=1,down=7,right=5},
|
||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end,up=6},
|
||||
{x=435,y=220,w=320,h=60,rgb=color.green,t="Advanced settings",code=function()gotoScene("setting2")end,up=1,down=7,right=5},
|
||||
{x=435,y=300,w=320,h=60,rgb=color.yellow,t="Touch settings",code=function()gotoScene("setting3")end,up=6,down=8,right=5},
|
||||
{x=640,y=590,w=210,h=60,rgb=color.white,t="Save&Back",code=function()back()end,up=6},
|
||||
},
|
||||
setting2={
|
||||
{x=290,y=70 ,w=160,h=45,rgb=color.white,t=function()return setting.key[1]end,code=function()keysetting,gamepadsetting=1 end,up=1,down=2,right=10},
|
||||
@@ -52,58 +53,84 @@ Buttons={
|
||||
{x=540,y=130,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[2]end,code=function()gamepadsetting,keysetting=2 end,up=10,down=12,left=2,right=19},
|
||||
{x=540,y=190,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[3]end,code=function()gamepadsetting,keysetting=3 end,up=11,down=13,left=3,right=23},
|
||||
{x=540,y=250,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[4]end,code=function()gamepadsetting,keysetting=4 end,up=12,down=14,left=4,right=23},
|
||||
{x=540,y=310,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[5]end,code=function()gamepadsetting,keysetting=5 end,up=13,down=15,left=5,right=28},
|
||||
{x=540,y=310,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[5]end,code=function()gamepadsetting,keysetting=5 end,up=13,down=15,left=5,right=23},
|
||||
{x=540,y=370,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[6]end,code=function()gamepadsetting,keysetting=6 end,up=14,down=16,left=6,right=28},
|
||||
{x=540,y=430,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[7]end,code=function()gamepadsetting,keysetting=7 end,up=15,down=17,left=7,right=28},
|
||||
{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},
|
||||
{x=840,y=630,w=180,h=60,rgb=color.white,t="Back",code=function()keysetting=nil;back()end,up=24,left=27},
|
||||
--27~28
|
||||
},
|
||||
setting3={
|
||||
{x=500,y=310,w=120,h=80,rgb=color.white,t="Reset",code=function()
|
||||
for K=1,#virtualkey do
|
||||
local b,b0=virtualkey[K],gameEnv0.virtualkey[K]
|
||||
b[1],b[2],b[3],b[4]=b0[1],b0[2],b0[3],b0[4]
|
||||
end--Reset virtualkey
|
||||
end,down=4,right=2},
|
||||
{x=640,y=310,w=120,h=80,rgb=color.white,t="Snap",code=function()
|
||||
for K=1,#virtualkey do
|
||||
local b=virtualkey[K]
|
||||
b[1],b[2]=int(b[1]*.025+.5)*40,int(b[2]*.025+.5)*40
|
||||
end--Make virtualkey neat
|
||||
end,down=5,left=1,right=3},
|
||||
{x=780,y=310,w=120,h=80,rgb=color.white,t=function()return percent0to5[setting.virtualkeyAlpha]end,code=function()
|
||||
setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%6
|
||||
--Adjust virtualkey alpha
|
||||
end,down=6,left=2},
|
||||
{x=500,y=410,w=120,h=80,rgb=color.white,t="Icon",code=function()
|
||||
setting.virtualkeyIcon=not setting.virtualkeyIcon
|
||||
--Switch virtualkey icon
|
||||
end,up=1,right=6},
|
||||
{x=640,y=410,w=120,h=80,rgb=color.white,t="Back",code=function()back()end,up=2,left=4,right=3},
|
||||
{x=780,y=410,w=120,h=80,rgb=color.white,t="Size",code=function()
|
||||
for K=1,#virtualkey do
|
||||
local b=virtualkey[K]
|
||||
b[4]=b[4]+10
|
||||
if b[4]==150 then b[4]=40 end
|
||||
b[3]=b[4]^2
|
||||
end
|
||||
end,up=3,left=5},
|
||||
},
|
||||
help={
|
||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end},
|
||||
},
|
||||
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
|
||||
}
|
||||
for i=1,#gamePad do
|
||||
gamePad[i].press=false
|
||||
gamePad[i].r=gamePad[i].r^2
|
||||
end
|
||||
virtualkey={
|
||||
{80,720-80,6400,80},--moveLeft
|
||||
{240,720-80,6400,80},--moveRight
|
||||
{1280-240,720-80,6400,80},--rotRight
|
||||
{1280-400,720-80,6400,80},--rotLeft
|
||||
{1280-240,720-240,6400,80},--rotFlip
|
||||
{1280-80,720-80,6400,80},--hardDrop
|
||||
{1280-80,720-240,6400,80},--softDrop
|
||||
{1280-80,720-400,6400,80},--hold
|
||||
{80,80,6400,80},--restart
|
||||
--[[
|
||||
{x=0,y=0,r=0},--toLeft
|
||||
{x=0,y=0,r=0},--toRight
|
||||
{x=0,y=0,r=0},--toDown
|
||||
]]
|
||||
}
|
||||
8
conf.lua
@@ -5,11 +5,10 @@ function love.conf(t)
|
||||
t.version="11.1"
|
||||
t.console=X
|
||||
t.accelerometerjoystick=X--Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||
t.externalstorage=X
|
||||
t.gammacorrect=true
|
||||
-- t.audio.mixwithsystem=true--Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||
t.audio.mixwithsystem=true--Switch on to keep background music playing
|
||||
|
||||
t.window.title="Techmino Alpha"
|
||||
t.window.title="Techmino V0.3"
|
||||
t.window.icon="/image/icon.png"
|
||||
t.window.width=1280
|
||||
t.window.height=720
|
||||
@@ -27,7 +26,7 @@ function love.conf(t)
|
||||
t.window.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
|
||||
t.window.x=nil
|
||||
t.window.y=nil
|
||||
|
||||
|
||||
t.modules.window=true
|
||||
t.modules.system=true
|
||||
t.modules.audio=true
|
||||
@@ -43,6 +42,7 @@ function love.conf(t)
|
||||
t.modules.sound=true
|
||||
t.modules.timer=true
|
||||
t.modules.touch=true
|
||||
|
||||
t.modules.physics=X
|
||||
t.modules.thread=X
|
||||
t.modules.video=X
|
||||
|
||||
145
control.lua
@@ -1,5 +1,19 @@
|
||||
function onVirtualkey(x,y)
|
||||
local x,y=convert(x,y)
|
||||
local d2,nearest,distance
|
||||
for K=1,#virtualkey do
|
||||
local b=virtualkey[K]
|
||||
d2=(x-b[1])^2+(y-b[2])^2
|
||||
if d2<b[3]then
|
||||
if not nearest or d2<distance then
|
||||
nearest,distance=K,d2
|
||||
end
|
||||
end
|
||||
end
|
||||
return nearest
|
||||
end
|
||||
|
||||
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 +28,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 +41,120 @@ 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
|
||||
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
|
||||
end
|
||||
end
|
||||
function love.mousereleased(x,y,k,t,num)
|
||||
end
|
||||
function love.touchpressed(id,x,y)
|
||||
if not touching then
|
||||
touching=id
|
||||
love.mousemoved(x,y)
|
||||
mouseShow=false
|
||||
end
|
||||
if scene=="play"then
|
||||
local t=onVirtualkey(x,y)
|
||||
if t then
|
||||
pressKey(t)
|
||||
end
|
||||
end
|
||||
end
|
||||
function love.touchreleased(id,x,y)
|
||||
if id==touching then
|
||||
touching=nil
|
||||
if 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")
|
||||
end
|
||||
elseif k==3 then
|
||||
back()
|
||||
Buttons.sel=nil
|
||||
mouseShow=false
|
||||
end
|
||||
end
|
||||
function love.mousereleased(x,y,k)
|
||||
Buttons.pressing=0
|
||||
end
|
||||
|
||||
function love.touchpressed(id,x,y)
|
||||
ins(touches,id)
|
||||
end
|
||||
function love.touchrealeased(id,x,y)
|
||||
for i=1,#touches do
|
||||
if touches[i]==id then rem(touches,i)break end
|
||||
if scene=="play"then
|
||||
local t=onVirtualkey(x,y)
|
||||
if t then
|
||||
releaseKey(t)
|
||||
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
|
||||
if scene=="play"then
|
||||
local l=tc.getTouches()
|
||||
for n=1,#virtualkey do
|
||||
local b=virtualkey[n]
|
||||
local p=false
|
||||
for i=1,#l do
|
||||
local x,y=convert(tc.getPosition(l[i]))
|
||||
if(x-b[1])^2+(y-b[2])^2<=b[3]then
|
||||
p=true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not p and players[1].keyPressing then
|
||||
releaseKey(n)
|
||||
end
|
||||
end
|
||||
elseif scene=="setting3"then
|
||||
x,y=convert(x,y)
|
||||
dx,dy=dx*screenK,dy*screenK
|
||||
for K=1,#virtualkey do
|
||||
local b=virtualkey[K]
|
||||
if (x-b[1])^2+(y-b[2])^2<b[3]then
|
||||
b[1],b[2]=b[1]+dx,b[2]+dy
|
||||
end
|
||||
end
|
||||
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 +175,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 +183,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,18 @@ end
|
||||
function game.intro()
|
||||
scene="intro"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
end
|
||||
function game.main()
|
||||
scene="main"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
collectgarbage()
|
||||
end
|
||||
function game.mode()
|
||||
savedata()
|
||||
if players then restockRow()end--recycle row used in-game
|
||||
scene="mode"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
end
|
||||
function game.play()
|
||||
@@ -29,18 +28,25 @@ function game.play()
|
||||
--curBG="game1"
|
||||
resetGameData()
|
||||
sysSFX("ready")
|
||||
mouseShow=false
|
||||
end
|
||||
function game.setting()
|
||||
scene="setting"
|
||||
curBG="none"
|
||||
BGM("blank")
|
||||
end
|
||||
end--Normal setting
|
||||
function game.setting2()
|
||||
scene="setting2"
|
||||
curBG="none"
|
||||
keyssetting=nil
|
||||
BGM("blank")
|
||||
end
|
||||
end--Advanced setting and keyboard&joystick setting
|
||||
function game.setting3()
|
||||
scene="setting3"
|
||||
curBG="game1"
|
||||
keyssetting=nil
|
||||
BGM("blank")
|
||||
end--Touch setting
|
||||
function game.help()
|
||||
scene="help"
|
||||
curBG="none"
|
||||
|
||||
BIN
image/BG/2.png
Normal file
|
After Width: | Height: | Size: 378 B |
|
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/block.png
|
Before Width: | Height: | Size: 5.7 KiB |
BIN
image/block/1/1.png
Normal file
|
After Width: | Height: | Size: 463 B |
BIN
image/block/1/10.png
Normal file
|
After Width: | Height: | Size: 659 B |
BIN
image/block/1/11.png
Normal file
|
After Width: | Height: | Size: 578 B |
BIN
image/block/1/12.png
Normal file
|
After Width: | Height: | Size: 575 B |
BIN
image/block/1/13.png
Normal file
|
After Width: | Height: | Size: 441 B |
BIN
image/block/1/2.png
Normal file
|
After Width: | Height: | Size: 584 B |
BIN
image/block/1/3.png
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
image/block/1/4.png
Normal file
|
After Width: | Height: | Size: 586 B |
BIN
image/block/1/5.png
Normal file
|
After Width: | Height: | Size: 533 B |
BIN
image/block/1/6.png
Normal file
|
After Width: | Height: | Size: 635 B |
BIN
image/block/1/7.png
Normal file
|
After Width: | Height: | Size: 660 B |
BIN
image/block/1/8.png
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
image/block/1/9.png
Normal file
|
After Width: | Height: | Size: 684 B |
BIN
image/icon.gfie
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 |
BIN
image/virtualkey/hardDrop.png
Normal file
|
After Width: | Height: | Size: 227 B |
BIN
image/virtualkey/hold.png
Normal file
|
After Width: | Height: | Size: 246 B |
BIN
image/virtualkey/moveLeft.png
Normal file
|
After Width: | Height: | Size: 219 B |
BIN
image/virtualkey/moveRight.png
Normal file
|
After Width: | Height: | Size: 219 B |
BIN
image/virtualkey/restart.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
image/virtualkey/rotFlip.png
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
image/virtualkey/rotLeft.png
Normal file
|
After Width: | Height: | Size: 241 B |
BIN
image/virtualkey/rotRight.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
image/virtualkey/softDrop.png
Normal file
|
After Width: | Height: | Size: 220 B |
11
lists.lua
@@ -1,13 +1,14 @@
|
||||
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
|
||||
renATK={[0]=0,0,0,1,1,2,2,3,3,4,4,4}--3 else
|
||||
b2bATK={3,5,8}
|
||||
|
||||
marathon_drop={[0]=60,48,40,30,24,18,15,12,10,8,7,6,5,4,3,2,1,1,0,0}
|
||||
death_lock={10,9,8,7,6}
|
||||
death_wait={6,5,4,3,2}
|
||||
death_fall={10,8,7,6,5}
|
||||
death_fall={10,8,7,6,5}
|
||||
|
||||
percent0to5={[0]="0%","20%","40%","60%","80%","100%",}
|
||||
421
main.lua
@@ -1,14 +1,10 @@
|
||||
gc,kb,ms,tc,tm,fs=love.graphics,love.keyboard,love.mouse,love.touch,love.timer,love.filesystem
|
||||
gc,kb,ms,tc,tm,fs,wd=love.graphics,love.keyboard,love.mouse,love.touch,love.timer,love.filesystem,love.window
|
||||
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)
|
||||
@@ -44,11 +40,20 @@ end
|
||||
|
||||
ww,wh=gc.getWidth(),gc.getHeight()
|
||||
|
||||
Timer=tm.getTime--Easy get time
|
||||
mx,my,mouseShow=-10,-10,true
|
||||
pause=0--pause countdown(frame)
|
||||
Timer=tm.getTime--Easy&Quick to get time!
|
||||
mx,my,mouseShow=-20,-20,false
|
||||
ms.setVisible(false)
|
||||
focus=true
|
||||
touches={}--touch ids
|
||||
|
||||
do
|
||||
local l={
|
||||
Windows=1,
|
||||
Android=2,
|
||||
}
|
||||
system=l[love.system.getOS()]
|
||||
l=nil
|
||||
end
|
||||
touching=nil--1st touching ID
|
||||
|
||||
scene=""
|
||||
gamemode=""
|
||||
@@ -56,19 +61,16 @@ bgmPlaying=nil
|
||||
curBG="none"
|
||||
BGblock={ct=140}
|
||||
|
||||
languages={"eng"}
|
||||
prevMenu={
|
||||
load=love.event.quit,
|
||||
ready="mode",
|
||||
play=function()
|
||||
restockRow()
|
||||
gotoScene("mode")
|
||||
end,
|
||||
play="mode",
|
||||
mode="main",
|
||||
help="main",
|
||||
stat="main",
|
||||
setting="main",
|
||||
setting2="setting",
|
||||
setting3="setting",
|
||||
intro="quit",
|
||||
main="quit",
|
||||
}
|
||||
@@ -77,37 +79,36 @@ kb.setKeyRepeat(false)
|
||||
kb.setTextInput(false)
|
||||
--Disable system key repeat
|
||||
|
||||
Texts={
|
||||
eng={
|
||||
load={"Loading textures","Loading BGM","Loading SFX","Finished",},
|
||||
stat={
|
||||
"Games run:",
|
||||
"Games played:",
|
||||
"Game time:",
|
||||
"Total block used:",
|
||||
"Total rows cleared:",
|
||||
"Total lines sent:",
|
||||
"Total key pressed:",
|
||||
"Total rotate:",
|
||||
"Total hold:",
|
||||
"Total spin:",
|
||||
},
|
||||
help={
|
||||
"I think you don't need \"help\".",
|
||||
"THIS IS NOT TETRIS,and doesn't use SRS.",
|
||||
"But just play like playing TOP/C2/KOS/TGM3",
|
||||
"Game is not public now,DO NOT DISTIRBUTE",
|
||||
"",
|
||||
"Powered by LOVE2D",
|
||||
"Author:MrZ E-mail:1046101471@qq.com",
|
||||
"Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ",
|
||||
"Tool used:VScode,GFIE,Beepbox,Goldwave",
|
||||
"Special thanks:TOP,C2,KOS,TGM3,GFIE,and YOU!!",
|
||||
"Any bugs/suggestions to me.",
|
||||
},
|
||||
Text={
|
||||
load={"Loading textures","Loading BGM","Loading SFX","Finished",},
|
||||
stat={
|
||||
"Games run:",
|
||||
"Games played:",
|
||||
"Game time:",
|
||||
"Total block used:",
|
||||
"Total rows cleared:",
|
||||
"Total lines sent:",
|
||||
"Total key pressed:",
|
||||
"Total rotate:",
|
||||
"Total hold:",
|
||||
"Total spin:",
|
||||
},
|
||||
help={
|
||||
"I think you don't need \"help\".",
|
||||
"THIS IS NOT TETRIS,and doesn't use SRS.",
|
||||
"But just play like playing TOP/C2/KOS/TGM3",
|
||||
"Game is not public now,DO NOT DISTIRBUTE",
|
||||
"",
|
||||
"Powered by LOVE2D",
|
||||
"Author:MrZ E-mail:1046101471@qq.com",
|
||||
"Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ",
|
||||
"Tool used:VScode,GFIE,Beepbox,Goldwave",
|
||||
"Special thanks:TOP,C2,KOS,TGM3,GFIE,and YOU!!",
|
||||
"Any bugs/suggestions to me.",
|
||||
},
|
||||
}
|
||||
numFonts={}
|
||||
Fonts={}
|
||||
function numFont(s)
|
||||
if numFonts[s]then
|
||||
gc.setFont(numFonts[s])
|
||||
@@ -118,9 +119,7 @@ function numFont(s)
|
||||
end
|
||||
currentFont=s
|
||||
end
|
||||
Fonts={}for i=1,#languages do Fonts[languages[i]]={}end
|
||||
fontLib={
|
||||
eng=function(s)
|
||||
function setFont(s)
|
||||
if s~=currentFont then
|
||||
if Fonts[s]then
|
||||
gc.setFont(Fonts[s])
|
||||
@@ -131,20 +130,7 @@ eng=function(s)
|
||||
end
|
||||
currentFont=s
|
||||
end
|
||||
end,
|
||||
chi=function(s)
|
||||
if s~=currentFont then
|
||||
if Fonts[setting.lang][s]then
|
||||
gc.setFont(Fonts[setting.lang][s])
|
||||
else
|
||||
local t=gc.newFont("hei.ttf",s-5,"normal")
|
||||
Fonts[setting.lang][s]=t
|
||||
gc.setFont(t)
|
||||
end
|
||||
currentFont=s
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
sfx={
|
||||
"button",
|
||||
@@ -165,12 +151,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)
|
||||
@@ -250,12 +230,9 @@ attackColor={
|
||||
end,
|
||||
}--3 animation-colorsets of attack buffer bar
|
||||
}
|
||||
-- for k,v in pairs(color) do
|
||||
-- v[1],v[2],v[3]=255*v[1],255*v[2],255*v[3]
|
||||
-- end
|
||||
|
||||
require("TRS")--load block&TRS kick
|
||||
require("lists")
|
||||
require("lists")--load lists
|
||||
|
||||
gameEnv0={
|
||||
das=10,arr=2,
|
||||
@@ -267,9 +244,22 @@ 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"},
|
||||
reach=function()end,--Called when reach row target
|
||||
|
||||
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"},
|
||||
virtualkey={
|
||||
{80,720-80,6400,80},--moveLeft
|
||||
{240,720-80,6400,80},--moveRight
|
||||
{1280-240,720-80,6400,80},--rotRight
|
||||
{1280-400,720-80,6400,80},--rotLeft
|
||||
{1280-240,720-240,6400,80},--rotFlip
|
||||
{1280-80,720-80,6400,80},--hardDrop
|
||||
{1280-80,720-240,6400,80},--softDrop
|
||||
{1280-80,720-400,6400,80},--hold
|
||||
{80,80,6400,80},--restart
|
||||
},
|
||||
reach=function()end,
|
||||
--these three is actually no use,only provide a key
|
||||
}
|
||||
randomMethod={
|
||||
function()
|
||||
@@ -324,7 +314,7 @@ loadmode={
|
||||
reach=Event.gameover.win,
|
||||
}
|
||||
createPlayer(1,340,15)
|
||||
curBG="game1"
|
||||
curBG="strap"
|
||||
BGM("reason")
|
||||
end,
|
||||
gmroll=function()
|
||||
@@ -339,7 +329,7 @@ loadmode={
|
||||
arr=1,
|
||||
}
|
||||
createPlayer(1,340,15)
|
||||
curBG="game3"
|
||||
curBG="glow"
|
||||
BGM("push")
|
||||
end,
|
||||
marathon=function()
|
||||
@@ -352,7 +342,7 @@ loadmode={
|
||||
freshLimit=15,
|
||||
}
|
||||
createPlayer(1,340,15)
|
||||
curBG="game1"
|
||||
curBG="strap"
|
||||
BGM("way")
|
||||
end,
|
||||
death=function()
|
||||
@@ -392,13 +382,14 @@ loadmode={
|
||||
end
|
||||
end--AIs
|
||||
|
||||
curBG="game2"
|
||||
curBG="game3"
|
||||
BGM("race")
|
||||
end,
|
||||
solo=function()
|
||||
modeEnv={
|
||||
wait=1,
|
||||
fall=1,
|
||||
freshLimit=15,
|
||||
}
|
||||
createPlayer(1,20,15)--Player
|
||||
createPlayer(2,660,85,.9,2)--AI
|
||||
@@ -413,11 +404,11 @@ loadmode={
|
||||
wait=1,
|
||||
fall=1,
|
||||
visible=0,
|
||||
freshLimit=8,
|
||||
freshLimit=10,
|
||||
}
|
||||
createPlayer(1,340,15)
|
||||
|
||||
curBG="game1"
|
||||
curBG="glow"
|
||||
BGM("push")
|
||||
end,
|
||||
asymsolo=function()
|
||||
@@ -425,6 +416,7 @@ loadmode={
|
||||
wait=1,
|
||||
fall=1,
|
||||
visible=2,
|
||||
freshLimit=15,
|
||||
}
|
||||
createPlayer(1,20,15)--Player
|
||||
createPlayer(2,660,85,.9,2)--AI
|
||||
@@ -574,8 +566,21 @@ 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"},
|
||||
virtualkey={
|
||||
{80,720-80,6400,80},--moveLeft
|
||||
{240,720-80,6400,80},--moveRight
|
||||
{1280-240,720-80,6400,80},--rotRight
|
||||
{1280-400,720-80,6400,80},--rotLeft
|
||||
{1280-240,720-240,6400,80},--rotFlip
|
||||
{1280-80,720-80,6400,80},--hardDrop
|
||||
{1280-80,720-240,6400,80},--softDrop
|
||||
{1280-80,720-400,6400,80},--hold
|
||||
{80,80,6400,80},--restart
|
||||
},
|
||||
virtualkeyAlpha=3,
|
||||
virtualkeyIcon=true,
|
||||
}
|
||||
stat={
|
||||
run=0,
|
||||
@@ -596,40 +601,23 @@ function string.splitS(s,sep)
|
||||
sep=sep or"/"
|
||||
local t={}
|
||||
repeat
|
||||
local i=find(s,sep)
|
||||
local i=find(s,sep)or #s+1
|
||||
ins(t,sub(s,1,i-1))
|
||||
s=sub(s,i+#sep)
|
||||
until #s==0
|
||||
return t
|
||||
end
|
||||
function string.concat(t,sep)
|
||||
sep=sep or"/"
|
||||
local s=""
|
||||
for i=1,#t do
|
||||
s=s..t[i]..sep
|
||||
end
|
||||
return s
|
||||
end
|
||||
function sgn(i)return i>0 and 1 or i<0 and -1 or 0 end
|
||||
function stringPack(s,v)return s..toS(v).."\r\n"end
|
||||
function sgn(i)return i>0 and 1 or i<0 and -1 or 0 end--Row numbe is A-uth-or's id!
|
||||
function stringPack(s,v)return s..toS(v)end
|
||||
function without(t,v)
|
||||
for i=1,#t do
|
||||
if t[i]==v then return nil end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function nextLanguage()
|
||||
for i=1,#languages do
|
||||
if setting.lang==languages[i]then return languages[i+1]or"eng"end
|
||||
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
|
||||
@@ -695,13 +683,16 @@ function resetGameData()
|
||||
PTC.dust[i]=PTC.dust[0]:clone()
|
||||
PTC.dust[i]:start()
|
||||
end
|
||||
for i=1,#virtualkey do
|
||||
virtualkey[i].press=false
|
||||
end
|
||||
stat.game=stat.game+1
|
||||
|
||||
freeRow={}
|
||||
collectgarbage()
|
||||
for i=1,50*#players do
|
||||
freeRow[i]={0,0,0,0,0,0,0,0,0,0}
|
||||
end
|
||||
collectgarbage()
|
||||
end
|
||||
function startGame(mode)
|
||||
--rec=""
|
||||
@@ -731,14 +722,22 @@ function loaddata()
|
||||
elseif t=="fullscreen"then
|
||||
setting.fullscreen=v=="true"
|
||||
love.window.setFullscreen(setting.fullscreen)
|
||||
elseif t=="lang"then
|
||||
if not Fonts[v]then v="eng"end
|
||||
setting.lang=v
|
||||
setFont=fontLib[v]
|
||||
elseif t=="keyset"then
|
||||
v=string.splitS(v)
|
||||
for i=#v+1,8 do v[i]="N/A"end
|
||||
setting.key=v
|
||||
elseif t=="virtualkey"then
|
||||
v=string.splitS(v,"/")
|
||||
for i=1,9 do
|
||||
virtualkey[i]=string.splitS(v[i],",")
|
||||
for j=1,4 do
|
||||
virtualkey[i][j]=toN(virtualkey[i][j])
|
||||
end
|
||||
end
|
||||
elseif t=="virtualkeyAlpha"then
|
||||
setting.virtualkeyAlpha=int(abs(toN(v)))
|
||||
elseif t=="virtualkeyIcon"then
|
||||
setting.virtualkeyIcon=v=="true"
|
||||
--Settings
|
||||
elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then
|
||||
v=toN(v)if not v or v<0 then v=0 end
|
||||
@@ -754,27 +753,38 @@ function loaddata()
|
||||
end
|
||||
end
|
||||
function savedata()
|
||||
local t=""
|
||||
t=t..stringPack("sfx=",setting.sfx)
|
||||
t=t..stringPack("bgm=",setting.bgm)
|
||||
t=t..stringPack("fullscreen=",setting.fullscreen)
|
||||
t=t..stringPack("lang=",setting.lang)
|
||||
local vk={}
|
||||
for i=1,9 do
|
||||
for j=1,4 do
|
||||
virtualkey[i][j]=int(virtualkey[i][j]+.5)
|
||||
end--Saving a integer is better?
|
||||
vk[i]=table.concat(virtualkey[i],",")
|
||||
end--pre-pack virtualkey setting
|
||||
|
||||
t=t..stringPack("run=",stat.run)
|
||||
t=t..stringPack("game=",stat.game)
|
||||
t=t..stringPack("gametime=",stat.gametime)
|
||||
t=t..stringPack("piece=",stat.piece)
|
||||
t=t..stringPack("row=",stat.row)
|
||||
t=t..stringPack("atk=",stat.atk)
|
||||
t=t..stringPack("key=",stat.key)
|
||||
t=t..stringPack("rotate=",stat.rotate)
|
||||
t=t..stringPack("hold=",stat.hold)
|
||||
t=t..stringPack("spin=",stat.spin)
|
||||
t=t..stringPack("das=",setting.das)
|
||||
t=t..stringPack("arr=",setting.arr)
|
||||
t=t..stringPack("sddas=",setting.sddas)
|
||||
t=t..stringPack("sdarr=",setting.sdarr)
|
||||
t=t..stringPack("keyset=",string.concat(setting.key))
|
||||
local t=table.concat({
|
||||
stringPack("sfx=",setting.sfx),
|
||||
stringPack("bgm=",setting.bgm),
|
||||
stringPack("fullscreen=",setting.fullscreen),
|
||||
|
||||
stringPack("run=",stat.run),
|
||||
stringPack("game=",stat.game),
|
||||
stringPack("gametime=",stat.gametime),
|
||||
stringPack("piece=",stat.piece),
|
||||
stringPack("row=",stat.row),
|
||||
stringPack("atk=",stat.atk),
|
||||
stringPack("key=",stat.key),
|
||||
stringPack("rotate=",stat.rotate),
|
||||
stringPack("hold=",stat.hold),
|
||||
stringPack("spin=",stat.spin),
|
||||
stringPack("das=",setting.das),
|
||||
stringPack("arr=",setting.arr),
|
||||
stringPack("sddas=",setting.sddas),
|
||||
stringPack("sdarr=",setting.sdarr),
|
||||
stringPack("keyset=",table.concat(setting.key,"/")),
|
||||
stringPack("virtualkey=",table.concat(vk,"/")),
|
||||
stringPack("virtualkeyAlpha=",setting.virtualkeyAlpha),
|
||||
stringPack("virtualkeyIcon=",setting.virtualkeyIcon),
|
||||
},"\r\n")
|
||||
--t=love.math.compress(t,"zlib"):getString()
|
||||
userdata:open("w")
|
||||
userdata:write(t)
|
||||
@@ -1065,7 +1075,7 @@ function drop()
|
||||
SFX("spin_"..cc)
|
||||
stat.spin=stat.spin+1
|
||||
elseif #clearing<#field then
|
||||
P.b2b=P.b2b-400
|
||||
P.b2b=P.b2b-300
|
||||
showText(clearName[cc],"appear",50)
|
||||
csend=cc-1
|
||||
sendTime=20+csend*20
|
||||
@@ -1180,7 +1190,7 @@ function keyDown.play(key)
|
||||
local k=players[1].gameEnv.key
|
||||
for i=1,11 do
|
||||
if key==k[i]then
|
||||
pressKey(i,players[1])
|
||||
pressKey(i)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -1212,7 +1222,7 @@ function gamepadDown.play(key)
|
||||
local k=players[1].gameEnv.gamepad
|
||||
for i=1,11 do
|
||||
if key==k[i]then
|
||||
pressKey(i,players[1])
|
||||
pressKey(i)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -1268,28 +1278,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 +1286,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
|
||||
@@ -1322,75 +1309,66 @@ 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)
|
||||
gc.print(tm.getFPS(),0,700)
|
||||
gc.print(gcinfo(),0,680)
|
||||
-- numFont(80)
|
||||
-- gc.print(gcinfo(),400,370)
|
||||
|
||||
--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)
|
||||
end
|
||||
function love.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
|
||||
gc.scale(1/screenK,1/screenK)
|
||||
gc.translate(0,screenM)
|
||||
end
|
||||
function love.run()
|
||||
local frameT,dt=Timer()
|
||||
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
|
||||
if name=="quit"then
|
||||
savedata()
|
||||
return 0
|
||||
end
|
||||
if name=="quit"then return 0 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()
|
||||
gc.clear()
|
||||
love.draw()
|
||||
gc.present()
|
||||
if not wd.hasFocus()then
|
||||
focus=false
|
||||
ms.setVisible(true)
|
||||
if bgmPlaying then bgm[bgmPlaying]:pause()end
|
||||
if scene=="play"then
|
||||
for i=1,#players[1].keyPressing do
|
||||
if players[1].keyPressing[i]then
|
||||
releaseKey(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
tm.sleep(.1)
|
||||
if wd.hasFocus()then
|
||||
focus=true
|
||||
ms.setVisible(false)
|
||||
if bgmPlaying then bgm[bgmPlaying]:play()end
|
||||
end
|
||||
end
|
||||
while Timer()-frameT<1/60 do end
|
||||
@@ -1400,24 +1378,22 @@ end
|
||||
--System callbacks
|
||||
|
||||
do--Texture/Image
|
||||
local p=gc.newImage("/image/block.png")
|
||||
local l={}
|
||||
gc.setColor(1,1,1)
|
||||
titleImage=gc.newImage("/image/title.png")
|
||||
mouseIcon=gc.newImage("/image/mouseIcon.png")
|
||||
blockSkin={}
|
||||
for i=1,13 do
|
||||
l[i]=gc.newCanvas(30,30)
|
||||
gc.setCanvas(l[i])
|
||||
gc.draw(p,30-30*i)
|
||||
blockSkin[i]=gc.newImage("/image/block/1/"..i..".png")
|
||||
end
|
||||
blockSkin=l
|
||||
l={}
|
||||
for i=1,1 do
|
||||
local p=gc.newImage("/image/BG/"..i..".png")
|
||||
l[i]=gc.newCanvas(1536,1536)
|
||||
gc.setCanvas(l[i])
|
||||
gc.draw(p,nil,nil,nil,12,12)
|
||||
background={}
|
||||
gc.setColor(1,1,1)
|
||||
background={}
|
||||
for i=1,2 do
|
||||
background[i]=gc.newImage("/image/BG/"..i..".png")
|
||||
end
|
||||
virtualkeyIcon={}
|
||||
for i=1,9 do
|
||||
virtualkeyIcon[i]=gc.newImage("/image/virtualkey/"..(actName[i])..".png")
|
||||
end
|
||||
background=l
|
||||
gc.setCanvas()
|
||||
end
|
||||
do--Particle
|
||||
PTC={dust={}}--Particle systems
|
||||
@@ -1432,19 +1408,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)
|
||||
@@ -1454,11 +1430,10 @@ do--Particle
|
||||
gc.setCanvas()
|
||||
end
|
||||
c=nil
|
||||
|
||||
userdata=fs.newFile("userdata")
|
||||
if fs.getInfo("userdata")then
|
||||
loaddata()
|
||||
end
|
||||
|
||||
stat.run=stat.run+1
|
||||
setFont=fontLib[setting.lang]
|
||||
Text=Texts[setting.lang]
|
||||
stat.run=stat.run+1
|
||||
149
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
|
||||
|
||||
@@ -77,22 +77,48 @@ function drawPixel(y,x,id,alpha)
|
||||
gc.setColor(1,1,1,alpha)
|
||||
gc.draw(blockSkin[id],30*x-30,600-30*y)
|
||||
end
|
||||
function drawVirtualkey()
|
||||
gc.setLineWidth(10)
|
||||
gc.setColor(1,1,1,setting.virtualkeyAlpha*.2)
|
||||
for i=1,#virtualkey do
|
||||
local b=virtualkey[i]
|
||||
gc.circle("line",b[1],b[2],b[4]-5)
|
||||
if setting.virtualkeyIcon then gc.draw(virtualkeyIcon[i],b[1],b[2],nil,2*b[4]*.0125,nil,18,18)end
|
||||
end
|
||||
end
|
||||
|
||||
Pnt={BG={}}
|
||||
function Pnt.BG.none()
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.clear(.2,.2,.2)
|
||||
end
|
||||
function Pnt.BG.glow()
|
||||
local t=((sin(Timer()*.5)+sin(Timer()*.7)+sin(Timer()*.9+1)+sin(Timer()*1.5)+sin(Timer()*2+3))+5)*.05
|
||||
gc.clear(t,t,t)
|
||||
end
|
||||
function Pnt.BG.game1()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(background[1],640,360,Timer()*.15,nil,nil,768,768)
|
||||
gc.draw(background[1],640,360,Timer()*.15,12,nil,64,64)
|
||||
end
|
||||
function Pnt.BG.game2()
|
||||
gc.setColor(1,.5,.5)
|
||||
gc.draw(background[1],640,360,Timer()*.2,nil,nil,768,768)
|
||||
gc.draw(background[1],640,360,Timer()*.2,12,nil,64,64)
|
||||
end
|
||||
function Pnt.BG.game3()
|
||||
gc.setColor(.6,.6,1)
|
||||
gc.draw(background[1],640,360,Timer()*.25,nil,nil,768,768)
|
||||
gc.draw(background[1],640,360,Timer()*.25,12,nil,64,64)
|
||||
end
|
||||
function Pnt.BG.rgb()
|
||||
gc.clear(
|
||||
sin(Timer()*1.2)*.15+.5,
|
||||
sin(Timer()*1.5)*.15+.5,
|
||||
sin(Timer()*1.9)*.15+.5
|
||||
)
|
||||
end
|
||||
function Pnt.BG.strap()
|
||||
gc.setColor(1,1,1)
|
||||
local x=Timer()%32*40
|
||||
gc.draw(background[2],x,0,nil,10)
|
||||
gc.draw(background[2],x-1280,0,nil,10)
|
||||
end
|
||||
|
||||
function Pnt.load()
|
||||
@@ -109,8 +135,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.3",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
|
||||
@@ -118,7 +147,7 @@ function Pnt.play()
|
||||
setmetatable(_G,P.index)
|
||||
gc.push("transform")
|
||||
gc.translate(x,y)gc.scale(size)--Scale
|
||||
gc.setColor(0,0,0,.8)gc.rectangle("fill",0,0,600,690)--Black Background
|
||||
gc.setColor(0,0,0,.7)gc.rectangle("fill",0,0,600,690)--Black Background
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,0,600,690)--Big frame
|
||||
gc.translate(150,70)
|
||||
@@ -244,19 +273,21 @@ function Pnt.play()
|
||||
bonus[i]:draw()
|
||||
end--Effects
|
||||
|
||||
gc.setColor(1,1,1)
|
||||
setFont(40)
|
||||
gc.print(format("%0.2f",time),-125,530)--Draw time
|
||||
if mesDisp[gamemode]then mesDisp[gamemode]()end--Draw other message
|
||||
if P.size>.3 then
|
||||
gc.setColor(1,1,1)
|
||||
setFont(40)
|
||||
gc.print(format("%0.2f",time),-125,530)--Draw time
|
||||
if mesDisp[gamemode]then mesDisp[gamemode]()end--Draw other message
|
||||
|
||||
setFont(15)
|
||||
gc.setColor(1,1,1)
|
||||
gc.print("BPM",380,490)
|
||||
gc.print("KPM",335,580)
|
||||
setFont(30)
|
||||
drawDial(350,520,dropSpeed)
|
||||
drawDial(400,570,keySpeed)
|
||||
--Speed dials
|
||||
setFont(15)
|
||||
gc.setColor(1,1,1)
|
||||
gc.print("BPM",380,490)
|
||||
gc.print("KPM",335,580)
|
||||
setFont(30)
|
||||
drawDial(350,520,dropSpeed)
|
||||
drawDial(400,570,keySpeed)
|
||||
--Speed dials
|
||||
end
|
||||
gc.pop()
|
||||
end--Draw players
|
||||
gc.setColor(1,1,1)
|
||||
@@ -264,12 +295,15 @@ function Pnt.play()
|
||||
gc.draw(PTC.attack[i])
|
||||
end
|
||||
setmetatable(_G,nil)
|
||||
if system==2 then
|
||||
drawVirtualkey()
|
||||
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)
|
||||
@@ -280,31 +314,42 @@ function Pnt.setting2()
|
||||
gc.print("<<",keysetting and 380 or 670,60*(keysetting or gamepadsetting)-10)
|
||||
end
|
||||
end
|
||||
function Pnt.setting3()
|
||||
drawVirtualkey()
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1,sin(Timer()*4)*.1+.1)
|
||||
for i=1,31 do
|
||||
gc.line(40*i,0,40*i,720)
|
||||
end
|
||||
for i=1,17 do
|
||||
gc.line(0,40*i,1280,40*i)
|
||||
end
|
||||
end
|
||||
function Pnt.help()
|
||||
setFont(32)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,11 do
|
||||
mStr(Text.help[i],640,15+43*i)
|
||||
end
|
||||
gc.draw(img.title[setting.lang],180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
||||
gc.draw(titleImage,180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
||||
end
|
||||
function Pnt.stat()
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,10 do
|
||||
gc.print(Text.stat[i],250,20+40*i)
|
||||
gc.print(Text.stat[i],350,20+40*i)
|
||||
end
|
||||
|
||||
gc.print(stat.run,600,60)
|
||||
gc.print(stat.game,600,100)
|
||||
gc.print(format("%0.2f",stat.gametime).."s",600,140)
|
||||
gc.print(stat.piece,600,180)
|
||||
gc.print(stat.row,600,220)
|
||||
gc.print(stat.atk,600,260)
|
||||
gc.print(stat.key,600,300)
|
||||
gc.print(stat.rotate,600,340)
|
||||
gc.print(stat.hold,600,380)
|
||||
gc.print(stat.spin,600,420)
|
||||
gc.print(stat.run,650,60)
|
||||
gc.print(stat.game,650,100)
|
||||
gc.print(format("%0.2f",stat.gametime).."s",650,140)
|
||||
gc.print(stat.piece,650,180)
|
||||
gc.print(stat.row,650,220)
|
||||
gc.print(stat.atk,650,260)
|
||||
gc.print(stat.key,650,300)
|
||||
gc.print(stat.rotate,650,340)
|
||||
gc.print(stat.hold,650,380)
|
||||
gc.print(stat.spin,650,420)
|
||||
|
||||
gc.draw(img.title[setting.lang],180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
||||
gc.draw(titleImage,260,570,.2+.07*sin(Timer()*3),.8,nil,250,60)
|
||||
end
|
||||
@@ -55,6 +55,7 @@ function Tmr.play(dt)
|
||||
PTC.attack[i]:update(dt)
|
||||
end
|
||||
-- Update attack beam
|
||||
|
||||
if count then
|
||||
count=count-1
|
||||
if count==0 then
|
||||
@@ -116,6 +117,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 +128,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 +143,6 @@ function Tmr.play(dt)
|
||||
act.toDown()
|
||||
end
|
||||
end
|
||||
P.downing=downing+1
|
||||
else
|
||||
P.downing=0
|
||||
end
|
||||
|
||||