how to save my inventory?

function addItemToInventory( itemIndex,inSlot )  
 local itemIndex = itemIndex  
 local inSlot = inSlot  
  
 local redraw = redraw or false  
   
 local foto  
 local theImage=""  
 local scalaX  
 local scalaY  
 local W  
 local H  
   
   
 if itemIndex==1 then  
 theImage = items[1]  
 W = 80  
 H = 80  
 scalaX = 1  
 scalaY = 1  
  
 elseif itemIndex == 2 then  
 theImage = items[2]  
 W = 40  
 H = 40  
 scalaX = 0.6  
 scalaY = 0.6  
  
 elseif itemIndex == 3 then  
 theImage = items[3]  
 W = 40  
 H = 40  
 scalaX = 0.6  
 scalaY = 0.6  
  
 else  
 return nil  
 end  
   
 inventoryBag[inSlot] = itemIndex  
  
 foto = display.newImageRect( theImage, W, H )  
 foto.xScale = scalaX  
 foto.yScale = scalaY  
 foto.x = 50  
 foto.y = 150  
  
 return foto  
  
end  

I have used your code that you have post earlier
and for me works

thanks [import]uid: 23063 topic_id: 12352 reply_id: 45848[/import]

I’m having a little problem…
the position 2 of slots are fixed with number “7”
and I cant find where did you put that in slot 2 will be item 7
also i dont know where to change this :S

can you help me?

thanks [import]uid: 23063 topic_id: 12352 reply_id: 45874[/import]

thats impressive, but how to position each slot on screen, so when i add item to inventory it appears on screen in certain position? [import]uid: 16142 topic_id: 12352 reply_id: 45884[/import]

@Dhennrich,
there is *NO* fixed slot for any item, you can use any item in any slot.

The way to change is the same, addItemToInventory(itemNo, slotNo)

if you look at the code, it tries to remove the item that was in that slot and then it adds the new item in that slot.

I have written a small article on pointing you on how to use the inventory system and display icons on the screen correspondingly. It is not full code, it is more of a pointer to get you on the right track.

you can find it here

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 12352 reply_id: 45894[/import]

See the code/explanation here for a detailed explanation on how to achieve that.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 12352 reply_id: 45895[/import]

