Solved

Tile Map for RPG

Posted on 1998-04-11
4
646 Views
Last Modified: 2009-12-16

       
            I am working on an rpg. I would like to have a number of tiles that I can place
            in certain places to form the walkable world.  Is ther some way I can assign a name
            to each tile and set up a data table of some sort? I wold also like to make some that
            you can't walk through such as walls, but have some that you can such as grass. Is
            this posible, and how would I set it up?
 
0
Comment
Question by:HawkXL
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 90 total points
ID: 1461034
Ah yes, the old Adventure game.  I remember writing those things...

You need two things.
1. A global user defined type such as:
  Public Type tLocation
    Description As String  'Such as "You are in a garden"
    ExitNorth As Boolean   'True or false depending on wether they can move north
    ExitEast As Boolean     'Same as above
    ExitSouth As Boolean    'Ditto
    ExitWest As Boolean     'Ditto
    Contents As String ' Things in the room comma delimited "Sword, Map, Lamp"
    'Other things you might describe for each room
  End Type

2. You need an multidimension array for your "map"
  Global MapArea(100, 100) As tLocation
    'This gives you a single level 100 rooms wide by 100 rooms long.
    'If you want multi levels, try
  Global MapArea(10, 100, 100) As tLocation
    'This would be 10 levels by 100 rooms wide by 100 rooms long.

After this come the hard part.  Assigning values to each room during the application startup.  For example, the assignment for the room at the farthest north, farthest west, would look like this:
  MapArea(1, 1).ExitNorth = False 'You can't move north
  MapArea(1, 1).ExitEast = True   'You can move east
  MapArea(1, 1).ExitSouth = False 'Can't move south
  MapArea(1, 1).ExitWest = False  'Can't move west

You will need to duplicate this type of code for each room.  Unfortunately, VB doesn't have Read/Data statements which is what used to be used for this, however, VB does work well with databases so you can load your info from there.

It's a lot of work, but a lot of fun when you're done.  Good luck.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1461035
The above answer is enough to get you going.  If you would like, for you only (not for others that may view this answer).  I can send you a some demo code written in VB5 which will show you exactly what I'm talking about.

You will have to post your email address, though.
0
 
LVL 1

Author Comment

by:HawkXL
ID: 1461036
Thank you very much! You were a great help...  Do you have icq or mirc? If not please e-mail me with the samples...

 Thankx Again,
   Kent Kravitz
    -808 Games-
0
 
LVL 1

Author Comment

by:HawkXL
ID: 1461037
oh yeah... My address is K2_HI@hotmail.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now