hey guys i ran into a little problem, i am spawning some objects on screen but when i try to rest the game scene from the win scene the objects i am try to spawn doesn’t rest them. i believe this problem pop up because i am not inserting the objects into a group so when the scene change the objects/ table destroy himself. also the coinsTable is in my create scene, try to insert the table by doing this
coinsTable = { "awards/coin01", "awards/coin02", "awards/coin03","awards/coin04"} coins = {} table.insert(coinsTable, coins);
but i wind up with an error "attempt to concatenate field ? " (a table value) the line the error occurred is
coins [#coins + 1] = display.newImage( coinsTable[ranNum]..".png" )
this function below spawn my coins
function spawnCoins() ranNum = math.random(#coinsTable ) coins [#coins + 1] = display.newImage( coinsTable[ranNum]..".png" ) coins[#coins].x = math.random(-10, 300); coins[#coins].y = -40; coins[#coins].id = coinsNum coins[#coins].name = "coins" physics.addBody( coins[#coins], "dynamic", { friction =1, bounce =0, density=0 } ) transition.to( coins[#coins], {time = math.random(2000, 8000), x = math.random(100, 300) , y = 600, onComplete = remove}); coins[#coins]:addEventListener("touch", touchCoins) -- touch coins[#coins].isFixedRotation = true end --total\_enemy = 10 timer8 =timer.performWithDelay( 1000, spawnCoins, 0 )
can someone please help my
thanks you help will be greatly appreciated