I want the sprite image to fade in/fade out over a background - i’m sure it’s obvious but i cant find how to do it…
More specific - i want to fade from one sprite to a second sprite in the same location, starting at 100% sprite a 0% sprite b and ending with 0% sprite a and 100% sprite b
--# Main
-- test alpha
-- Use this function to perform your initial setup
function setup()
data = {alpha = 255}
next = 0
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
fontSize(50)
text("touch me",WIDTH/2,HEIGHT/8)
scale(4)
tint(255,255,255,data.alpha)
sprite("Planet Cute:Character Boy",WIDTH/8,HEIGHT/8)
tint(255,255,255,255-data.alpha)
sprite("Planet Cute:Character Princess Girl",WIDTH/8,HEIGHT/8)
end
function touched(touch)
if touch.state == BEGAN then
tween(1,data,{alpha = next})
next = 255-next
end
end