Results 1 to 6 of 6

Thread: charactors backcolor

  1. #1
    Guest

    Question

    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

  2. #2
    Guest
    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.

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Indeed. (First vbSrcPaint then vbSrcAnd)


    You can also download some example projects from my homepage.

  4. #4
    Guest

    Unhappy

    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

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Like I said, look on my website. You'll find a very easy and well-commented BitBlt example there...

  6. #6
    Guest
    Put the following code in a module.

    Code:
    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.

    Code:
    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width