Results 1 to 5 of 5

Thread: Level, come here!!

  1. #1

    Thread Starter
    Member nXt's Avatar
    Join Date
    May 2001
    Location
    UK
    Posts
    37

    Level, come here!!

    Ok i am drawing maps using an array of images like so

    map(0,1) = 1

    so the tile 0,1 is picture 1

    is there a way i can declare a load of these in a module or text file and call them from a form. eg. instead of saying on form load draw map(0,1)= 2, map(0,2) =1 etc, could i just have draw.map1

    or something

  2. #2
    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
    You can load it from a text file. The text file would look like this:

    Code:
    wwwwwwww
    wwsssssw
    wsggtgsw
    wsgggsww
    wwssswww
    You don't need to use numbers, you can for example use "w" for water, "s" for sand, "g" for grass, "t" for a tree, etc

    Now, to load that into the map array, use this:

    VB Code:
    1. Dim X as Long, Y as Long, TempStr as String
    2.  
    3. Open App.Path & "\Map.txt" For Input As #1
    4.  
    5. For Y = 0 to 5
    6.     Line Input #1, TempStr
    7.     For X = 0 to 7
    8.         Map(X, Y) = Mid(TempStr, X+1, 1)
    9.     Next X
    10. Next Y
    11.  
    12. Close #1

    Now, if you use numbers instead of the letters I used, it will work just fine, but you'll be limited to tiles 0 to 9. All you have to do is make each tile in the map a fixed-lenght string (with a lenght of 1), and you can use all the characters you want
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  3. #3

    Thread Starter
    Member nXt's Avatar
    Join Date
    May 2001
    Location
    UK
    Posts
    37
    hmmm, but how does this code know where to look for the tile image?

  4. #4
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Same way the code I wrote you does.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  5. #5
    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
    If you don't have too many tiles, you can use a Select Case... of course the most efficient way would be a binary file, but for that you'd have to create a map editor
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

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