Compare commits
No commits in common. "1d67ecdf43feb9210d1f9d1dddee39b444b293e1" and "671d1410d5e6e034306681f99a1eedb3b6fe3ce9" have entirely different histories.
1d67ecdf43
...
671d1410d5
|
@ -41,7 +41,6 @@ stacks={}
|
||||||
c_hover=nil
|
c_hover=nil
|
||||||
hand=nil
|
hand=nil
|
||||||
locations={}
|
locations={}
|
||||||
debug=false
|
|
||||||
|
|
||||||
function create_deck()
|
function create_deck()
|
||||||
local cards={}
|
local cards={}
|
||||||
|
@ -82,25 +81,10 @@ end
|
||||||
|
|
||||||
function BOOT()
|
function BOOT()
|
||||||
stacks={
|
stacks={
|
||||||
{}, {}, -- deck, pile
|
create_deck(), {}, -- deck, pile
|
||||||
{}, {}, {}, {}, -- finished
|
{}, {}, {}, {}, -- finished
|
||||||
{}, {}, {}, {}, {}, {}, {}
|
{}, {}, {}, {}, {}, {}, {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if debug then
|
|
||||||
for i=13,1,-1 do
|
|
||||||
for a=1,4 do
|
|
||||||
table.insert(stacks[7+a], {
|
|
||||||
x=0,y=0,state=0,
|
|
||||||
rank=i,
|
|
||||||
suit=a
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
stacks[1] = create_deck()
|
|
||||||
shuffle(stacks[1])
|
shuffle(stacks[1])
|
||||||
table.insert(locations,{1,2,2})
|
table.insert(locations,{1,2,2})
|
||||||
-- Set up stacks
|
-- Set up stacks
|
||||||
|
@ -245,15 +229,9 @@ function update()
|
||||||
if #stacks[1]==0 then
|
if #stacks[1]==0 then
|
||||||
exhausted=true
|
exhausted=true
|
||||||
end
|
end
|
||||||
elseif hand and hover and
|
--[[elseif hand and hover and
|
||||||
hand[1]==hover[1] and hand[2]==hover[2] and left
|
hand[1]==hover[1] and left
|
||||||
then
|
then--]] -- TODO: double click to send to finished
|
||||||
for i=3,6 do
|
|
||||||
if move_sel(hand, {i,#stacks[i]}) then
|
|
||||||
hand=nil
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif hand and hover and left then
|
elseif hand and hover and left then
|
||||||
move_sel(hand,hover)
|
move_sel(hand,hover)
|
||||||
hand=nil
|
hand=nil
|
||||||
|
@ -296,8 +274,8 @@ function update()
|
||||||
last_left=left
|
last_left=left
|
||||||
end
|
end
|
||||||
|
|
||||||
function move_is_valid(hand,hover)
|
function move_sel(hand,hover)
|
||||||
if hand[1]==hover[1] then return false end
|
if hand[1]==hover[1] then return end
|
||||||
local moved_card=stacks[hand[1]][hand[2]]
|
local moved_card=stacks[hand[1]][hand[2]]
|
||||||
local is_valid_move=false
|
local is_valid_move=false
|
||||||
if hover[1]==1 then
|
if hover[1]==1 then
|
||||||
|
@ -333,19 +311,14 @@ function move_is_valid(hand,hover)
|
||||||
is_valid_move=true
|
is_valid_move=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return is_valid_move
|
if is_valid_move then
|
||||||
end
|
|
||||||
|
|
||||||
function move_sel(hand,hover)
|
|
||||||
if not move_is_valid(hand, hover) then return false end
|
|
||||||
|
|
||||||
for i=hand[2],#stacks[hand[1]] do
|
for i=hand[2],#stacks[hand[1]] do
|
||||||
stacks[hand[1]][hand[2]].state=0
|
stacks[hand[1]][hand[2]].state=0
|
||||||
table.insert(
|
table.insert(
|
||||||
stacks[hover[1]],
|
stacks[hover[1]],
|
||||||
table.remove(stacks[hand[1]], hand[2]))
|
table.remove(stacks[hand[1]], hand[2]))
|
||||||
end
|
end
|
||||||
return true
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function sel_can_move(sel)
|
function sel_can_move(sel)
|
||||||
|
|
Loading…
Reference in New Issue