Mar 12th, 2003, 09:05 PM
#1
Thread Starter
Addicted Member
Masking Problem (RESOLVED)
um what is wrong with my masking code here?
Code:
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
it just shows gray around the guy instead of cutting out the white.
Last edited by jeb2022; Mar 15th, 2003 at 01:10 PM .
Mar 12th, 2003, 09:24 PM
#2
Frenzied Member
nothing's wrong with the code so show us the pics too!
Mar 12th, 2003, 09:35 PM
#3
Thread Starter
Addicted Member
what you mean the actual pictures?, did i color them right?
Attached Images
Mar 12th, 2003, 09:46 PM
#4
Frenzied Member
hmmm....nothing wrong there either...
did you put the one with the white bg color as mask?
Mar 12th, 2003, 09:48 PM
#5
Thread Starter
Addicted Member
yup, the one with the white border is the mask. do i need a backbuffer?
Mar 12th, 2003, 09:49 PM
#6
Frenzied Member
it works perfectly fine for me....can you please attach the program?
this is the only code i used for it:
VB Code:
Option Explicit
Private 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
Private Sub Picture1_Click()
BitBlt Picture1.hDC, 0, 0, 50, 50, imgmanmask.hDC, 0, 0, vbSrcAnd
BitBlt Picture1.hDC, 0, 0, 50, 50, imgman.hDC, 0, 0, vbSrcPaint
Picture1.Refresh
End Sub
Mar 12th, 2003, 09:59 PM
#7
Thread Starter
Addicted Member
this is part of a game so im sure you might have to get rid of some code cause it loads things but here is the form and module that it uses
Last edited by jeb2022; Mar 13th, 2003 at 04:02 PM .
Mar 12th, 2003, 10:02 PM
#8
Good Ol' Platypus
Well there is a white "halo" around the guy, and it will only work if the pixel on the sprite is BLACK (with and/paint).
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
(Just a heads-up)
Mar 12th, 2003, 10:10 PM
#9
Thread Starter
Addicted Member
well could I use something besides and/paint so that I don't have to go in a paint over that 'halo'
Mar 12th, 2003, 10:11 PM
#10
Frenzied Member
sorry, i cant get the program to work....you didnt attach the frx file in the zip and theres probably some other errors inte the code too...
Mar 12th, 2003, 10:24 PM
#11
Thread Starter
Addicted Member
ya i know there are problems and i forgot the add the module with the map on it, ive got to leave for now but thx for the help
Mar 13th, 2003, 05:07 PM
#12
Thread Starter
Addicted Member
my program doesnt appear to be BitBlting the guy over the tiles. Well I can see the guy but the border around it is the color of the picturebox, ive tried changing the color of the picturebox and the border around the gyu changes with it. What do I need to do to fix this
Mar 14th, 2003, 11:21 AM
#13
Hyperactive Member
Can you attach your program so we can see what's going on?
[vbcode]
' comment
Rem remark
[/vbcode]
Mar 14th, 2003, 03:32 PM
#14
Thread Starter
Addicted Member
I wish I could but its too big with the tiles.
here is the code under the keydown
Code:
Select Case KeyCode
Case vbKeyUp ' This makes it so you move up when you press the up key
look_at = Mid(Map(Char_Y + 1 - 1), Char_X + 1, 1)
If look_at = "A" Or look_at = "B" Or look_at = "E" Or look_at = "1" Or look_at = "2" Or look_at = "3" Or look_at = "4" Or look_at = "5" Or look_at = "6" Or look_at = "7" Or look_at = "8" Or look_at = "9" Or look_at = "0" Or look_at = "!" Or look_at = "@" Or _
look_at = "V" Or look_at = "X" Or look_at = "T" Or look_at = "s" Or look_at = "t" Or look_at = "f" Or look_at = "k" Or look_at = "r" Or look_at = "u" Then
Char_Y = Char_Y - 1
Char_Face = 2
Draw_Position 'Calls a sub
Draw_Character
Startup.Caption = "Y = " & Char_Y & " X = " & Char_X
End If
end select
some of the code for painting tiles
Code:
Sub Draw_Position()
'Draws character on board along with board
Dim pass As Byte
For Y = -3 To 10 Step 1 'top to bottom
For X = -3 To 12 Step 1 'left to right
pass = 0
If pass = 0 Then look_at = Mid(Map(Y + Char_Y + 1), (X + Char_X + 1), 1)
If X = 0 And Y = 0 Then GoTo Skip:
Select Case look_at
Case Is = "A" 'Short Grass
BitBlt Picture1.hDC, (X + 3) * 48, (Y + 3) * 48, 48, 48, imgtiles.hDC, 308, 257, vbSrcCopy
end select
end sub
last is the code for paintin the guy(this is whats messed up)
Code:
Private Sub Draw_Character()
Select Case Char_Face
Case Is = 1
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 53, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 53, 104, vbSrcPaint
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 104, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 104, 104, vbSrcPaint
Sleep (150)
end select
end sub
i hope this helps
Mar 14th, 2003, 09:06 PM
#15
Frenzied Member
you should set all pics scalemode to 3 (pixels) and autoredraw to true...
then after blitting you should refresh so the new stuff gets visible..
Mar 14th, 2003, 09:11 PM
#16
Thread Starter
Addicted Member
ya ive had that too, it still doesnt want to work.
Mar 14th, 2003, 09:24 PM
#17
Thread Starter
Addicted Member
im gonna post it on one of my sites, so just give me a minute then ill put the link here.
Mar 14th, 2003, 09:24 PM
#18
Frenzied Member
have you changed this:
VB Code:
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 53, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 53, 104, vbSrcPaint
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 104, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 104, 104, vbSrcPaint
Sleep (150)
to this:
VB Code:
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
Picture1.Refresh
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 53, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 53, 104, vbSrcPaint
Picture1.Refresh
Sleep (150)
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 104, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 104, 104, vbSrcPaint
Picture1.Refresh
Sleep (150)
?
Mar 14th, 2003, 09:39 PM
#19
Thread Starter
Addicted Member
well here is where the project is http://www.geocities.com/jeb2022/NewFolder.zip
ya i put picture1.refresh under the keydown code after the draw subs, i also tried it in the draw sub it still didn't work
Mar 14th, 2003, 10:59 PM
#20
Frenzied Member
lol!
If X = 0 And Y = 0 Then GoTo Skip:
this code is in the loop that draws the bg.....it skips the tile behind the character.....remove that one!
Mar 14th, 2003, 11:04 PM
#21
Frenzied Member
after that loop...add: Picture1.Picture = Picture1.Image to get the bg stay even if cls-ing between the animation frames of the character...
then change all these:
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
Sleep (150)
to:
Picture1.Cls
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgmanmask.hDC, 2, 104, vbSrcAnd
BitBlt Picture1.hDC, 3 * 48, 3 * 48, 48, 48, imgman.hDC, 2, 104, vbSrcPaint
Picture1.Refresh
Sleep (150)
that'll fix some problems...
Mar 15th, 2003, 02:08 AM
#22
Mar 15th, 2003, 02:23 AM
#23
Frenzied Member
improved the gfx a bit and fixed a few bugs:
Attached Files
Mar 15th, 2003, 01:09 PM
#24
Thread Starter
Addicted Member
THANK YOU SOOOOOOO MUCH
gawd this thing has been a major pain
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width