Im having trouble understanding how to make sprites with less than 100% opacity. Ive tried tint, stroke, fill etc but nothing have an impact on my sprites. Tint just makes the while screen tinted except the text. Any ideas?
function createFood()
setBackground()
setFontStyle("button")
bp = HEIGHT/(#food+1)
h = HEIGHT
for k, v in pairs(food) do
--print("title = "..v.title)
bw, bh = textSize(v.title)
print("bw = "..bw)
local iconWidth = WIDTH/2+bw/2+32
text(v.title, WIDTH/2, h-bp*k)
--sprite(v.picture, WIDTH/2, HEIGHT/2)
for kk, vv in pairs(v.required) do
sprite(vv.picture, iconWidth, h-bp*kk, 24, 24)
iconWidth = iconWidth + 40
--print("player = "..vv.player)
--print("item = "..vv.title)
end
end
end
I don’t see how your code snippet helps in any way. As Ignatz says, the fourth parameter is alpha.
Alpha starts at 255 for no transparency, and goes down to 0 for complete transparency.
Example:
-- Red Green Blue Alpha
tint( 255, 127, 127, 127 ) -- Tint sprites a color.
sprite("Cargo Bot:Codea Icon", WIDTH / 2, HEIGHT / 2) -- Draw the Codea icon at the middle of the screen, with full red, half green, and half blue. And with half alpha, so partially transparent.
noTint() -- Remove sprite tinting.
sprite("Cargo Bot:Codea Icon", WIDTH / 2, HEIGHT / 2) -- Draw the Codea icon at the middle of the screen, with full colors and full alpha, so no transparency,