Hello jayantv, sorry to bother you, but can you tell me whats wrong with this code?
Terminal is telling me that is math.round cannot be called(nil value

i used all of your tutorial code
http://pastebin.com/tLVDf4im [import]uid: 16142 topic_id: 12352 reply_id: 46099[/import]

Put some print statements around the call to see what is nil. Once you find that out, trace backwards from the call and repeat until you find the problem. [import]uid: 58455 topic_id: 12352 reply_id: 46118[/import]

@darkconsoles,
What is the value of these values in your code?
iconsAcross and SlotNo?

if either of them is NIL, you will get an error.

on line 116, add
print(slotNo, iconsAcross)

if you do not see 2 numbers, then one of the value is nil and you need to set it.

Look at the last line in the code,
you have
displayIconOnScreen(3,1)

but the function is defined as
function displayIconOnScreen(slotNo)

so you need to pass it only 1 variable, the slot no, not the item no.

on Line 41, I think it could have been me, there is an ‘s’ missing from saveInventory

and I think I was reading somewhere on the forum, that there was an issue with math.round on one of the builds of CoronaSDK, maybe you need to update the build that you have, if everything else if fine.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 12352 reply_id: 46197[/import]

i suspect its a build problem, pity i do not have subscription yet and cant dl new builds( anyone know when new builds becomes available for all? [import]uid: 16142 topic_id: 12352 reply_id: 46199[/import]

hello again, i know there was a math.round problem, but is it good enough to use another math. function?
i used math.random and it displaying icon on screen
[lua]function displayIconOnScreen(slotNo)
local imageName = items[slotNo]
print(slotNo, iconsAcross)
rowNo = math.random(slotNo / iconsAcross)
columnNo = (slotNo % iconsAcross)

local xPos = columnNo * iconWidth
local yPos = rowNo * iconHeight

local image = display.newImage(imageName)
image.x = offsetX + xPos
image.y = offsetY + yPos
end[/lua] [import]uid: 16142 topic_id: 12352 reply_id: 46497[/import]

has anyone succeeded in making working simple inventory system for point’n’click game? mind share it with us? i even wish to pay for such template if its possible [import]uid: 16142 topic_id: 12352 reply_id: 50192[/import]

I have… but now I need to leave home so when I return I will share my code here … it’s not a good solution… but works… and you will need time for this code ^^ [import]uid: 23063 topic_id: 12352 reply_id: 50197[/import]

well… I dont know how ‘code’ works here in forum so I will need to put 3 post to show you how it works…
first… my addInventoryItem function:

function addItemToInventory( itemIndex,inSlot )  
 local itemIndex = itemIndex  
 local inSlot = inSlot  
  
 local redraw = redraw or false  
   
 local foto  
 local theImage=""  
 local scalaX  
 local scalaY  
 local W  
 local H  
   
   
 if itemIndex==1 then  
 theImage = items[1]  
  
 elseif itemIndex == 2 then  
 theImage = items[2]  
  
 elseif itemIndex == 3 then  
 theImage = items[3]  
  
 elseif itemIndex == 4 then  
 theImage = items[4]   
  
  
 elseif itemIndex == 5 then  
 theImage = items[5]   
  
 elseif itemIndex == 6 then  
 theImage = items[6]   
  
 elseif itemIndex == 7 then  
 theImage = items[7]   
  
 elseif itemIndex == 8 then  
 theImage = items[8]   
  
 elseif itemIndex == 9 then  
 theImage = items[9]   
  
 elseif itemIndex == 10 then  
 theImage = items[10]   
  
 elseif itemIndex == 11 then  
 theImage = items[11]   
  
 else  
 return nil  
 end  
   
 inventoryBag[inSlot] = itemIndex  
  
end  
  

[import]uid: 23063 topic_id: 12352 reply_id: 50214[/import]

now my displayInventory function:

function displayInventory()  
 local i  
 local imagem2, displayImte  
 local posX, posY  
  
 if not fundoInventario then  
 fundoInventario = display.newImageRect( "textura\_bag.png", 320, 58 )  
 fundoInventario.x = 451  
 fundoInventario.y = 160  
 fundoInventario.rotation = 90  
 invGroup:insert( fundoInventario )  
 end  
  
  
 for i=1,slots do  
 local itemInSlot = inventoryBag[i]  
 print("ItemInSlot",i,itemInSlot)  
  
 if itemInSlot ~= nil or itemInSlot ~= 0 then  
  
 if i == 1 and itemInSlot == 1 or i == 2 and itemInSlot == 1 or i == 3 and itemInSlot == 1 or i == 4 and itemInSlot == 1 or i == 4 and itemInSlot == 1 or i == 5 and itemInSlot == 1 then  
 imagem2 = items[1]   
  
 if \_G.pauMarretaNoInvCreate-0 == 0 then  
 \_G.pauMarretaNoInvCreate = 1  
 saveit.save()  
  
 displayImte = display.newImageRect( imagem2 .. ".png", 28, 58 )  
 displayImte.xScale = 0.6  
 displayImte.yScale = 0.6  
 displayImte.alpha = 0  
 displayImte.x = 451  
 invGroup:insert( displayImte )  
 if i == 1 then  
 displayImte.y = 30  
  
 elseif i == 2 then  
 displayImte.y = 95  
  
 elseif i == 3 then  
 displayImte.y = 160  
  
 elseif i == 4 then  
 displayImte.y = 225  
  
 elseif i == 5 then  
 displayImte.y = 290  
 end   
  
 transition.to( displayImte, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickPauMarretaInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[1]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[1] then  
 item1Fucao = items[1]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[1] then  
 item2Fucao = items[1]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[1] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[1] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()  
  
  
 end   
  
  
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickPauMarreta = clickPauMarreta + 1  
 end  
  
  
  
 fucaoItens = function()  
 if item1Fucao == items[1] and item2Fucao == items[2] or item1Fucao == items[2] and item2Fucao == items[1] then  
 -- audio.play( fucaoAceita ) -- som para a combinacao de itens  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 removeItemFromInventory(1)  
 removeItemFromInventory(2)  
 saveInventory()  
  
  
 itemSelecionado = "vazio"  
  
 transition.to( displayImte, { time = 1000, alpha = 0, onComplete = function() displayImte:removeSelf(); end } )  
  
 transition.to( displayImte2, { time = 1000, alpha = 0, onComplete = function() displayImte2:removeSelf(); end } )  
  
  
 if inventoryBag[1] == 0 then  
 addItemToInventory(4,1)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[2] == 0 then  
 addItemToInventory(4,2)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[3] == 0 then  
 addItemToInventory(4,4)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[4] == 0 then  
 addItemToInventory(4,4)  
 saveInventory()  
 displayInventory()   
  
 elseif inventoryBag[5] == 0 then  
 addItemToInventory(4,5)  
 saveInventory()  
 displayInventory()  
  
 end  
  
  
  
  
 else  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end   
  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandePauMarreta = function()  
 if clickPauMarreta \< 2 then  
 clickPauMarreta = 0  
 end   
  
 if clickPauMarreta \>= 2 then  
 clickPauMarreta = 0  
 pauMarretaGrande.alpha = 1  
 pauMarretaGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tPauMarreta = timer.performWithDelay( 500, itemGrandePauMarreta, 1 )  
 end  
  
 end  
 end  
  
  
 displayImte:addEventListener( "touch", clickPauMarretaInv )  
  
 end  
  
 elseif i == 1 and itemInSlot == 2 or i == 2 and itemInSlot == 2 or i == 3 and itemInSlot == 2 or i == 4 and itemInSlot == 2 or i == 4 and itemInSlot == 2 or i == 5 and itemInSlot == 2 then  
 imagem2 = items[2]   
  
 if \_G.cabecaMarretaNoInvCreate-0 == 0 then  
  
 \_G.cabecaMarretaNoInvCreate = 1  
 saveit.save()  
  
 displayImte2 = display.newImageRect( imagem2 .. ".png", 28, 12 )  
 displayImte2.xScale = 1  
 displayImte2.yScale = 1  
 displayImte2.alpha = 0  
 displayImte2.x = 451  
 invGroup:insert( displayImte2 )  
 if i == 1 then  
 displayImte2.y = 30  
  
 elseif i == 2 then  
 displayImte2.y = 95  
  
 elseif i == 3 then  
 displayImte2.y = 160  
  
 elseif i == 4 then  
 displayImte2.y = 225  
  
 elseif i == 5 then  
 displayImte2.y = 290  
 end   
  
 transition.to( displayImte2, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickCabecaMarretaInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[2]  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[2] then  
 item1Fucao = items[2]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[2] then  
 item2Fucao = items[2]  
  
 end   
  
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[2] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[2] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()  
  
  
 end   
  
  
  
 fucaoItens = function()  
 if item1Fucao == items[1] and item2Fucao == items[2] or item1Fucao == items[2] and item2Fucao == items[1] then  
 -- audio.play( fucaoAceita ) -- som para a combinacao de itens  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 removeItemFromInventory(1)  
 removeItemFromInventory(2)  
 saveInventory()  
  
  
 itemSelecionado = "vazio"  
  
 transition.to( displayImte, { time = 1000, alpha = 0, onComplete = function() displayImte:removeSelf(); end } )  
  
 transition.to( displayImte2, { time = 1000, alpha = 0, onComplete = function() displayImte2:removeSelf(); end } )  
  
  
 if inventoryBag[1] == 0 then  
 addItemToInventory(4,1)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[2] == 0 then  
 addItemToInventory(4,2)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[3] == 0 then  
 addItemToInventory(4,4)  
 saveInventory()  
 displayInventory()  
  
 elseif inventoryBag[4] == 0 then  
 addItemToInventory(4,4)  
 saveInventory()  
 displayInventory()   
  
 elseif inventoryBag[5] == 0 then  
 addItemToInventory(4,5)  
 saveInventory()  
 displayInventory()  
  
 end  
  
  
  
  
 else  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end   
  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickCabecaMarreta = clickCabecaMarreta + 1  
 end  
  
  
 itemGrandeCabecaMarreta = function()  
 if clickCabecaMarreta \< 2 then  
 clickCabecaMarreta = 0  
 end   
  
 if clickCabecaMarreta \>= 2 then  
 clickCabecaMarreta = 0  
 \_G.itemGrande = 1  
 saveit.save()  
 cabecaMarretaGrande.alpha = 1  
 cabecaMarretaGrande:toFront()  
 end   
 end   
  
 if \_G.podeFucao-0 == 1 then  
 tCabecaMarreta = timer.performWithDelay( 500, itemGrandeCabecaMarreta, 1 )  
 end  
  
 end  
 end  
  
  
 displayImte2:addEventListener( "touch", clickCabecaMarretaInv )  
  
 end  
  
 elseif i == 1 and itemInSlot == 3 or i == 2 and itemInSlot == 3 or i == 3 and itemInSlot == 3 or i == 4 and itemInSlot == 3 or i == 4 and itemInSlot == 3 or i == 5 and itemInSlot == 3 then  
 imagem2 = items[3]   
  
 if \_G.celularNoInvCreate-0 == 0 then  
  
 \_G.celularNoInvCreate = 1  
 saveit.save()  
  
 displayImte3 = display.newImageRect( imagem2 .. ".png", 28, 58 )  
 displayImte3.xScale = 0.5  
 displayImte3.yScale = 0.5  
 displayImte3.alpha = 0  
 displayImte3.rotation = 25  
 displayImte3.x = 451  
 invGroup:insert( displayImte3 )  
 if i == 1 then  
 displayImte3.y = 30  
  
 elseif i == 2 then  
 displayImte3.y = 95  
  
 elseif i == 3 then  
 displayImte3.y = 160  
  
 elseif i == 4 then  
 displayImte3.y = 225  
  
 elseif i == 5 then  
 displayImte3.y = 290  
 end   
  
 transition.to( displayImte3, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickCelularInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[3]  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[3] then  
 item1Fucao = items[3]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[3] then  
 item2Fucao = items[3]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[3] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[3] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()  
  
  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickCelular = clickCelular + 1  
 end  
  
 itemGrandeCelular = function()  
 if clickCelular \< 2 then  
 clickCelular = 0  
 end   
  
 if clickCelular \>= 2 then  
 clickCelular = 0  
 \_G.itemGrande = 1  
 saveit.save()  
 celularGrande.alpha = 1  
 celularGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tCelular = timer.performWithDelay( 500, itemGrandeCelular, 1 )  
 end   
  
 end  
 end  
  
  
 displayImte3:addEventListener( "touch", clickCelularInv )  
  
 end  
  
 elseif i == 1 and itemInSlot == 4 or i == 2 and itemInSlot == 4 or i == 3 and itemInSlot == 4 or i == 4 and itemInSlot == 4 or i == 4 and itemInSlot == 4 or i == 5 and itemInSlot == 4 then  
 imagem2 = items[4]  
  
 if \_G.marretaNoInvCreate-0 == 0 then  
  
 \_G.marretaNoInvCreate = 1  
 saveit.save()  
  
 itemFundido1 = display.newImageRect( imagem2 .. ".png", 28, 58 )  
 itemFundido1.xScale = 0.6  
 itemFundido1.yScale = 0.6  
 itemFundido1.alpha = 0  
 itemFundido1.rotation = 25  
 itemFundido1.x = 451  
 invGroup:insert( itemFundido1 )  
  
 if i == 1 then  
 itemFundido1.y = 30  
  
 elseif i == 2 then  
 itemFundido1.y = 95  
  
 elseif i == 3 then  
 itemFundido1.y = 160  
  
 elseif i == 4 then  
 itemFundido1.y = 225  
  
 elseif i == 5 then  
 itemFundido1.y = 290  
 end   
  
 transition.to( itemFundido1, { delay = 1000, time = 300, alpha = 1 } )  
  
  
 clickItemFundido1Inv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[4]  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[4] then  
 item1Fucao = items[4]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[4] then  
 item2Fucao = items[4]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[4] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[4] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()  
  
  
 end  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end  
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickMarreta = clickMarreta + 1  
 end   
  
 itemGrandeItemFundido1 = function()  
 if clickMarreta \< 2 then  
 clickMarreta = 0  
 end   
  
 if clickMarreta \>= 2 then  
 clickMarreta = 0  
 \_G.itemGrande = 1  
 saveit.save()  
 marretaGrande.alpha = 1  
 marretaGrande:toFront()  
 end   
 end   
 tItemFundido1 = timer.performWithDelay( 500, itemGrandeItemFundido1, 1 )  
 end  
 end  
  
 if \_G.podeFucao-0 == 1 then  
 itemFundido1:addEventListener( "touch", clickItemFundido1Inv )   
 end  
  
 end  
  
  
 elseif i == 1 and itemInSlot == 5 or i == 2 and itemInSlot == 5 or i == 3 and itemInSlot == 5 or i == 4 and itemInSlot == 5 or i == 4 and itemInSlot == 5 or i == 5 and itemInSlot == 5 then  
 imagem2 = items[5]  
  
  
 if \_G.chave1InvCreate-0 == 0 then  
 \_G.chave1InvCreate = 1  
 saveit.save()  
  
  
 displayImage5 = display.newImageRect( imagem2 .. ".png", 28, 18 )  
 displayImage5.xScale = 0.6  
 displayImage5.yScale = 0.6  
 displayImage5.alpha = 0  
 displayImage5.x = 451  
 invGroup:insert( displayImage5 )  
  
 if i == 1 then  
 displayImage5.y = 30  
  
 elseif i == 2 then  
 displayImage5.y = 95  
  
 elseif i == 3 then  
 displayImage5.y = 160  
  
 elseif i == 4 then  
 displayImage5.y = 225  
  
 elseif i == 5 then  
 displayImage5.y = 290  
 end   
  
 transition.to( displayImage5, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickChave1Inv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[5]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[5] then  
 item1Fucao = items[5]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[5] then  
 item2Fucao = items[5]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[5] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[5] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()   
  
 end   
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickChave1 = clickChave1 + 1  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandeChave1 = function()  
 if clickChave1 \< 2 then  
 clickChave1 = 0  
 end   
  
 if clickChave1 \>= 2 then  
 clickChave1 = 0  
 chave1Grande.alpha = 1  
 chave1Grande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tChave1 = timer.performWithDelay( 500, itemGrandeChave1, 1 )  
 end  
  
 end  
 end  
  
  
 displayImage5:addEventListener( "touch", clickChave1Inv )  
  
 end  
  
  
  
 elseif i == 1 and itemInSlot == 6 or i == 2 and itemInSlot == 6 or i == 3 and itemInSlot == 6 or i == 4 and itemInSlot == 6 or i == 4 and itemInSlot == 6 or i == 5 and itemInSlot == 6 then  
 imagem2 = items[6]  
  
  
 if \_G.livroInvCreate-0 == 0 then  
 \_G.livroInvCreate = 1  
 saveit.save()  
  
  
 displayImage6 = display.newImageRect( imagem2 .. ".png", 48, 38 )  
 displayImage6.xScale = 0.6  
 displayImage6.yScale = 0.6  
 displayImage6.alpha = 0  
 displayImage6.x = 451  
 invGroup:insert( displayImage6 )  
  
 if i == 1 then  
 displayImage6.y = 30  
  
 elseif i == 2 then  
 displayImage6.y = 95  
  
 elseif i == 3 then  
 displayImage6.y = 160  
  
 elseif i == 4 then  
 displayImage6.y = 225  
  
 elseif i == 5 then  
 displayImage6.y = 290  
 end   
  
 transition.to( displayImage6, { delay = 300, time = 500, alpha = 0.7 } )  
  
  
 clickLivroInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[6]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[6] then  
 item1Fucao = items[6]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[6] then  
 item2Fucao = items[6]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[6] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[6] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()   
  
 end   
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickLivro = clickLivro + 1  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandeLivro = function()  
 if clickLivro \< 2 then  
 clickLivro = 0  
 end   
  
 if clickLivro \>= 2 then  
 clickLivro = 0  
 livroGrande.alpha = 1  
 livroGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tLivro = timer.performWithDelay( 500, itemGrandeLivro, 1 )  
 end  
  
 end  
 end  
  
  
 displayImage6:addEventListener( "touch", clickLivroInv )  
  
 end  
  
  
  
 elseif i == 1 and itemInSlot == 7 or i == 2 and itemInSlot == 7 or i == 3 and itemInSlot == 7 or i == 4 and itemInSlot == 7 or i == 4 and itemInSlot == 7 or i == 5 and itemInSlot == 7 then  
 imagem2 = items[7]  
  
  
 if \_G.coisaNoLivroInvCreate-0 == 0 then  
 \_G.coisaNoLivroInvCreate = 1  
 saveit.save()  
  
  
 displayImage7 = display.newImageRect( imagem2 .. ".png", 18, 36 )  
 displayImage7.xScale = 0.6  
 displayImage7.yScale = 0.6  
 displayImage7.alpha = 0  
 displayImage7.x = 451  
 invGroup:insert( displayImage7 )  
  
 if i == 1 then  
 displayImage7.y = 30  
  
 elseif i == 2 then  
 displayImage7.y = 95  
  
 elseif i == 3 then  
 displayImage7.y = 160  
  
 elseif i == 4 then  
 displayImage7.y = 225  
  
 elseif i == 5 then  
 displayImage7.y = 290  
 end   
  
 transition.to( displayImage7, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickCoisaDoLivroInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[7]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[7] then  
 item1Fucao = items[7]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[7] then  
 item2Fucao = items[7]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[7] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[7] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()   
  
 end   
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickCoisaDoLivro = clickCoisaDoLivro + 1  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandeCoisaDoLivro = function()  
 if clickCoisaDoLivro \< 2 then  
 clickCoisaDoLivro = 0  
 end   
  
 if clickCoisaDoLivro \>= 2 then  
 clickCoisaDoLivro = 0  
 coisaDoLivroGrande.alpha = 1  
 coisaDoLivroGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tCoisaDoLivro = timer.performWithDelay( 500, itemGrandeCoisaDoLivro, 1 )  
 end  
  
 end  
 end  
  
  
 displayImage7:addEventListener( "touch", clickCoisaDoLivroInv )  
  
 end  
  
  
  
 elseif i == 1 and itemInSlot == 8 or i == 2 and itemInSlot == 8 or i == 3 and itemInSlot == 8 or i == 4 and itemInSlot == 8 or i == 4 and itemInSlot == 8 or i == 5 and itemInSlot == 8 then  
 imagem2 = items[8]  
  
  
 if \_G.lanternaInvCreate-0 == 0 then  
 \_G.lanternaInvCreate = 1  
 saveit.save()  
  
  
 displayImage8 = display.newImageRect( imagem2 .. ".png", 20, 38 )  
 displayImage8.xScale = 0.6  
 displayImage8.yScale = 0.6  
 displayImage8.alpha = 0  
 displayImage8.x = 451  
 invGroup:insert( displayImage8 )  
  
 if i == 1 then  
 displayImage8.y = 30  
  
 elseif i == 2 then  
 displayImage8.y = 95  
  
 elseif i == 3 then  
 displayImage8.y = 160  
  
 elseif i == 4 then  
 displayImage8.y = 225  
  
 elseif i == 5 then  
 displayImage8.y = 290  
 end   
  
 transition.to( displayImage8, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickLanternaInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[8]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[8] then  
 item1Fucao = items[8]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[8] then  
 item2Fucao = items[8]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[8] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[8] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()   
  
 end   
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickLanterna = clickLanterna + 1  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandeLanterna = function()  
 if clickLanterna \< 2 then  
 clickLanterna = 0  
 end   
  
 if clickLanterna \>= 2 then  
 clickLanterna = 0  
 lanternaGrande.alpha = 1  
 lanternaGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tLanterna = timer.performWithDelay( 500, itemGrandeLanterna, 1 )  
 end  
  
 end  
 end  
  
  
 displayImage8:addEventListener( "touch", clickLanternaInv )  
  
 end  
  
  
 elseif i == 1 and itemInSlot == 9 or i == 2 and itemInSlot == 9 or i == 3 and itemInSlot == 9 or i == 4 and itemInSlot == 9 or i == 4 and itemInSlot == 9 or i == 5 and itemInSlot == 9 then  
 imagem2 = items[9]  
  
  
 if \_G.pedecabraInvCreate-0 == 0 then  
 \_G.pedecabraInvCreate = 1  
 saveit.save()  
  
  
 displayImage9 = display.newImageRect( imagem2 .. ".png", 40, 48 )  
 displayImage9.xScale = 0.6  
 displayImage9.yScale = 0.6  
 displayImage9.alpha = 0  
 displayImage9.x = 451  
 invGroup:insert( displayImage9 )  
  
 if i == 1 then  
 displayImage9.y = 30  
  
 elseif i == 2 then  
 displayImage9.y = 95  
  
 elseif i == 3 then  
 displayImage9.y = 160  
  
 elseif i == 4 then  
 displayImage9.y = 225  
  
 elseif i == 5 then  
 displayImage9.y = 290  
 end   
  
 transition.to( displayImage9, { delay = 300, time = 500, alpha = 1 } )  
  
  
 clickPedecabraInv = function(e)  
 if e.phase == "ended" then  
 itemSelecionado = items[9]  
  
  
 if \_G.podeFucao-0 == 0 then  
 if item1Fucao == nil and item2Fucao ~= items[9] then  
 item1Fucao = items[9]  
  
 elseif item2Fucao == nil and item1Fucao ~= items[9] then  
 item2Fucao = items[9]  
  
 end   
 end  
  
  
 if \_G.podeFucao-0 == 1 then  
 borda.x = 451   
 if i == 1 then  
 borda.y = 30  
  
 elseif i == 2 then  
 borda.y = 95  
  
 elseif i == 3 then  
 borda.y = 160  
  
 elseif i == 4 then  
 borda.y = 225  
  
 elseif i == 5 then  
 borda.y = 290  
 end   
  
 borda.alpha = 1  
 borda:toFront()  
  
 elseif \_G.podeFucao-0 == 0 and item1Fucao == items[9] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao.x = 451   
 if i == 1 then  
 bordaFucao.y = 30  
  
 elseif i == 2 then  
 bordaFucao.y = 95  
  
 elseif i == 3 then  
 bordaFucao.y = 160  
  
 elseif i == 4 then  
 bordaFucao.y = 225  
  
 elseif i == 5 then  
 bordaFucao.y = 290  
 end   
  
 bordaFucao.alpha = 1  
 bordaFucao:toFront()  
  
  
 elseif \_G.podeFucao-0 == 0 and item2Fucao == items[9] then  
 if borda then  
 borda.alpha = 0  
 end  
  
 bordaFucao2.x = 451   
 if i == 1 then  
 bordaFucao2.y = 30  
  
 elseif i == 2 then  
 bordaFucao2.y = 95  
  
 elseif i == 3 then  
 bordaFucao2.y = 160  
  
 elseif i == 4 then  
 bordaFucao2.y = 225  
  
 elseif i == 5 then  
 bordaFucao2.y = 290  
 end   
  
 bordaFucao2.alpha = 1  
 bordaFucao2:toFront()   
  
 end   
  
  
  
 if \_G.podeFucao-0 == 1 then  
 clickPedecabra = clickPedecabra + 1  
 end  
  
  
  
 fucaoItens = function()  
  
 --audio.play( erroFucao )  
  
 \_G.podeFucao = 1  
 saveit.save()  
  
 transition.to( bordaFucao, { time = 1000, alpha = 0 } )  
 transition.to( bordaFucao2, { time = 1000, alpha = 0 } )  
  
 item1Fucao = nil  
 item2Fucao = nil  
  
 end  
  
  
  
 if item1Fucao ~= nil and item2Fucao ~= nil then  
 fucaoItens()  
 end   
  
  
  
 itemGrandePedecabra = function()  
 if clickPedecabra \< 2 then  
 clickPedecabra = 0  
 end   
  
 if clickPedecabra \>= 2 then  
 clickPedecabra = 0  
 pedecabraGrande.alpha = 1  
 pedecabraGrande:toFront()  
 end   
 end  
  
 if \_G.podeFucao-0 == 1 then  
 tPedecabra = timer.performWithDelay( 500, itemGrandePedecabra, 1 )  
 end  
  
 end  
 end  
  
  
 displayImage9:addEventListener( "touch", clickPedecabraInv )  
  
 end  
  
  
 end -- mudar para elseif para add novos itens  
  
  
  
  
 --print(i,items[itemInSlot])  
 end  
 end  
  
 invGroup:toFront()  
end  
  

There’s alot of code that you will not use… like “fucaoItens”… maybe you will want to use my double click function that make a “zoom” of you item…for this works you need to put this:

-- Pau da Marreta   
pauMarretaGrande = display.newImageRect( "pau\_grande.png", 480, 320 )  
pauMarretaGrande.x = \_W/2  
pauMarretaGrande.y = \_H/2  
pauMarretaGrande.alpha = 0  

outside of displayInventory
[import]uid: 23063 topic_id: 12352 reply_id: 50216[/import]

and now… in my scene when you click on a object:

local textoInvFull = display.newText( "Well... I guess this is the maximum that I can carry", 100, 290, nil, 12 )  
textoInvFull.alpha = 0  
gameGroup:insert( textoInvFull )  
  
funcPauMarreta = function(e)  
 if e.phase == "ended" then  
 if inventoryBag[1] == 0 then  
 transition.to( pauMarretaCenario, { time = 600, alpha = 0, xScale = 0.6, yScale = 0.6, x = 451, y = 30, onComplete = function() pauMarretaCenario:removeSelf(); pauMarretaCenario = nil; end } )  
 addItemToInventory(1,1)  
  
 saveInventory()  
 displayInventory()  
  
 \_G.podeCriarPauMarreta = 1  
 saveit.save()  
  
 elseif inventoryBag[2] == 0 then  
 transition.to( pauMarretaCenario, { time = 600, alpha = 0, xScale = 0.6, yScale = 0.6, x = 451, y = 95, onComplete = function() pauMarretaCenario:removeSelf(); pauMarretaCenario = nil; end } )  
 addItemToInventory(1,2)  
  
 saveInventory()  
 displayInventory()  
  
 \_G.podeCriarPauMarreta = 1  
 saveit.save()  
  
 elseif inventoryBag[3] == 0 then  
 transition.to( pauMarretaCenario, { time = 600, alpha = 0, xScale = 0.6, yScale = 0.6, x = 451, y = 160, onComplete = function() pauMarretaCenario:removeSelf(); pauMarretaCenario = nil; end } )  
 addItemToInventory(1,3)  
  
 saveInventory()  
 displayInventory()  
  
 \_G.podeCriarPauMarreta = 1  
 saveit.save()  
  
 elseif inventoryBag[4] == 0 then  
 transition.to( pauMarretaCenario, { time = 600, alpha = 0, xScale = 0.6, yScale = 0.6, x = 451, y = 225, onComplete = function() pauMarretaCenario:removeSelf(); pauMarretaCenario = nil; end } )  
 addItemToInventory(1,4)  
  
 saveInventory()  
 displayInventory()  
  
 \_G.podeCriarPauMarreta = 1  
 saveit.save()  
  
 elseif inventoryBag[5] == 0 then  
 transition.to( pauMarretaCenario, { time = 600, alpha = 0, xScale = 0.6, yScale = 0.6, x = 451, y = 290, onComplete = function() pauMarretaCenario:removeSelf(); pauMarretaCenario = nil; end } )  
 addItemToInventory(1,5)  
  
 saveInventory()  
 displayInventory()  
  
 \_G.podeCriarPauMarreta = 1  
 saveit.save()  
  
 else  
 textoInvFull.alpha = 1  
 transition.to( textoInvFull, { time = 1500, alpha = 0 } )  
  
 end  
  
 end  
end   
if pauMarretaCenario then  
 pauMarretaCenario:addEventListener( "touch", funcPauMarreta )  
end  

[import]uid: 23063 topic_id: 12352 reply_id: 50217[/import]

by the way…

[code]
local items = {}
items[1] = “pauMarreta”
items[2] = “cabecaMarreta”
items[3] = “celular”
items[4] = “marreta”
items[5] = “chave1”
items[6] = “livro”
items[7] = “chave2”
items[8] = “lanterna_menor”
items[9] = “pedecabra”

[/code] [import]uid: 23063 topic_id: 12352 reply_id: 50220[/import]

i’m a little confused with this all…( can you please post all your code at pastebin.com?(so that i just paste it in main.lua and see how it works on a simulator) it will be much appreciated [import]uid: 16142 topic_id: 12352 reply_id: 50235[/import]

I have separete my inventory and game… I can upload my .lua to you, i guess [import]uid: 23063 topic_id: 12352 reply_id: 50254[/import]

http://www.megaupload.com/?d=ABRC7740

I dont think you will undestand but…

is a little mess in my displayInventory function… because I have add 2 systems, fusion and double kick, if you want…
you will need a long time to undestand all this :X hehehe [import]uid: 23063 topic_id: 12352 reply_id: 50258[/import]

wow,i didnt expect all this to be that long and hard
how did you do this? you must be some kind of genius)

i’ll try to understand, but i dont think i can( [import]uid: 16142 topic_id: 12352 reply_id: 50299[/import]