In addition to nick’s answer, you can and should use display groups to enforce layering.
MAY CONTAIN TYPOS
local underlay = display.newGroup() -- bottom of stack local clouds = display.newGroup() local content = display.newGroup() local guis = display.newGroup() -- top of stack local bg = display.newImageRect( underlay, "background.png", 960, 640 ) bg.x = display.contentCenterX bg.y = display.contentCenterY local player = = display.newImageRect( content, "player.png", 50, 50) player.x = display.contentCenterX player.y = display.contentCenterY -- clouds behind player even though created later local left = display.contentCenterX - dispay.actualContentWidth/2 local right = display.contentCenterX + dispay.actualContentWidth/2 local stepMin = 100 local stepMax = 300 local x = left + 100 while( x \< right ) do local y = math.random( -200, 200 ) local cloud = = display.newImageRect( clouds, "cloud.png", 100, 40 ) cloud.x = x cloud.y = y x = x + math.random( stepMin, stepMax ) end