Why isn't this working?

I’m working on a kind of Fall Down type game and I’ve created 2 randomly generating blocks, the problem is, while the first block finishes moving, the second one doesn’t repeat its movement. It stops moving and stops printing “restarted” upon finishing. Here’s the code: (I’m aware it’s ugly and inefficient, I’m a beginner and made the whole thing in ~3 hours)

[lua]

–code for movement of first tile

–repeat movement when movement has completed

function completeMove()

    transition.to( floorTile, { time=5, x=math.random( 30, 300 ), y=display.contentHeight / 1, onComplete=moveTile} )

    print(“move completed”)

end

–the actually movement of the first tile

function moveTile()

    if score <=150 then

        if floorTile.isMoving == true then

            transition.to( floorTile, {time=1500, y=0, onComplete=completeMove } )            

            print(“moving”)

        elseif floorTile.isMoving == false then

            transition.to( floorTile, { display.remove(floorTile) } )

        end

    end

end

–code for second tile’s movement

–code for repeat

function completeT()

    transition.to( floorTile2, { time=5, x=math.random( 30, 300 ), y=display.contentHeight / 1, onComplete=moveT } )

    print(“restarted”)

end

–the movement of the second tile

function moveT()

    if score <= 150 then

        if floorTile.isMoving == true then

            transition.to( floorTile2, {time=1500, y=0, onComplete=completeT } )    

            print(“2 is moving”)

        elseif floorTile.isMoving == false then

            transition.to( floorTile2, { display.remove(floorTile) } )

        end

    end

end

[/lua]

In couple of places you are calling a function in onComplete that is defined later in the code.  For example: onComplete=moveTile in line 4

So put at the top of the file a reference to those functions so that they will be in scope. In line 1 put: local moveTile, completeMove, moveT

In couple of places you are calling a function in onComplete that is defined later in the code.  For example: onComplete=moveTile in line 4

So put at the top of the file a reference to those functions so that they will be in scope. In line 1 put: local moveTile, completeMove, moveT