Jump to content

Trouble when applying alpha on context:SetColor()


DooMAGE
 Share

Recommended Posts

Hello friends,

 

I have a crosshair script that works well, I just followed the example in the FPSPlayer.lua

 

function Script:Start()
self.crosshairImg = Texture:Load("Materials/HUD/dot_1.tex")
end
function Script:PostRender(context)
if self.crosshairImg then
 local crossHairX = math.floor((context:GetWidth() - self.crosshairImg:GetWidth()))/2
 local crossHairY = math.floor((context:GetHeight() - self.crosshairImg:GetHeight()))/2
 context:SetBlendMode(Blend.Alpha)
 context:DrawImage(self.crosshairImg, crossHairX, crossHairY)
end
end

 

But when I try to fade in/out a text on another script with:

 

context:SetColor(0,0,0,Math:Lerp(0, 1, self.alpha/self.fadeTime))

 

The texture in the crosshair gets the same color of my text and also fades :P

 

What I'm doing wrong?

My Leadwerks games!

https://ragingmages.itch.io/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...