Results 1 to 2 of 2

Thread: drawing a map with bitblt

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    Hi,
    If I understand what you wanted to do, just being able to blt what ever tile at a location. Such as a snow tile at (0,0) and a forest tile at (0,1)
    I would change the loops into for next loops, and then you don't need all the ifs to check what tiles you have. If you set up your maparray so that
    maparray(0,0) = 0 ' being a snow tile for instance
    maparray(0,1) = 1 ' forest then
    you could just do tileInfo(maparray(x, y)).Left instead of using ifs to check for things

    Code:
    Dim TILE_WIDTH As Integer, TILE_HEIGHT As Integer
    Dim Xspot As Integer, Yspot As Integer ' used to blt the tiles at certain locations
    TILE_WIDTH = 47 ' I'm guessing
    TILE_HEIGHT = 47
    Xspot = 0 ' starting spot for 1st tile
    For x = 0 To 9
      Yspot = 0
      For y = 0 To 6
        BitBlt frmGame.hDC, Xspot, Yspot, TILE_WIDTH, TILE_HEIGHT, frmGraphics.Picture1.hDC, tileInfo(maparray(x, y)).Left, tileInfo(maparray(x, y)).Top, SRCCOPY
        Yspot = Yspot + TILE_HEIGHT
      Next y
      Xspot = Xspot + TILE_WIDTH
    Next x
    I hope that helps, I would recomemend learning directdraw, I think its easier than bitblt, and you don't need to load all your pictures before hand

  2. #2
    vshammas
    Guest
    thanks for the help and time! will try it out now and post if i have more ?s... i will also try to learn more about directdraw and directx in general. just trying out the basics ( as you probably noticed from my extremely cluttered coding!).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width