Container (for something)

Hi guys, Title of this theme is vogue, but i will try to describe it. I have some container with some in game substance (in my case its air)

Then i press screen this container lose some piece of this substance

I thought about timers (tapping on the screen (in seconds) convert seconds then finger touches screen into gone substance) , but i don’t know how realize this. Maybe you can help me or give better solution.

P.s sorry for my english

for including image, check this http://codea.io/talk/discussion/1896/

@jvm38 thank you for tut about pics

@lupino8211 Not sure what your after, but is this something like what you want.


--# Main

function setup()   
    size=400
    id=0
    moving=false
end

function draw()
    background(40, 40, 50)
    stroke(255)
    strokeWidth(4)
    noFill()
    rect(WIDTH/2,HEIGHT/2,50,400)
    fill(255)
    rect(WIDTH/2+5,HEIGHT/2,40,size)
    if size>0 and not moving then
        size=size-.5
    end
    text("rub screen to raise level",WIDTH/2,HEIGHT-50)
end

function touched(t)
    if t.state==BEGAN and id==0 then
        id=t.id
    end
    if t.state==MOVING and t.id==id then
        moving=true
        if size<=400 then
            size=size+.2
        end
    end
    if t.state==ENDED and t.id==id then
        moving=false
        id=0
    end
end

@dave1707 thank you! That exactly what i want. Perfect as usual

The user and all related content has been deleted.