Results 1 to 18 of 18

Thread: Map Editor Using BitBlt

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Smile

    Im making an online game. Its coming along very well so far. But for later versions of the game I would like to be able to make more maps. I want to know how to make a map editor that uses BitBlt. All I need is two things, walkable areas and nonwalkable areas. Any help will be a big help.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Try to save the tile indexes in a 2D array. Then in the tiles you can store information like collidable and picture and stuff... like this:

    Code:
    'Types
    Type tTile
       Picture as Long
       Collidable as Boolean   
    End Type
    
    'Tiles
    Global TileCount as Long
    Gloabl Tile() as tTile
    
    'Map
    Global Map(100,100) as Long

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Red face

    Okay, so my map would be 100 * 100? And collidable objects are called collidable? If I wanted my map bigger then I could just replace the 100s? Thanks fox.

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Jup, or resize it at runtime:

    Code:
    dim Map() as tTile
    dim Width as Long
    dim Height as Long
    
    'Code
    Width = 300
    Height = 200
    Redim Map(Width, Height)

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Talking

    Cool Thanks Fox!

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you could use ubound(map,1) and ubound(map,2) and create a property height and width, but maybe it's a slower way to retrieve the vars, maybe Fox's right it's better to use as much vars as possible if you want performance.

    But Redim Preserve Map(Width, Height) won't erase all the data after rediming
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Talking

    Nope, you can't resize more than 1-dimensional arrays while holding the data

  8. #8
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Red face

    oh man, it's 5 0'clock am now.. I really should go sleepin'... c'ya!

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    youre up early then fox, or do you sleep online?

    yeah I forgot, you can just preserve the later argument
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I'm always online... and I was up till 5.00am

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Me too, but i went offline 4am and tested vb6, but it was german!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Im traveling right now so I can't try out the code yet When I get back later today I'll tell you how it went.

    Just want to make sure. So in my map, I would just have to call something collidable and then it will work? After I tell my program what to do when it sees something collidable of course.

  13. #13
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    In my tile array every tile can have several values, collidable for example. Of course you later have to check if the tile collides and if not don't move the player or whatever, I just showed you the structure...

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thats what I thought. But can I tell what side is colliding with something else? So if my guys hits a wall from the front I can tell? So i can stop him from going forward?

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    error...I put this in a module...and i get an error on this line...
    Gloabl Tile() as tTile

  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    It's a typo: Global

    You need to do a property for the movement, when you change the position, your property should check for walls in that direction and refuse to move if there is
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    What do you mean properties kedaman? How do I do this? Ambiguous Name Detected, "tTile". I get an error in a module and declarations of a form.

    (oh duh! I wasn't looking at the code when I copied it. Sorry)

  18. #18
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I'm not sure what youre doing so i can't suit it for your needs but i can give an example:
    Code:
    Private Type pos2d
        x As Integer
        y As Integer
    End Type
    
    Private Pguypos As pos2d
    Dim Velocity As pos2d
    
    Private Property Get guypos() As pos2d
        guypos = Pguypos
    End Property
    Private Property Let guypos(newval As pos2d)
        If Not map(newval.x, newval.y).Collidable Then
            Pguypos = newval
        End If
    End Property
    
    Sub moveguy()
        guypos = posadd(guypos, Velocity)
    End Sub
    
    Private Function posadd(arg1 As pos2d, arg2 As pos2d) As pos2d
        posadd.x = arg1.x + arg2.x
        posadd.y = arg1.y + arg2.y
    End Function
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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