Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

draw() doesnt blank canvas

edited January 2013 in Questions Posts: 505

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?

Tagged:

Comments

  • Posts: 2,161

    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").

  • Posts: 505

    understood. works. thank you Andrew :)

Sign In or Register to comment.