Pleas i want from some one make a score and some stars when i collect it the game put a point

--# Main
--# CloudLevels 
CloudLevels = class()

CULLPADDING = 300

function CloudLevels:init() -- you can accept and set parameters here 
    self.clouds = {} 
    self.nextCloudHeight = 200
end

function CloudLevels:generateNextCloud() 
    cloud = Cloud() 
    cloud.position = vec2(math.random(-WIDTH/2,WIDTH/2), self.nextCloudHeight)

    table.insert(self.clouds, cloud)

    self.nextCloudHeight = self.nextCloudHeight + math.random(92,330)
end

function CloudLevels:cullClouds(floor) 
    for i,v in ipairs(self.clouds) do 
        if v.position.y < floor then 
            table.remove(self.clouds,i) 
        end 
    end 
end

function CloudLevels:isColliding(pos) 
    for i,v in ipairs(self.clouds) do 
        if v:isColliding(pos) then 
            return true 
        end 
    end
    return false
end

function CloudLevels:update(cam) 
    curHeight = -cam.y + HEIGHT + CULLPADDING

    if curHeight > self.nextCloudHeight then
        self:generateNextCloud()
    end
    self:cullClouds(-cam.y - CULLPADDING)
end

function CloudLevels:draw() -- Codea does not automatically call this method 
    for i,v in ipairs(self.clouds) do 
        v:draw() 
    end 
end

function CloudLevels:touched(touch) -- Codea does not automatically call this method
    
end

--# Cloud 
Cloud = class()

function Cloud:init() -- you can accept and set parameters here 
    self.shapes = {} 
    self.position = vec2(0,0)

    -- Generate random cloud
    numCircles = math.random(1, 10)
    spacing = 20

    for i = 1,numCircles do
        x = i * spacing - ((numCircles/2)*spacing)
        y = (math.random() - 0.5) * 30
        rad = math.random(spacing, 2*spacing)     
        table.insert(self.shapes, {x=x, y=y, r=rad})
    end
    
    self.width = numCircles * spacing + spacing
end

function Cloud:isColliding(pos) 
    startp = self.position.x - self.width/2 
    endp = self.position.x + self.width/2

    if pos.x < endp and pos.x > startp and
       pos.y < (self.position.y + 30) and
       pos.y > (self.position.y + 10) then
        return true
    end
    return false
end

function Cloud:draw() 
    pushStyle() 
    pushMatrix()
    translate(self.position.x, self.position.y)

    noStroke()
    ellipseMode(RADIUS)
    fill(255, 255, 255, 255)

    for i,s in ipairs(self.shapes) do
        ellipse(s.x, s.y - 5, s.r)
    end

    fill(221, 221, 218, 255)

    for i,s in ipairs(self.shapes) do
        ellipse(s.x, s.y + 5, s.r)
    end

    popMatrix()
    popStyle()
end

--# Super_sponge 
Girl = class()

function Girl:init() -- you can accept and set parameters here 
    self.position = vec2(0,0) 
    self.velocity = vec2(0,0) 
end

function Girl:jump(power) 

           sound(SOUND_JUMP)
    sound(DATA, "ZgJAQwBAJFE8dFZiGE9hv5j2Kj+6aI0/VQA5U0JyRyM/KEBC")
  sound(DATA, "ZgBAMxhIOUVPThVAP49GPdcp/T7I9gQ/VwAucS9FLUA4M0BY")
    sound(DATA, "ZgBASAA2SWE/QARCRDw3v/yitT4NRLw+QABIRmNBQEEZInFs")
    sound(DATA, "ZgBAQQA1USQHPnJHch1oP8oPPD9Un0M/QAA+f0BSRQdAY0t/")
    sound(DATA, "ZgJAJgBAQEBAQEBAAAAAAJqZmT7NzMw+QABAf0BAQEBAQEBA")
    local pow = power
    if difficulty == "medium" then pow = pow - 12 end
    if difficulty == "hard" then pow = pow - 14 end
    self.velocity = self.velocity + vec2(0,pow)
end

function Girl:computeVelocity()
    gravity = vec2(Gravity.x, math.min(Gravity.y,-1)):normalize() 
    gravity = gravity * 15
    friction = math.min(self.position.y, 1) 
    return self.velocity + gravity * friction 
end

