From ad17db85b5e7eb2c90d3093bb2d05a6dd8daf8ed Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Tue, 25 Jul 2017 02:19:40 -0400 Subject: [PATCH] Functioning output table --- crafting.lua | 14 ++++++++++++++ menu.lua | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/crafting.lua b/crafting.lua index bc32803..6aa0727 100644 --- a/crafting.lua +++ b/crafting.lua @@ -11,12 +11,18 @@ crafting_y = 350 craft_inv_x = 120 craft_inv_y = 50 +craft_output_x = 380 +craft_output_y = 134 + crafting_selection_x = 1 crafting_selection_y = 1 craft_inventory_selection_x = 0 craft_inventory_selection_y = 0 +craft_output_selection_x = 0 +craft_output_selection_y = 0 + crafting.craft_inventory = {} --create crafting inventory @@ -27,6 +33,14 @@ end --draw entire inventory function crafting.render_crafting() if crafting_open == true then + --draw output table + love.graphics.draw(inventory_slot, craft_output_x, craft_output_y,0, 1, 1) + + --draw output selection + if craft_output_selection_x > 0 and craft_output_selection_y > 0 then + love.graphics.draw(inventory_slot_selection, craft_output_x, craft_output_y,0, 1, 1) + end + --draw crafting table local xstep = 0 local ystep = 0 diff --git a/menu.lua b/menu.lua index 8aabf49..dae50c5 100644 --- a/menu.lua +++ b/menu.lua @@ -201,15 +201,24 @@ function menu.cursor() if x > crafting_x and x < crafting_x + (inventory_size*84) and y > crafting_y and y < crafting_y + (inventory_height*84) then crafting_selection_x = math.ceil((x-crafting_x)/84) crafting_selection_y = math.ceil((y-crafting_y)/84) - elseif x > craft_inv_x and x < craft_inv_x + (crafting.craft_size*84) and y > craft_inv_y and y < craft_inv_y + (crafting.craft_size*84) then - craft_inventory_selection_x = math.ceil((x-craft_inv_x)/84) - craft_inventory_selection_y = math.ceil((y-craft_inv_y)/84) else crafting_selection_x = -1 crafting_selection_y = -1 + end + if x > craft_inv_x and x < craft_inv_x + (crafting.craft_size*84) and y > craft_inv_y and y < craft_inv_y + (crafting.craft_size*84) then + craft_inventory_selection_x = math.ceil((x-craft_inv_x)/84) + craft_inventory_selection_y = math.ceil((y-craft_inv_y)/84) + else craft_inventory_selection_x = -1 craft_inventory_selection_y = -1 end + if x > craft_output_x and x < craft_output_x + 84 and y > craft_output_y and y < craft_output_y + 84 then + craft_output_selection_x = math.ceil((x-craft_output_x)/84) + craft_output_selection_y = math.ceil((y-craft_output_y)/84) + else + craft_output_selection_x = -1 + craft_output_selection_y = -1 + end end end