When my scene changes to my file called “golevel2”, i get this error
[code]
Runtime error
/Users/Mazensalih/Documents/penguin1/level1.lua:157: attempt to perform arithmetic on field ‘x’ (a nil value)
stack traceback:
[C]: ?
/Users/Mazensalih/Documents/penguin1/level1.lua:157: in function
?: in function <?:215>
– Below is my “golevel2” file
module(…, package.seeall)
_W = display.contentWidth;
_H = display.contentHeight;
function new()
local localGroup = display.newGroup()
bg = display.newImage(“background.png”)
localGroup:insert(bg)
next = display.newImage(“next.png”)
next.x = 240
next.y = 225
localGroup:insert(next)
nex1 = display.newText(“Next”, 100, 10, native.systemFont, 34)
nex1:setTextColor(0, 0, 0)
nex1.x = 225
nex1.y = 225
level = display.newText( “Congratulations!”, 100, 10, native.systemFont, 38)
level:setTextColor(0, 0, 0)
local function pressNext (event)
if event.phase == “ended” then
director:changeScene (“level2”)
end
end
next:addEventListener (“touch”, pressNext)
– MUST return a display.newGroup()
return localGroup
end
[import]uid: 132369 topic_id: 25491 reply_id: 325491[/import]