
-----------------------------------
isaiahk9
Thu Jan 08, 2009 3:38 pm

VB 6.0 - Translucent sprites
-----------------------------------
Hey, I'm making my game in VB 6.0, and I'm drawing my sprites like this :

Me.PaintPicture pctchar.Picture, cx, cy, pctchar.Width, pctchar.Height, 0, 0, pctchar.Width, pctchar.Height, vbSrcPaint
Me.PaintPicture pctcharMask.Picture, cx, cy, pctchar.Width, pctchar.Height, 0, 0, pctchar.Width, pctchar.Height, vbSrcAnd

The sprites are on a black background, the sprites do not contain black.  In the exact same shape of the sprites are the "mask sprites" in their shape, except with a white background and the sprites are all black.  So, the mask is drawn to attempt to get rid of the white pieces (supposed to be transparent when this is done) of the sprites.

Two problems :
A)  The sprite's white pieces (empty/supposed to be transparent) do not dissapear.
B)  The sprite's colors are instead replaced with a translucent color of whatever the sprite color is mixed with whatever behind it.  So, if sprite pixel (1, 1) is supposed to be blue, and it is on a yellow background, it will come out a bluey-yellow.  I want the sprites to appear normally.

This probably won't get solved, but if it does, thanx.

-----------------------------------
Brightguy
Sat Jan 10, 2009 7:54 am

Re: VB 6.0 - Translucent sprites
-----------------------------------
Is this in the Professional or Enterprise edition?  Hah, just kidding.

Well, you want to paint the mask on first, but your results suggest you've also mixed up the mask and the sprite.  Applying the mask should black out the sprite area but change nothing else.  And you can use black in your sprites unless you wanted to automatically create the masks, as I explained in [url=http://compsci.ca/v3/viewtopic.php?t=16359#147423]this old post.

-----------------------------------
isaiahk9
Sun Jan 11, 2009 12:21 pm

RE:VB 6.0 - Translucent sprites
-----------------------------------
Wow, thanx.  I say wow because I can't believe it's such a stupid mistake - I thought I'd checked that before.
thanx brightguy

-----------------------------------
isaiahk9
Wed Jan 14, 2009 10:02 pm

RE:VB 6.0 - Translucent sprites
-----------------------------------
Turned out not being the answer.  Scrapped the project because of this bug and many others (it's easier just to start from scratch).

-----------------------------------
syntax_error
Wed Jan 14, 2009 10:09 pm

RE:VB 6.0 - Translucent sprites
-----------------------------------
You know another easy thing: the edit button

-----------------------------------
isaiahk9
Thu Jan 15, 2009 9:37 pm

RE:VB 6.0 - Translucent sprites
-----------------------------------
No, I don't think you quite understand how terrible this code was :
1.  Sprites were translucent.
2.  Sprites had a white background
3.  The entire screen flashed
4.  Keys were unresponsive
5.  Character could not turn
6.  The main menu would not let you every return to the main screen
7.  Lag was unbearable
8.  Pictures would not scale

. . . and so on and so forth.  The new project I finished however works near perfectly and I am very satisfied with.

-----------------------------------
DanielG
Thu Jan 15, 2009 9:42 pm

RE:VB 6.0 - Translucent sprites
-----------------------------------
isaiahk9, I think syntax_error was reffering to your double posting earlier, not your code.

-----------------------------------
isaiahk9
Fri Jan 16, 2009 5:29 am

RE:VB 6.0 - Translucent sprites
-----------------------------------
Woops.  I'm so clueless.

-----------------------------------
Brightguy
Sat Jan 17, 2009 3:47 am

Re: VB 6.0 - Translucent sprites
-----------------------------------
Well... you can solve each problem in a controlled setting.

Understand what both steps do and make sure they work separately.  The mask isn't used to to get rid of the white pieces.

-----------------------------------
isaiahk9
Sat Jan 17, 2009 9:40 am

RE:VB 6.0 - Translucent sprites
-----------------------------------
I could've done that, but it would've been faster/easier/better to start over and rebuild from small pieces of this one.

-----------------------------------
Silent Avenger
Sun Jan 18, 2009 2:44 am

Re: VB 6.0 - Translucent sprites
-----------------------------------
The easiest way that I have found for making sprites with transparent backgrounds for games and such is to just put a transparent background in a .gif image and throw it into an image box. I've used this trick many times and it saves from debugging code to get the mask to work right. I don't know if this would be of use in your situation but hopefully it is and you can use it. Some programs you can use to make transparent gifs are photoshop, fireworks, or gimp.

-----------------------------------
isaiahk9
Sun Jan 18, 2009 10:04 am

RE:VB 6.0 - Translucent sprites
-----------------------------------
thanx for the future reference

-----------------------------------
Silent Avenger
Sun Jan 18, 2009 10:58 pm

Re: VB 6.0 - Translucent sprites
-----------------------------------
No problem, I find spending the time to put sprites into transparent gifs is way easier than messing around with masks.
