Jump to content
  • Advertisement


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


VB code

This topic is 5858 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

Ok, I'm trying to make a RPG game under Visual Basic 6.0. I have graphics, but its just that when I need to walk or so, The Only way i know of is to do that with moving imageboxes... Is there an better way to do this, and make the person walk smoother and nicer >???? BIG THX! [edited by - xzazx on September 3, 2002 8:29:24 AM]

Share this post

Link to post
Share on other sites
You should really use a proper graphics API, like DirectDraw or the GDI. Look in the For Beginners and the Resources section, there''s tons of tutorials on it.

- JQ
Full Speed Games. Coming soon.

Share this post

Link to post
Share on other sites
You have a total of 3 image box / picture box (I use). The player image, instead of having it another imagebox moving you blit or paste the player image ontop of the map/background/picturebox. Then to make it smooth with no flickering you make 2 picture boxes. You put the map onto one of the picture boxes and then put the hero onto this picture box with blit API and then put this entire picturebox to the other picture box. This is called double buffering and it removes flickering etc.

You will have:

pbDoubleBuffer (picture box)
pbScreen (picture box)
pbPlayerSprite (picture box)

Here is the BitBlit API. Put this in a module.

Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long

And some sample code:

pbDoubleBuffer.picture = LoadPicture(App.path & "\map.bmp")
pbPlayerSprite = LoadPicture(App.path & "\player.bmp")

BitBlt (pbDoubleBuffer.hdc, 0, 0, Player_Sprite_Width, Player_Sprite_Height, pbPlayerSprite.hdc, 0, 0, vbSrcCopy)

BitBlt (pbScreen.hdc, 0, 0, pbDoubleBuffer.ScaleWidth, pbDoubleBuffer.ScaleHeight, pbDoubleBuffer.hdc, 0, 0, vbSrcCopy)

[edited by - Brandisco on September 3, 2002 8:44:39 AM]

Share this post

Link to post
Share on other sites
Matter of fact, I was going to suggest using VB''s BitBlt function. I just discovered it, and it does the job really well. I suggest you go the site below, which has a really good tutorial for animation using BitBlt and backbuffering. There are some other good tutorials there as well.

VB Explorer

Grant Palin

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!