PDA

Click to See Complete Forum and Search --> : charactors backcolor


May 17th, 2000, 04:04 AM
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

May 17th, 2000, 06:55 AM
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). ;)

May 17th, 2000, 08:44 PM
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...

May 18th, 2000, 03:38 AM
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]