So I’m making this brick breaker game and I’m doing an endless mode and I have most of the code but this one line of code makes something weird happen
function EndlessBricks()
local brick = display.newImage(‘brick.png’)
brick.x = math.random(100, 300)
brick.y = math.random(100, 300)
brick.name = ‘brick’
physics.addBody(brick, {density = 1, friction = 0, bounce = 0})
brick.bodyType = ‘static’
bricks.insert(bricks, brick)
end
Whenever I ran this code the bricks wouldn’t appear but if I took out the line that says bricks.insert(bricks, brick) the bricks would appear. Why does this line of code make the bricks disappear and how can I fix it. I need to know because this is a very important line of code and my game won’t work properly without it. Please help.