function Girl:update() 
    self.position = self.position + self:computeVelocity()

    -- Clamp y position
    -- (so you don't go through ground)
    self.position.y = math.max(self.position.y,0)
    
    -- Clamp x position
    self.position.x = math.max(self.position.x,-WIDTH/2)
    self.position.x = math.min(self.position.x,WIDTH/2)
    
    -- Dampen velocity
    self.velocity = self.velocity * 0.98
end

function Girl:isFalling() 
   
     return self:computeVelocity().y < 0    

     
end

function Girl:draw()
    self:update()
    pushMatrix()
    translate(self.position.x, self.position.y)

sprite("Documents:sponge bob")
    
    popMatrix()
end

--# Main

function setup() 

sound(DATA, "ZgBAIABAP0QwNS8yMKZ4tzXQMz9QAFo+SwAye1drPyVQO0In")
sound(SOUND_PICKUP, 24494)
sound(DATA, "ZgBAMBFKNVktUVhAAnUjP8aBYT68X5E+WABScFU+WEBMYUBV")
sound(SOUND_RANDOM, 10380)
sound(SOUND_POWERUP, 1334)
sound(DATA, "ZgBAMQ9AO29PXH1GpajpvCXsuz5+Ho0+FwB8UEFRKj9Dclc8")
sound(DATA, "ZgBAIABAP0QwNS8yMKZ4tzXQMz9QAFo+SwAye1drPyVQO0In")

sound(SOUND_POWERUP, 1334)
sound(DATA, "ZgBAMQ9AO29PXH1GpajpvCXsuz5+Ho0+FwB8UEFRKj9Dclc8")
sound(SOUND_PICKUP, 24494)
sound(DATA, "ZgBAMBFKNVktUVhAAnUjP8aBYT68X5E+WABScFU+WEBMYUBV")
sound(SOUND_RANDOM, 10380)
supportedOrientations(LANDSCAPE_RIGHT)
      displayMode(FULLSCREEN)
    sprite("Documents:br",WIDTH/2,HEIGHT/2)
    clouds = CloudLevels()
    girl = Girl()
    girl.position = vec2(0, 0)
    gameState = "menu"
    difficulty = "easy"




-- This function gets called once every frame 
function draw() 
   if gameState == "menu" then
 
     supportedOrientations(LANDSCAPE_RIGHT)  
           background(245, 255, 0, 57)
 
      font("Zapfino")
      fontSize(40)
          fill(33, 70, 219, 255)

                   text("Main Menu", WIDTH/2, 600)

noStroke()
 ellipseMode(RADIUS)
fill(65, 141, 200, 61)

       fill(27, 229, 141, 255)

     rect(WIDTH /2 -103, 350,200,50)

    rect(WIDTH /2 -103, 250,200,50)

    rect(WIDTH -750 , 150,470,50)

    rect(WIDTH -750 , 75,470,50)
 
       font("SnellRoundhand-Black")


    fill(50, 75, 175, 255)
         fontSize(30)

      
     text(" play the game", WIDTH/2 , 380)
  
     text("credites", WIDTH/2 , 280 )


     text("contact the developer of the game" , WIDTH/2, 180 )

      text("contact mohammad (developer) ", WIDTH/2,100 )
 

             
 sprite("Documents:sandy",WIDTH-350,HEIGHT-300)


sprite("Documents:basset",WIDTH-800,HEIGHT-370)

sprite("Documents:basset",WIDTH-150,HEIGHT-600)

 sprite("Documents:mrs",WIDTH-800,HEIGHT-150)

sprite("Documents:loloa",WIDTH-850,HEIGHT-600)
   
 sprite("Documents:r",WIDTH-650,HEIGHT-250)

    sprite("Documents:r",WIDTH-950,HEIGHT-150)
 
   sprite("Documents:r",WIDTH-350,HEIGHT-430)
    
    sprite("Documents:r",WIDTH-100,HEIGHT-100)
   
     sprite("Documents:the vilige",WIDTH-150,HEIGHT-400)
   
     sprite("Documents:mrs",WIDTH-200,HEIGHT-150)
     
      elseif gameState == "playing" then
     
    
    
     supportedOrientations(ANY)
    
          background(0, 234, 255, 255) 

        -- Center the camera on the girl character 
        camPos = vec2(WIDTH/2, math.min(HEIGHT/2 - girl.position.y, 144)) 
        translate(camPos.x,camPos.y)
    




    -- Draw ground
        for i = 1,11 do
            sprite("Dropbox:jelly fish 2",-WIDTH/2 -70 + 101*i, -60 )
        end
        clouds:update(camPos)
        clouds:draw()
        girl:draw()
        if clouds:isColliding(girl.position) and girl:isFalling() then
                     girl:jump(math.random(1,89))
        

        end
    end
   

function touched(touch) 
    if gameState == "menu" then
    
    if touch.state == ENDED then
       
     if touch.y > 300 then
           
     difficulty = "easy"
        
        gameState = "playing"
       
     elseif touch.y > 200 then
           
     difficulty = "credites"
          
      gameState = "menu"
           
     openURL("http://m.youtube.com/#/watch?v=j2ovNrJmjPo&desktop_uri=%2Fwatch%3Fv%3Dj2ovNrJmjPo")
      
      elseif touch.y > 100 then
           
     difficulty = "contact the developer of the game"
       
         gameState = "menu"
       
       openURL("http://thedeveloperofthegame.webr.ly/")
         
       elseif touch.y > 80 then
         
       difficulty = "contact the photos designer"
        
        gameState = "

        openURL("https://twitter.com/mohd_abumoosa")
      
      end
    
    end
  
  elseif gameState == "playing" then
  
      if touch.tapCount == 1 and girl.position.y == 0 then 
       
     girl:jump(40)
            
                
        end 
    end
end
end
end

I would add a collide function somewhere, or use the collision engine from physics lab and have it so when it collides with a coin, the score = score + 1. To get a score function, just modify the score from Bit Invaders. Hope this helps!

Ok pleas can you edit my code and put for me a score

Also, I would change the art you use to be using the sprite packs or add an http.request to download the images fir the user, we dont have access to your documents

If you want to see how to add highscores, ill post a game i made a while back

You can change the sprite from lua girl

Ok i well see the game


--# Main
--# CloudLevels 
CloudLevels = class()

CULLPADDING = 300

function CloudLevels:init() -- you can accept and set parameters here 
    self.clouds = {} 
    self.nextCloudHeight = 200
end

function CloudLevels:generateNextCloud() 
    cloud = Cloud() 
    cloud.position = vec2(math.random(-WIDTH/2,WIDTH/2), self.nextCloudHeight)

    table.insert(self.clouds, cloud)

    self.nextCloudHeight = self.nextCloudHeight + math.random(92,330)
end

function CloudLevels:cullClouds(floor) 
    for i,v in ipairs(self.clouds) do 
        if v.position.y < floor then 
            table.remove(self.clouds,i) 
        end 
    end 
end

function CloudLevels:isColliding(pos) 
    for i,v in ipairs(self.clouds) do 
        if v:isColliding(pos) then 
            return true 
        end 
    end
    return false
end

function CloudLevels:update(cam) 
    curHeight = -cam.y + HEIGHT + CULLPADDING

    if curHeight > self.nextCloudHeight then
        self:generateNextCloud()
    end
    self:cullClouds(-cam.y - CULLPADDING)
end

function CloudLevels:draw() -- Codea does not automatically call this method 
    for i,v in ipairs(self.clouds) do 
        v:draw() 
    end 
end

function CloudLevels:touched(touch) -- Codea does not automatically call this method
    
end

--# Cloud 
Cloud = class()

function Cloud:init() -- you can accept and set parameters here 
    self.shapes = {} 
    self.position = vec2(0,0)

    -- Generate random cloud
    numCircles = math.random(1, 10)
    spacing = 20

    for i = 1,numCircles do
        x = i * spacing - ((numCircles/2)*spacing)
        y = (math.random() - 0.5) * 30
        rad = math.random(spacing, 2*spacing)     
        table.insert(self.shapes, {x=x, y=y, r=rad})
    end
    
    self.width = numCircles * spacing + spacing
end

function Cloud:isColliding(pos) 
    startp = self.position.x - self.width/2 
    endp = self.position.x + self.width/2

    if pos.x < endp and pos.x > startp and
       pos.y < (self.position.y + 30) and
       pos.y > (self.position.y + 10) then
        return true
    end
    return false
end

function Cloud:draw() 
    pushStyle() 
    pushMatrix()
    translate(self.position.x, self.position.y)

    noStroke()
    ellipseMode(RADIUS)
    fill(255, 255, 255, 255)

    for i,s in ipairs(self.shapes) do
        ellipse(s.x, s.y - 5, s.r)
    end

    fill(221, 221, 218, 255)

    for i,s in ipairs(self.shapes) do
        ellipse(s.x, s.y + 5, s.r)
    end

    popMatrix()
    popStyle()
end

--# Super_sponge 
Girl = class()

function Girl:init() -- you can accept and set parameters here 
    self.position = vec2(0,0) 
    self.velocity = vec2(0,0) 
end

function Girl:jump(power) 

           sound(SOUND_JUMP)
    sound(DATA, "ZgJAQwBAJFE8dFZiGE9hv5j2Kj+6aI0/VQA5U0JyRyM/KEBC")
  sound(DATA, "ZgBAMxhIOUVPThVAP49GPdcp/T7I9gQ/VwAucS9FLUA4M0BY")
    sound(DATA, "ZgBASAA2SWE/QARCRDw3v/yitT4NRLw+QABIRmNBQEEZInFs")
    sound(DATA, "ZgBAQQA1USQHPnJHch1oP8oPPD9Un0M/QAA+f0BSRQdAY0t/")
    sound(DATA, "ZgJAJgBAQEBAQEBAAAAAAJqZmT7NzMw+QABAf0BAQEBAQEBA")
    local pow = power
    if difficulty == "medium" then pow = pow - 12 end
    if difficulty == "hard" then pow = pow - 14 end
    self.velocity = self.velocity + vec2(0,pow)
end

function Girl:computeVelocity()
    gravity = vec2(Gravity.x, math.min(Gravity.y,-1)):normalize() 
    gravity = gravity * 15
    friction = math.min(self.position.y, 1) 
    return self.velocity + gravity * friction 
end

function Girl:update() 
    self.position = self.position + self:computeVelocity()

    -- Clamp y position
    -- (so you don't go through ground)
    self.position.y = math.max(self.position.y,0)
    
    -- Clamp x position
    self.position.x = math.max(self.position.x,-WIDTH/2)
    self.position.x = math.min(self.position.x,WIDTH/2)
    
    -- Dampen velocity
    self.velocity = self.velocity * 0.98
end

function Girl:isFalling() 
   
     return self:computeVelocity().y < 0    

     
end

function Girl:draw()
    self:update()
    pushMatrix()
    translate(self.position.x, self.position.y)

sprite("Planet Cute:Character Boy")
    
    popMatrix()
end

--# Main

function setup() 
version = 1.3


   saveProjectInfo("Description", "Codea version of super sponge")

   saveProjectInfo("developer", "mohammad abumoosa")

   saveProjectInfo("Version", version)

sound(DATA, "ZgBAIABAP0QwNS8yMKZ4tzXQMz9QAFo+SwAye1drPyVQO0In")

sound(SOUND_PICKUP, 24494)

sound(DATA, "ZgBAMBFKNVktUVhAAnUjP8aBYT68X5E+WABScFU+WEBMYUBV")

sound(SOUND_RANDOM, 10380)

sound(SOUND_POWERUP, 1334)

sound(DATA, "ZgBAMQ9AO29PXH1GpajpvCXsuz5+Ho0+FwB8UEFRKj9Dclc8")

sound(DATA, "ZgBAIABAP0QwNS8yMKZ4tzXQMz9QAFo+SwAye1drPyVQO0In")


sound(SOUND_POWERUP, 1334)

sound(DATA, "ZgBAMQ9AO29PXH1GpajpvCXsuz5+Ho0+FwB8UEFRKj9Dclc8")

sound(SOUND_PICKUP, 24494)

sound(DATA, "ZgBAMBFKNVktUVhAAnUjP8aBYT68X5E+WABScFU+WEBMYUBV")

sound(SOUND_RANDOM, 10380)
supportedOrientations(LANDSCAPE_RIGHT)
      displayMode(FULLSCREEN)
    sprite("Documents:br",WIDTH/2,HEIGHT/2)
    clouds = CloudLevels()
    girl = Girl()
    girl.position = vec2(0, 0)
    gameState = "menu"
    difficulty = "easy"




-- This function gets called once every frame 
function draw() 
   if gameState == "menu" then
 
     supportedOrientations(LANDSCAPE_RIGHT)  
           background(245, 255, 0, 57)
 
      font("Zapfino")
      fontSize(40)
          fill(33, 70, 219, 255)

                   text("Main Menu", WIDTH/2, 600)

noStroke()
 ellipseMode(RADIUS)
fill(65, 141, 200, 61)

       fill(27, 229, 141, 255)
     rect(WIDTH /2 -103, 350,200,50)
    rect(WIDTH /2 -103, 250,200,50)
    rect(WIDTH -750 , 150,470,50)
    rect(WIDTH -750 , 75,470,50)
        font("SnellRoundhand-Black")
    fill(50, 75, 175, 255)
         fontSize(30)

    
       text(" play the game", WIDTH/2 , 380)
 
      text("credites", WIDTH/2 , 280 )
  
   text("contact the developer of the game" , WIDTH/2, 180 )
    
  text("contact mohammad (developer) ", WIDTH/2,100 )
              
 sprite("Documents:sandy",WIDTH-350,HEIGHT-300)

sprite("Dropbox:basset",WIDTH-800,HEIGHT-370)

sprite("Documents:basset",WIDTH-150,HEIGHT-600)

sprite("Documents:mrs",WIDTH-800,HEIGHT-150)

sprite("Documents:loloa",WIDTH-850,HEIGHT-600)

    sprite("Documents:r",WIDTH-650,HEIGHT-250)

    sprite("Documents:r",WIDTH-950,HEIGHT-150)

    sprite("Documents:r",WIDTH-350,HEIGHT-430)

        sprite("Documents:r",WIDTH-100,HEIGHT-100)
  
      sprite("Documents:the vilige",WIDTH-150,HEIGHT-400)
    
    sprite("Documents:mrs",WIDTH-200,HEIGHT-150)
       

    elseif gameState == "playing" then
     

    
    
     supportedOrientations(ANY)
    
          background(0, 234, 255, 255) 

        -- Center the camera on the girl character 
        camPos = vec2(WIDTH/2, math.min(HEIGHT/2 - girl.position.y, 144)) 
        translate(camPos.x,camPos.y)
    




    -- Draw ground
        for i = 1,11 do
            sprite("Planet Cute:Grass Block",-WIDTH/2 -70 + 101*i, -60 )
        end
        clouds:update(camPos)
        clouds:draw()
        girl:draw()
        if clouds:isColliding(girl.position) and girl:isFalling() then
                     girl:jump(math.random(1,89))
        

        end
    end
   

function touched(touch) 
    if gameState == "menu" then
        if touch.state == ENDED then
            if touch.y > 300 then
                difficulty = "easy"
                gameState = "playing"
            elseif touch.y > 200 then
                difficulty = "credites"
                gameState = "menu"
                openURL("http://m.youtube.com/#/watch?v=j2ovNrJmjPo&desktop_uri=%2Fwatch%3Fv%3Dj2ovNrJmjPo")
            elseif touch.y > 100 then
                difficulty = "contact the developer of the game"
                gameState = "menu"
                openURL("http://thedeveloperofthegame.webr.ly/")
                elseif touch.y > 80 then
                difficulty = "contact the photos designer"
                gameState = "menu"
                openURL("https://twitter.com/mohd_abumoosa")
            end
        end
    elseif gameState == "playing" then
        if touch.tapCount == 1 and girl.position.y == 0 then 
            girl:jump(40)
         
        end 
    end


end
end
end

Does the document:sandy come into actual gameplay, or are they a scrapped idea?

This is the game i mentioned, look at the random object generator for the way to add the random spawning coins, while the paddle:collide for the collision.

--[[
--Tilt Island
--By: Austin W./CodeaNoob 
-- Major contributions by Dave1707
--Try this code and leave suggestions in the Comments
--Triple tap 3 fingers to bring up exit button
 
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN_NO_BUTTONS)
 
function setup()
    parameter.watch("Lives")
    Lives = 3
    GAME_PLAYING = 0
    GAME_DEAD = 1
    state = GAME_PAUSED
    objectTable = {}
    lastGenerated = ElapsedTime
    interval = .16
    num = 5  
    table.insert(objectTable,Objects(math.random(1,WIDTH-1),math.random(1,4),num))
    pColor = color(0, 0, 0, 255)
    paddle = Paddle(WIDTH/2,5,80,15,pColor)
    highscore = readLocalData("highscore")
 
    if not highscore then
        highscore = 0
    end
end
 
function draw()
    spriteMode(CENTER)
    sprite("SpaceCute:Background",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
    pushStyle()    
    fill(0, 0, 0, 255)
    textMode(CENTER)
    textAlign(CENTER)
    font("Copperplate-Light")
    fontSize(30)
    text("Tap Twice To Begin.", 500,250)
    text("Version: 3.1.2",500,750)
    text("Made By: CodeaNoob",500,730)
    fontSize(50)
    text("Tilt Island!", 500, 550)
    fontSize(40)
    text("Tilt the device to dodge the falling objects!", 500, 525)
    if state == GAME_PLAYING then
        spriteMode(CENTER)
        sprite("SpaceCute:Background",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
        pushStyle()
        randomObjectGenerate()   
        popStyle()       
        score = ElapsedTime 
        fill(255)
        font("Futura-CondensedExtraBold")
        fontSize(30)
        textMode(CORNER)
        score = ElapsedTime - start
        fill(255, 255, 255, 255)
        text("Score: "..string.format("%.1f",score),10,HEIGHT-50)
        text("Lives: "..Lives,10,690)
 
    end
 
    if state==GAME_OVER then
        fill(255)
        text(" Your Previous Score: "..string.format("%.1f",score),WIDTH/2,400)
        showHighScore()
        end
        drawPaddle()
  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 paddle:collide(v.a.x,v.a.y) and v.a.info.id > 0 then
            sound(SOUND_HIT, 46295)
            v.a.info.id=0
            Lives=Lives-1
            if Lives<1 then
                state=GAME_OVER
            end
        end
        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
 
function checkGrav()
    if pos.x >= 0 and pos.x <= WIDTH - size.x then
        if Gravity.x > 0 then
            pos.x = pos.x + (20 * Gravity.x)
        end  
        if Gravity.x < 0 then
            pos.x = pos.x - (-20 * Gravity.x)
        end    
    end 
    if pos.x < 0 then
        pos.x = 0
    end
    if pos.x > WIDTH - size.x then
        pos.x = WIDTH - size.x
    end
end
 
function drawPaddle()
    paddle:draw()
end
 
function touched(touch)
    if touch.tapCount == 2 and touch.state == ENDED then
        state = GAME_PLAYING
        if touch.tapCount == 2 and touch.state == ENDED then
            start = ElapsedTime
            Lives=3
 
        end
 
    end
 
end
 
--The Paddle Tab
 
Paddle = class()
 
function Paddle:init(posx,posy,pWidth,pHeight,pColor)
    self.pWidth = pWidth
    self.pHeight = pHeight
    self.posx = posx
    self.posy = posy
    pos = vec2(posx,posy)
    size = vec2(pWidth,pHeight)
    self.pColor = pColor
end
 
function Paddle:draw()
    checkGrav()
    fill(pColor)   
    rect(pos.x,pos.y,self.pWidth,self.pHeight)
end
 
 
function Paddle:collide(x,y)
    if x>pos.x and x<self.posy and y==0 and pos.x <= WIDTH - size.x then
        if Gravity.x > 0 then
            pos.x = pos.x + (20 * Gravity.x)
end
 
 
--This Function checks the Gravity
function checkGrav()
    if pos.x >= 0 and pos.x <= WIDTH - size.x then
        if Gravity.x > 0 then
            pos.x = pos.x + (20 * Gravity.x)
        end  
        if Gravity.x < 0 then
            pos.x = pos.x - (-20 * Gravity.x)
        end    
    end 
    if pos.x < 0 then
        pos.x = 0
    end
    if pos.x > WIDTH - size.x then
        pos.x = WIDTH - size.x
    end
end
 
--The Object Tab
Objects = class()
 
function Objects:init(x,cat,id)
    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(self.a.x, self.a.y)
    if self.category == 1 then
        sprite("Planet Cute:Rock",0,0,50,88)
    elseif self.category == 2 then
        sprite("Small World:Rock",0,0,50,51)
    elseif self.category == 3 then
        sprite("Planet Cute:Brown Block",0,0,50,80)
    elseif self.category == 4 then
        sprite("Planet Cute:Plain Block",0,0,50,85)         
    end
    popMatrix()
end  
 
function Objects:touched(touch)
end
 
 
 
-- find this if statement in the draw function.
 
 
 
 
 
-- add this function anywhere in your code
 
 
 
 
 
-- find this if statement in the draw function.
 
 
 
 
 
 
-- add this function anywhere in your code
 
function showHighScore()
    pushStyle()
    fill(255)
    fontSize(40)
    font("Courier")
    hs=score
    for x=1,10 do
        str=string.format("TiltIsland%02d",x)
        sc=readLocalData(str)
        if sc==nil then
            saveLocalData(str,0)
            if hs>0 then
                saveLocalData(str,hs)
                hs=0
            end
        elseif hs==tonumber(sc) then
                break
        elseif hs>tonumber(sc) then
                saveLocalData(str,hs)
                hs=tonumber(sc)
        end
    end    
    for x=1,10 do
        str=string.format("TiltIsland%02d",x)
        sc=readLocalData(str) 
        str=string.format("%2d) %5.1f",x,sc)
        text(str,WIDTH-150,434-x*40)
    end
    popStyle()
end
--]]

Ok thank you if you can edite my code plas edite it