Click to See Complete Forum and Search --> : charactors backcolor
hello,
im making a game and the question is about the charactors graphic. how do i make the background of the charactor transparent? i can change the backdrop to make the charactors background, but if i pass a different color it looks bad. any ideas?
-thanks
-t_dawolf
Create your sprite with a black background. Use BitBlt to copy the image and for the OpCode, put SRCPAINT so it wont copy the black, therefor, leaving you with a transparent background.
Fox
May 17th, 2000, 10:53 AM
Indeed. (First vbSrcPaint then vbSrcAnd)
You can also download some example projects from my homepage (http://foxmccloud.tsx.org). ;)
hey,
thanks for the help, could i get some help with that though?
i mean some code? i got the guy as an image and his name is "trum". so any help with code would be greatly appreciated.
-thanks
-t_dawolf
Fox
May 17th, 2000, 10:50 PM
Like I said, look on my website. You'll find a very easy and well-commented BitBlt example there...
Put the following code in a module.
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Put the following code into a CommandButton. Make sure that the ScaleMode for everything is set to Pixels.
Private Sub Command1_Click()
'Copy the Mask
RetVal = BitBlt(Form1.hDC, 0, 0, 32, 32, picMask.hDC, 0, 0, SRCPAINT)
'Copy the sprite
RetVal = BitBlt(Form1.hDC, 0, 0, 32, 32, picSprite.hDC, 0, 0, SRCAND)
End Sub
This should work.
[Edited by Megatron on 05-18-2000 at 04:39 PM]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.