Astirian
Astirian

Reputation: 73

In Marmalade Quick SDK (Lua), why is my sprite flashing at 0,0 before moving to the right co-ords?

In my endless runner game, I'm trying to remove an obstacle when it leaves the screen, then create a new one at a set of co-ords off to the right hand side of the screen. It works for the most part. The problem is, when I add a new obstacle, it momentarily flashes into existence at 0,0 (i.e. the bottom left of the scene...). Halp!

function updateObstacle()

    if (obstacle) then                        
        if(obstacle.x < -100) then

            (obstacle):removeFromParent()
            obstacle = nil
        end
    end

    if (obstacle) then
        (obstacle):translate(blockSpeed * -1, 0)
    end
end

function newObstacle()
        if (gameState == gameStates.gameStarted) then
        if not (obstacle) then
            createObstacle()
        end
    end
end

Upvotes: 0

Views: 32

Answers (1)

Nas Banov
Nas Banov

Reputation: 29020

I ran into the same problem last year. Seems to be a bug, for details see https://answers.madewithmarmalade.com/questions/34144/

Upvotes: 0

Related Questions