Results 1 to 40 of 44

Thread: [RESOLVED] [VB6] - DIB's - Tiles an image

Threaded View

  1. #39
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: [VB6] - DIB's - Tiles an image

    Well after looking at your code, I believe the if statement needs swapped just so it makes more sense:

    lngTilesX <= lntTileLimitX

    Also its better you use a For Loop rather than the Do Loop to draw out the tiles. They both practically execute the same speed. And I'm not so sure about this:

    lngTilesX = lngTilesX * 2

    Lets say you start the outwidth at 1, and your lntTileLimitX at 10. Since you are storing outwidth in lngTilesX, it now has 1. Then when you run the loop, this is whats happening to lngTilesX:

    1) 1
    2) 2
    3) 4
    4) 8
    5) 16
    6) 32
    7) 64
    8) 128
    9) 256
    10) 512

    It just doesn't make any sense because all its doing is going further and further and further away (is this what you are after?). What would make sense if you are making a tile engine is lngTilesX = lngTilesX + outwidth, assuming outwidth is the tile width. because then your values would be this, assuming the tile width is 15:

    1) 0
    2) 15
    3) 30
    4) 45
    5) 60
    6) 75
    7) 90
    8) 105
    9) 120
    10) 135

    And it would all be together. However there is a much better way of drawing tiles. I practically invented a way of doing it to where you can draw worlds as massive as you want with zero slowdown, similar to World of Warcraft or Grand Theft Auto sized worlds, only in 2D. If you need some code on how to do this, I'm more than willing to offer it to you.

    As for BitBlt, is the Double_Buffer from memory or is it a picturebox? If its a picturebox, set the AutoRedraw to True. And you made your destination of where its to be drawn is drawing in the Double_Buffer again. I don't think the source and destination should be the same DC.

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