I made a global variable that looks like this:
\_G.warrior = 0
I put this in Main.lua
I am using director class and i have a different scene where there is a button to make _G.warrior = 1 :
local warriorButton = display.newImage('images/warriorButton.png')
warriorButton.x = 675
warriorButton.y = 100
localGroup:insert( warriorButton )
local function pressWarrior (event)
if event.phase == "ended" then
\_G.warrior = 1
end
end
warriorButton:addEventListener ("touch", pressWarrior)
and so i want to make a function that links these together this is what i have so far:
function summonWarrior ( event )
if _G.warrior = 1 then
local warrior = display.newImage(‘images/warrior.png’)
warrior.x = 480
warrior.y = 480
localGroup:insert( warrior )
end
THNX before Hand :))) [import]uid: 34097 topic_id: 16087 reply_id: 316087[/import]