bad argument#-1 to '_listener'(Proxy expected, got nil)

Could it be because the collision listener is at the wrong place?

‘Proxy expected, got nil’ - your function expected proxy as argument (image) but got nil. It means that cannonBall is not display object but nil.

Why it’s called proxy? It’s because from Lua code images are tables with image data atached. It’s under .__proxy property of display object (table), thats why error calls it ‘proxy’. Of course cannot do anything with it from Lua code, but Corona uses it underneath.

So it detects nothing even though its an image? Is there anyway to fix it?

Are you sure there is image? Because it’s nil then it seems it failed to create it.

If is then the reason can be listener.

On collision you call removeSelf() which only removea image data (proxy) but still leaves skeleton table, so you must also nil object.

If you have code as you posted then another problem is that you add collision listener with function you declare underneath, which totaly wrong.

What’s more

[lua]
When the event is detected with a table listener within an object, certain properties are replaced:
object1 → target
object2 → other
element1 → selfElement
element2 → otherElement
[/lua]

You do not use this type of listener so your collision function doesn’t have event.target or event.other but event.object1 and event.object2.

It’s all I can see wrong / potentially wrong in posted code. Tell me if something will help :slight_smile:

So i put e.other = nill and e.target = nill?

There is no other and target according to documentation.

What do you mean by nil object then?