Results 1 to 4 of 4

Thread: Control Arrays

  1. #1
    Guest

    Post

    I'm making a map editor using VB. In text format, the map is a bunch of 0's and 1's.

    111111111
    100000001
    100111001 It looks something like this
    100000001
    111111111

    When you open the file it finds out the where
    the 1's are and it loads an image from a
    control array using this code:

    Code:
    Load imgBlock(1)
    imgBlock(1). Move 0,0
    Load imgBlock(2)
    imgBlock(2). Move 0, 480
    and so on until I cover every grid on the map. My question is...This of way coding it is going to take fovever!! Is there a simpler
    ay of doing this??



    [This message has been edited by Megatron (edited 01-03-2000).]

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    I don't see the relationship between the 0's and 1's that you show and your coder sample. can you explain further?

    ------------------
    Marty

  3. #3
    Guest

    Post

    The 0's and 1's are just telling you how the map is made. It's a 14x16 grid and you write it in a text editor. When you are done, you use the game to open the level and the game will translate the text into a map. Where there is a 0 in text format, there is a blank spot on the game. Where there is a 1 in text format, there is an image of a block on the game. I would have to use the code (shown below) at least 100 times to scan the .txt
    file and create an image or a blank spot on
    the game.

    Code:
    Load imgBlock(1)
    imgBlock(1). Move 0,0
    Load imgBlock(2)
    imgBlock(2). Move 0, 480
    My question is: Instead of writing that
    code 100 times, is there an easier time-saving way of doing it?




    [This message has been edited by Megatron (edited 01-03-2000).]

  4. #4
    Member
    Join Date
    Jan 1999
    Location
    Gig Harbor, WA, USA
    Posts
    48

    Post

    Use a loop.

    For i = 1 to 100

    Load imgBlock(i)
    imgBlock(i).Move 0, i * 480
    Next i


    ------------------
    (`..`->ShadowCrawler<-`..)
    Teenage Programmer
    Visual Basic, HTML, C++, JavaScript

    http://welcome.to/X12Tech
    Email: craigkovatch@compuserve.com
    ICQ#: 9872708

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