Okay, well, you don't really need something other than a 1, but it makes it a lot easier. For example, you could use something like -1 instead of 1. A negative number could denote a starting point. Use the ABS function on the value to determine what the actual colour, sprite, etc. will be. If 1 represented a house for example, you could start from that house using -1.
DIM map(3, 6) AS INTEGER
DIM x AS INTEGER, y AS INTEGER
x = 0
y = 1
FOR x = 1 TO 6
READ map(y, x)
IF map(y, x) < 0 THEN EXIT DO
y = y + 1
LOOP WHILE y <= 3
PRINT USING "Starting point: (# #)"; x; y
The two alternatives to the above method that I had in mind were:
1. Add map coordinates after the end of the map to determine where the starting point is. You would READ the map data and after loading the map, you would READ two more numbers that sets where you start in your town.
2. Use a separate map with a single point for a starting point.
I like the method I detailed the most, but I also find alternative 1 to be a good idea as well. Alternative 2 could be a very poor idea. The general idea is that you have something like this:
Character Map (your starting point AND where townspeople start off):
Notice how the 1 in both maps match? That would work as your starting point. It's a good idea in some respects, but it could easily get confusing, right? It's all a matter of your preference.
I hope I gave you some ideas. I honestly haven't done much game development, but in terms of being able to edit the data so easily, it's a start, right? Then when your maps are more permanent, you might find a different way to store them such as a single value from 0 to 15 (or maybe -8 to 7 depending on what method you choose) in 4 bits. That way you could actually fit two different values in a single byte, which is 8 bits. That might even be something like compressing the example character map and the example town map above into a single byte. That's all binary and hexadecimal though. For now, I would just worry about getting the maps done in a way that you can understand. ^_^
Return to Index