center draw and discard piles horizontally

dev
LeRoyce Pearson 2024-02-18 00:56:24 -07:00
parent 3ab5052d0c
commit 2166ea47cf
1 changed files with 19 additions and 21 deletions

View File

@ -40,6 +40,10 @@ function TIC()
local points_of_interest = player_state.get_points_of_interest()
local discard_x=((240 - 24) / 2)
local draw_pile_x=discard_x - 24 - 4
local end_turn_x=discard_x + 24 + 4
if not hovered and #points_of_interest>0 then
hovered=points_of_interest[1]
end
@ -117,28 +121,19 @@ function TIC()
print("New\nMeld", meld_x, 17, 13)
end
-- render draw pile
for i,card in ipairs(draw_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(3, 80 + (i - 1) * -0.25, true, sel_state)
end
-- render discard pile
for i,card in ipairs(discard_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(39, 80 + (i - 1) * -0.25, false, sel_state)
card:render(discard_x, 80 + (i - 1) * -0.25, false, sel_state)
end
if is_an_interest(points_of_interest, "Discard") then
if hovered and hovered.interest=="Discard" then
spr(Card.spr_hilight.sid,
39,
discard_x,
80 + (#discard_pile - 1) * -0.25,
Card.spr_hilight.colorkey,
1, 0, 0,
@ -147,28 +142,31 @@ function TIC()
end
end
if player_state == player_state_draw_card then
print("Your turn! Draw a card.", 60, 60, 15, false, 1, false)
elseif player_state == player_state_action then
print("Your turn! Meld, Lay-off, or End Turn", 60, 60, 15, false, 1, false)
-- render draw pile
for i,card in ipairs(draw_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(draw_pile_x, 80 + (i - 1) * -0.25, true, sel_state)
end
if is_an_interest(points_of_interest, "End\nTurn") then
print("End\nTurn", 110, 87, 0)
print("End\nTurn", end_turn_x, 80+7, 0)
if hovered and hovered.interest=="End\nTurn" then
spr(Card.spr_hilight.sid,
110,
80,
end_turn_x, 80,
Card.spr_hilight.colorkey,
1, 0, 0,
Card.spr_hilight.tw,
Card.spr_hilight.th)
end
else
print("End\nTurn", 110, 87, 13)
print("End\nTurn", end_turn_x, 80+7, 13)
end
local hand_start_x=((240 - #cards_in_hand * 12) / 2)
local hand_start_x=((240 - #cards_in_hand * 12 - 24) / 2)
for i,card in ipairs(cards_in_hand) do
local ty=0
local sel_state = nil