I want to spawn some random objects and i managed to do it from the top of the screen. Then i'd like to make them fall like in an endless runner game. But the code doesn't work and it gives me an error. Here is it:
local function spawn()
local object1 = display.newImage(group[i1],29,1) <---this refers to a position in a group of objects
object1:scale(1.23,1.30)
end
timer.performWithDelay(2000,spawn,-1)
local function fall()
object1.y = object1.y + 10 <---it says that this is a nil value
timer.performWithDelay(100,fall,-1)
Aucun commentaire:
Enregistrer un commentaire