![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2005
Posts: 15
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Professional Programmer
|
You should play around with a property which is called "TransperencyKey"
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Dec 2005
Posts: 15
Rep Power: 0
![]() |
TransperencyKey is not a property of a picture. What is it a property of?
Anybody else that can give more specific advise... please do. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Dec 2005
Posts: 15
Rep Power: 0
![]() |
TansperencyKey only pisses me off. In visual basic, it makes it see right through the form: I see the desktop behind it.
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2006
Posts: 28
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#6 |
|
Programmer
|
Dim b as new Bitmap("C:\Foo.bmp")
b.setPixel(X,Y,Color.Transparent)
//Then you can use b to draw on whatever.
__________________
Bite My Shiny Metal Ass |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Dec 2005
Posts: 15
Rep Power: 0
![]() |
the color "tranparent" does nothing. It just acts like white.
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Dec 2005
Posts: 15
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|