I’m trying to add some objects dynamically to an objectLayer.
My map has 3 layers: 2 Tile and 1 with a spriteLayer=true property. Tried with more layers/fewer layers and it made no difference.
I load the map and then add a sprite and a corresponding object. The sprite loads fine and causes no problems, but the addObject causes the below error when mte.update happens.
[lua]
OBJ_LAYER = mte.getObjectLayer(1)
mte.addObject(OBJ_LAYER, objX)
[/lua]
[lua]
objX = { x = x+1, y = y, moveType=moveDir}
[/lua]
[lua]
mte.lua:12943: attempt to index field ‘?’ (a nil value)
message
stack traceback:
?: in function <?:218>
[/lua]
I’ve stripped everything out of my project down to just a main and error still reproduces. I also tried it using the castleDemo map/tiles and reproduced the problem.
I’m going out on a limb and saying I’m doing something wrong here, but can’t seem to figure out what.
I verified that the getObjectLayer(1) returns my object layer correctly and verified that the object is inserted into the layer correctly but the update errors.
Using daily builds of Corona from last few days (tried a couple)
Using MTE 958 and 957