Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 4th, 2006, 9:58 AM   #1
Sungam
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 Sungam is on a distinguished road
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.
Sungam is offline   Reply With Quote
Old Jul 4th, 2006, 10:46 AM   #2
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 417
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
You should play around with a property which is called "TransperencyKey"
Wizard1988 is offline   Reply With Quote
Old Jul 5th, 2006, 11:30 AM   #3
Sungam
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 Sungam is on a distinguished road
TransperencyKey is not a property of a picture. What is it a property of?

Anybody else that can give more specific advise... please do.
Sungam is offline   Reply With Quote
Old Jul 5th, 2006, 11:39 AM   #4
Sungam
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 Sungam is on a distinguished road
TansperencyKey only pisses me off. In visual basic, it makes it see right through the form: I see the desktop behind it.
Sungam is offline   Reply With Quote
Old Jul 5th, 2006, 12:01 PM   #5
NSchnarr
Newbie
 
Join Date: May 2006
Posts: 28
Rep Power: 0 NSchnarr is on a distinguished road
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.
NSchnarr is offline   Reply With Quote
Old Jul 5th, 2006, 12:08 PM   #6
nemesis
Programmer
 
nemesis's Avatar
 
Join Date: Aug 2005
Location: Bristol, England
Posts: 71
Rep Power: 4 nemesis is on a distinguished road
Send a message via MSN to nemesis
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
nemesis is offline   Reply With Quote
Old Jul 8th, 2006, 10:56 AM   #7
Sungam
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 Sungam is on a distinguished road
the color "tranparent" does nothing. It just acts like white.
Sungam is offline   Reply With Quote
Old Jul 8th, 2006, 11:20 AM   #8
Sungam
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 Sungam is on a distinguished road
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 is offline   Reply With Quote
Old Jul 8th, 2006, 12:36 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC