When trying to simulate my game I get this error
Runtime error
assertion failed!
stack traceback:
C: in function ‘assert’
?: in function ‘getOrCreateTable’
?: in function ‘addEventListener’
?: in function ‘addEventListener’
c:\users\rob and aidans user\desktop\pixels\main.lua:46: in main
I dont know how to fix this problem.
Heres my code:
– cpmgen main.lua
local sprite = require(“sprite”)
local physics = require(“physics”)
physics.start()
local widgets = require(“widget”)
system.activate(“multitouch”)
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImage(“background.png”)
background.x = display.contentWidth/2; display.contentHeight = 160;
local groundbottom = display.newImage(“ground.png”)
groundbottom.x = display.contentWidth/2; groundbottom.y = display.contentHeight+150;
groundbottom:setReferencePoint(display.BottomLeftReferencePoint);
physics.addBody( groundbottom, “static”, { friction=0.5, bounce=0.3 } )
guy = display.newImage(“char.png”)
physics.addBody( guy, “dynamic”, { friction=0.5, bounce=0 } )
guy.x = math.random(10,display.contentWidth-10)
local left = display.newImage (“lftbtn.png”)
left.x = 45; left.y = 280;
local right = display.newImage (“rghtbtn.png”)
right.x = 120; right.y = 282;
function left:touch()
motionx = -speed;
guy.xScale = -1
end
left:addEventListener(“touch”,left)
function right:touch()
motionx = speed;
guy.xScale = 1
end
right:addEventListener(“touch”,right)
function moveplayer (event)
guy.x = guy.x + motionx;
end
Runtime:addEventListener(“enterFrame”, moveGuy)
function stop (event)
if event.phase ==“ended” then
motionx = 0;
end
end
Runtime:addEventListener(“touch”, stop )
player.x = 440; player.y = 280;
function guy:touch(event)
if(event.phase == “began”) then
guy:setLinearVelocity( 0, -150 )
end
end
guy:addEventListener(“touch”,guy)
print(system.getInfo(“model”))
function guy:tap( event )
if (event.numTaps == 2 ) then
print( “The object was double-tapped.” )
return true;
elseif (event.numTaps == 1 ) then
print(“The object was tapped once.”)
end
end
guy:addEventListener( “tap” )