okay, so I have a school project where I am showing a small game where all you is shoot a monster, but that don’t work; I get this error:
main.lua:118: attempt to index local ‘event’ (a nil value)
stack traceback:
main.lua:118: in function <main.lua:117>
?: in function <?:169>
Do you want to relaunch the project?
Here’s the code that creates the error (it’s line 117 to 129):
local function onLocalCollision( self, event )
if event.phase == “began” and self.name == “bullet” and event.other.name == “enemy” then
display.remove( enemy )
end
end
bullet.collision = onLocalCollision
bullet:addEventListener( “collision” )
enemy.collision = onLocalCollision
enemy:addEventListener( “collision” )
Runtime:addEventListener( “enterFrame”, onLocalCollision )
Thanks in advance!