Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

Sprites

This topic is 6582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The same way as you would make sprites for any other language pretty much...
Decide the color depth you want, and the sprite size you want, which will probably be a square that divides evenly into 640x480 for your convenience later on. Then go ahead and create the picture you want in bitmap format. You can use pretty much any editor capable of making bitmaps... I personally like Paintshop Pro 6, but most (and probably all, really) graphics programs will do bitmap format, including plain old MSPaint.

-fel

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I know that you are supposed to make a picture and then make a mask of it in seperate files, but the problem is how do I make the back ground colour that is the white part os the picture transparent in vb without using the win api, because whenever I use it, it never works, it just blits a black square.
thanx
CoolGuy

Share this post


Link to post
Share on other sites
*Relatively uncreative and non-constructive attempt to start a language-specific flame war deleted*

[This message has been edited by felisandria (edited December 02, 1999).]

Share this post


Link to post
Share on other sites
First off, Good God, do we have enough icons now!!

Second off, thanks Felsiandria for the intervention. I'm tired of all the language flame wars!

OK, to the business at hand. Could you post the relevent code so we can see what you're doing? Also, Have you considered using DirectX? Transparency isn't a problem with DirectDraw.

[This message has been edited by Machaira (edited December 02, 1999).]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok here goes, this is all the code that loads the arena onto the form and

'sets the file type
Extension = ".bmp"

'loads the picture of the arena
frmGame.Picture _ = LoadPicture_
("F:\Students\malonec_.__\" _
& ChosenArena & Extension)


imgPlayer1.Visible = False
imgPlayer2.Visible = False
'these two lines set the picture property of 'the two image boxes
imgPlayer1.Picture _
= LoadPicture _
("F:\students\malonec_.__\" & Player1_
& Extension)
imgPlayer2.Picture _
= LoadPicture _
("F:\students\malonec_.__\" & Player2 _
& Extension)
'These lines of code position the image 'boxes in the correct position for the arena 'they are playing in
imgPlayer1.Left = Player1_Arena_X
imgPlayer1.Top = Player1_Arena_Y
imgPlayer2.Top = Player2_Arena_X
imgPlayer2.Left = Player2_Arena_Y
'this line sets the image boxes to visible
imgPlayer1.Visible = True
imgPlayer2.Visible = True

Theirs the code. Everything works fine except for the fact that when I load the pictures of the player characters the white background behind them always shows through. I really don't want to have to resort to direct x though because my partners in computer class that are working on the game with me are having a hard enough time understanding the code as it is without adding in API's etc.
thanx
Cool_Guy


Share this post


Link to post
Share on other sites
Guest Anonymous Poster

When I took my high school VB class a few years ago, this was a very common problem that folks ran into for their game project.

I remember that I hunted around, but to no avail -- VB3 had no innate ability to handle transparencies. If you're using VB4+, I believe you can set pictureboxes to use transparency. Otherwise, you have no choice but to call Win32 API functions.

IIRC, You have to load the bitmap into a picturebox like you're doing. set the picture box to invisible. I used a picturearraybox to hold all my animation frames, but you could just as easily put the mask and the graphic in the same bitmap or in seperate ones, whatever works easiest for you.

first blit with your mask, I believe using an AND blit. So the white areas will retain their color, and the black areas will be where your sprite goes. then blit your bitmap with OR. This method is, like VB3 itself, very slow though. I was unable to blit more than a few sprites without some fair slowdown occuring. Also note that this is VERY different from what you're probably used to; the way you're doing it the picturebox itself holds its coordinates in the .left and .top variables; with win32 blits you must keep track of it yourself, probably in an array of ints.

As for the specifics of the blit code, I unfortunately can't post any. I still have all the source for that project, but its in VB3 form files (which are binary), and I no longer own VB. I think there was an example program that came with VB that I took my technique from though.

-- Remnant

Share this post


Link to post
Share on other sites