Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: FrOzeN on January 03, 2006, 01:37 AM

Title: Layers
Post by: FrOzeN on January 03, 2006, 01:37 AM
I'm working on a simple game in VB6.

I know how to draw the terrain and stuff, though say as a character moves across it I want it to redraw the terrain below them. I fiqured having some form of layers would work nicely.

My idea would be to get a Image Control (for it's transparency) and then have it as a control array. Then as characters/objects get created it dynamically creates a new control which can have it's .Left/.Top properties used to move it around the specified area.

Would this be the most practical way of doing it in Visual Basic 6?
Title: Re: Layers
Post by: TehUser on January 03, 2006, 09:16 AM
Rather than using the controls, you may want to use the BitBlt (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_0fzo.asp) API.
Title: Re: Layers
Post by: Warrior on January 03, 2006, 09:36 AM
I'd use something like DirectDraw as well since it optimized for 2D, and if you want to obtain the 3D look in a 2D game I'd use isometric tiling for your map.
Title: Re: Layers
Post by: Ringo on January 03, 2006, 11:40 AM
Quote from: FrOzeN on January 03, 2006, 01:37 AM
I'm working on a simple game in VB6.

I know how to draw the terrain and stuff, though say as a character moves across it I want it to redraw the terrain below them. I fiqured having some form of layers would work nicely.

My idea would be to get a Image Control (for it's transparency) and then have it as a control array. Then as characters/objects get created it dynamically creates a new control which can have it's .Left/.Top properties used to move it around the specified area.

Would this be the most practical way of doing it in Visual Basic 6?
It would be better to learn about masking than it would to use the image controll :)
I'd use BitBlt (as stated by tehuser) to get the part of the background you want to draw it to, then BitBlt the transparent image to that, then BitBlt it back to the background.
You might also want to look into transparentBlt()

hope this helps