![]() |
Using sprites.
In making video games, an image that takes up "This" many pixels is called a sprite; only the pixels that convey the image are shown, and the other pixels that are inside the rectangle are transparent. I cannot figure out how to make part of an image file transparent. I know there is a property called "transparency" but that makes the form show the contents of what is behind the form, such as the desktop or another window.
I know visual basic, and visual basic.net in particular, is not the best for making games, but it's all I know. I'm so close, I know how to do all the coding to make super Nintendo-like games, but I don't know how to get sprites to work. Any help, or any points in the right direction would be helpful. |
You should play around with a property which is called "TransperencyKey"
|
TransperencyKey is not a property of a picture. What is it a property of?
Anybody else that can give more specific advise... please do. |
TansperencyKey only pisses me off. In visual basic, it makes it see right through the form: I see the desktop behind it.
|
Its been a while but i seem to remember making everything in the picture i wanted transparent some weird color, then using some property making that color transparent everywhere on the form.
But like i said, its been 5 years or so. Hope that helps. |
:
|
the color "tranparent" does nothing. It just acts like white.
|
Figured it out:
dim b as bitmap("C:\foo.bmp") b.MakeTransparent(Color.White) Then use a barely off white color for white in the bitmap. However, the transparent part see's through to the background of the form, regardless of anything. And the animation is not smooth. VB.net is terrible for sprites. |
Sungam, it's not VB .NET that's terrible for sprites, but GDI when using forms. If you want to use sprites, either use DirectX or have a single-colour background.
Also, I'd recommend making the off-white colour 0xFEFEFE the transparent colour, so you can use pure white in your pictures. |
| All times are GMT -5. The time now is 8:03 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC