Help with my code!

I have a code for a game, and I would like some help with the code. My main idea was a sprite what moves along the bottom and when he hits the coins, it says in the corner, and you have 3 lives, and when you hit a crate, you lose a life. I also need a menu. Anyone who helps will get credit!!

The code is:

--Main

supportedOrientations(PORTRAIT_ANY)

function setup()

    displayMode(FULLSCREEN)  
    objectTable = {}
    lastGenerated = ElapsedTime
    interval = 1
    num = 1  
    table.insert(objectTable,Objects(math.random(1,WIDTH-1),math.random(1,4),num))
   
end

function draw()
  
    spriteMode(CENTER)
    sprite("Documents:Coin",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
    pushStyle()

    spriteMode(CENTER)
    randomObjectGenerate()   
    popStyle()       
end

function randomObjectGenerate()
    for k,v in pairs(objectTable) do 
        v:draw()    
    end
    if ElapsedTime - lastGenerated > interval then
        lastGenerated = ElapsedTime
        num = num + 1
        table.insert(objectTable,Objects(math.random(1,WIDTH-1),math.random(1,4),num))   
    end
    for k,v in pairs(objectTable) do 
        if v.a.y < 0 or (v.a.x > WIDTH or v.a.x< 0) or v.a.info.id == 0 then
            table.remove(objectTable,k)
            v.a:destroy()
            v.a = nil
            v=nil           
        end             
    end
end


--Objects

Objects = class()

function Objects:init(x,cat,id)
    -- you can accept and set parameters here
    
    self.a = physics.body(CIRCLE,20)
    self.a.x = x
    self.a.y = HEIGHT
    self.a.gravityScale = 1
    self.a.restitution = 0.0
    self.a.interpolate = true
    self.asleepingAllowed = true
    self.flag = true
    self.category = cat
    self.a.info = {}
    self.a.info.id = id
    
end

function Objects:draw()
    pushMatrix()
    translate(

I put your code in “fences” for formatting (see the FAQ on formatting hints) but it would appear to be truncated. I don’t think it is anything I did as I just added the fences. You can edit your post to add the missing code.