draw() doesnt blank canvas

Read some absolute beginner tutorials and fooled a little in codea. But after 2min catched a possible bug. See video. Streching the bg sprite into full-screen-size solves it.


http://youtu.be/mrkGG6_jCBs

function setup()
    centerx, centery = WIDTH/2, HEIGHT/2
    posx, posy = 0,0
    watch("posx")
    watch("posy")
end


function draw()
    --sprite("SpaceCute:Background") --bug?
    sprite("SpaceCute:Background", centerx,centery, WIDTH, HEIGHT)
    sprite("Planet Cute:Character Boy", posx,posy)
end

function touched(touch)
    posx, posy = touch.x, touch.y
end

I understand that it comes from the draw() function, which gets updates continuously, but should it not look different?

The draw loop doesn’t automatically “blank” the canvas between iterations. That’s what the background call does that you see in many of the example projects. This can be quite useful in some projects that draw on top of what’s already gone before (there’s a beautiful example of this called something like “flowing lines”).

understood. works. thank you Andrew :slight_smile: