Results 1 to 13 of 13

Thread: Maps

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Location
    Portland, OR
    Posts
    16

    Question

    I want to make a simple 2D game engine. All I want it to do is load in a map, convert the character at each place in the map, 1 character with 36 differnt characters possable, into a tile, and have a picture of a player that can be moved around the map but only on some of the tiles. Some tiles may be land while others are water. I also want the map to be larger than one screen. Exmaple: Screen: 50 tiles by 50 tiles Map: 100 tiles by 100 tiles.

    How can i do this? And Fox, I have already asked this(name: *Super Sniper*) so please don't give me the link to your download or to that old thread.

  2. #2
    Guest
    For storage purposes, you can load your Map in a 2D-Array. It will save a lot of time.

    Code:
    Dim Map(100, 100) As Byte
    Before you move your Character, check the direction he is going in. If it's a wall (1 on the Map, for example) then don't move him.

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    In my game the map() array points to a set of tiles, where the tile defines if you can move there or not. That's also a ways, but if you're new to game programming it maybe hard to understand..?

  4. #4
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Okay, I've heard everyone talk about making maps in 2D arrays and stuff, but can someone actually show how to do this? Like to I assign a value to each point to say which picture goes where? So if 55,55 = 1 then its grass, but if it = 2 then its water?

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Yep. Like I said, you have ie. a tile array which really holds the graphics. Like this:

    Code:
    Type TILE
       LONG DC;
       BOOL Collides;
    End type
    
    TILE Tiles(100);
    
    Type MAP
       LONG Tile;
    End type
    
    MAP Map(10, 10);
    So the MAP(x,y) just points to an index in the Tiles() array.

  6. #6
    New Member
    Join Date
    Jul 2000
    Location
    Hermosillo, Sonora, Mexico
    Posts
    2

    Exclamation Maybe this can Help You

    Hi, I'm making a game where I use Maps of 500 x 500 where I only use 9 pieces for each screen like this:


    ooooo
    oxxxo
    oxxxo
    oxxxo
    ooooo


    I load In memory only 25 pieces and I rotating it, depending of where he (the player) moves. I made an Array like this:

    Code:
    Dim World (1 to 500, 1 to 500) as Byte
    
    then I read a Text File and I load it to my Array:
    Open ...... as #1
    For I = 1 to 500
      For J = 1 to 500
    ....
      Input #1, Piece
      World (I,J)=  val(Piece)
    ...
    ...
    Piece can be Numbers from 1 to 255 then you can have the pieces loaded in a Sprite and get it from there.

    I hope you find this usefull. (sorry my english)

    [Edited by Lepe on 07-18-2000 at 01:34 PM]
    -------------Have Problems?--------
    Dim Problems
    Select Case Problems
    Case Many: 'More than 1
    Do Until Problems = Null
    Problems = challenge
    On error Resume Next
    DoEvents
    Loop
    Case Only One:
    Problems = Not Problems
    Case None:
    Do Nothing
    End Select
    Msgbox "No Probems"
    --------------------------
    A.Lepe

  7. #7
    Guest
    If you declare many Array's that require 1 as the starting point, you can shorten your code by using Option Base 1. Eg:

    Code:
    Option Base 1
    Public World(100, 100) As Byte
    Public Weapons(10) As Byte
    Public Items(50) As Byte
    This saves you from typing (1 To number).[/i]

  8. #8
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hey, Fox... that thing you said that might be a bit too complex... I'm interested

    Is it like instead of detecting tiles, detecting pixels (like a round obstacle)? That's what I wanted... so every square of terrain would have a "mask" so the game knew what parts of the tile must be considered obstacles!

    Bye,

    -Jotaf98

    [email protected] - ICQ#60784495 - http://jotaf98.cjb.net

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Location
    Portland, OR
    Posts
    16

    Question Tileset?

    Well, I think I understand how to do it. Now, does anyone fell up to making me a tileset? For now I just need 10 tiles and 1 Character.

  10. #10
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hum, it depends -- what do you mean by "tileset"? For me, a tileset is a set of terrain images used in a game (ice, jungle...) -- so the tiles used vary depending on the tileset (so you won't need too many bytes to define a tile in a map). So if what you need is temporary images, I can get ya some

    Bye,

    -Jotaf98

    [email protected] - ICQ#60784495 - http://jotaf98.cjb.net

  11. #11
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Fox? ...That looks a little bit like C/C++ mixed with VB and Java. Or is it? Correct me if i'm wrong, but I don't think that'll run in VB....
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  12. #12
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Indeed It's C++ and VB mixed. I didnt want to write [DC as Long] and so on, takes too much time

    Sorry about that, but that was not really code, only the idea how it works

  13. #13
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229

    Talking How the Array Should Be Done

    The array I have found to be the best is

    MAP(0 to 50,0 to 50,0 to 1) AS INTEGER

    The First Part "0 to 50" is the X

    The Second Part "0 to 50" is the Y

    The Third Part "1" is the Walkable Check
    The Third Part "0" is the TILECHECK

    Then when the map is loaded make it check the
    tile, if it is a block tile then it sets the 3RD
    value1 to 1, or 0 if walkable. This may help
    a little since it saves everything into an ARRAY.

    So an example would be
    TILE = map(10,10,0)

    BLOCK = MAP(10,10,1)

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