Solved

Tile Map for RPG

Posted on 1998-04-11
645 Views

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
Question by:HawkXL
• 2
• 2

LVL 6

Accepted Solution

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

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.

0

LVL 1

Author Comment

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

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

Featured Post

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…