Hi! So i’m trying to make a sprite with simple tween animation…my code:
function setup()
box = {x=100,y=100}
dotween()
end
function draw()
sprite("Cargo Bot:Command Grab", box.x,box.y)
end
function dotween()
td=tween(2,box,{x=300,y=300})
tween.sequence(td)
end
The problem is it leaves a trail behind the sprite… What am I doing wrong wrong?
So that’s what background does!
- I’ve wondered how to enclose code, but could not find it…it should be a sticky or in the sidebar since it’s so common a mistake…
Re code: http://www.twolivesleft.com/Codea/Talk/discussion/275/faq-please-read
You can think of background
as a flood fill. It’s also quite useful in setContext
to blank the image to a given colour. The advantage of background
over a large rect
is that background(0,0,0,0)
(note the alpha) sets every pixel to transparent black, where as the corresponding rect
call does nothing due to the alpha.
(One could simulate background
using rect
with the right blendMode
, though.)