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.


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

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

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

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: