fix off by one error with stacks

main
Louis Pearson 2024-02-16 00:00:49 -07:00
parent 346070c51d
commit 16f65f5649
1 changed files with 13 additions and 13 deletions

View File

@ -115,8 +115,8 @@ function BOOT()
table.insert(locations,{1,2,2})
-- Set up stacks
for i=1,7 do
stacks[i+7]=draw_cards(stacks[1], i)
table.insert(locations,{i+7,i*30,30})
stacks[i+6]=draw_cards(stacks[1], i)
table.insert(locations,{i+6,i*30,30})
end
end
@ -163,7 +163,7 @@ function update()
end
else
local si=c_hover[1]
if si==8 and c_left then
if si==7 and c_left then
c_hover[1]=3
end
if si>=3 and si<6 and c_down then
@ -175,9 +175,9 @@ function update()
c_hover[1]=1
end
if si>=3 and si<7 and c_right then
c_hover[1]=8
c_hover[1]=7
end
if si>8 and c_left then
if si>7 and c_left then
c_hover[1]=si-1
if hand then
c_hover[2]=#stacks[c_hover[1]]
@ -185,7 +185,7 @@ function update()
c_hover[2]=find_top_of_stack(stacks[c_hover[1]], #stacks[c_hover[1]])
end
end
if si>=8 and si<14 and c_right then
if si>=7 and si<13 and c_right then
c_hover[1]=si+1
if hand then
c_hover[2]=#stacks[c_hover[1]]
@ -193,7 +193,7 @@ function update()
c_hover[2]=find_top_of_stack(stacks[c_hover[1]], #stacks[c_hover[1]])
end
end
if si>=8 and c_up then
if si>=7 and c_up then
c_hover[2]=c_hover[2]-1
if not sel_can_move(c_hover) then
current_stack=si
@ -204,7 +204,7 @@ function update()
end
end
end
if si>=8 and c_down then
if si>=7 and c_down then
c_hover[2]=c_hover[2]+1
end
if si==1 and c_right and #stacks[2]~=0 then
@ -305,7 +305,7 @@ function update()
if j==1 then stackx=2 stacky=2 end
if j==2 then stackx=30 stacky=2 offsetx=8 end
if j>=3 and j<7 then stackx=2 stacky=30+26*(j-3) end
if j>=7 then stackx=(j-7)*30 stacky=30 offsety=8 end
if j>=7 then stackx=(j-6)*30 stacky=30 offsety=8 end
for i,c in ipairs(stack) do
local x=stackx+offsetx*(i-1)
local y=stacky+offsety*(i-1)
@ -318,7 +318,7 @@ function update()
if is_clearing then
hand=nil
local clear_count=0
for a=8,13 do
for a=7,13 do
for i=3,6 do
if #stacks[a]==0 then break end
if move_sel({a,#stacks[a]}, {i,#stacks[i]}) then
@ -416,7 +416,7 @@ end
function sel_can_move(sel)
local i,j=sel[1],sel[2]
if i>=3 and i<8 then return false end
if i>=3 and i<7 then return false end
if i==2 then
if j==#stacks[2] then return true end
return false
@ -495,8 +495,8 @@ function draw()
if c_hover[1]>=3 and c_hover[1]<=6 then
x=2+8 y=30+(26*(c_hover[1]-3))+16
end
if c_hover[1]>=8 then
x=30*(c_hover[1]-7)+8
if c_hover[1]>=7 then
x=30*(c_hover[1]-6)+8
if c_hover[2]>0 then
y=28+(c_hover[2]*8)
else