Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
map help
#1
how do u make a map without having to put each indivis=dual pixel in.
Reply
#2
A common practise is creating a map using DATA statements, like this...
Code:
DATA 1,1,1,1,1
DATA 1,0,2,3,7
DATA 1,7,3,5,1
DATA 1,1,1,1,1
Then reading it into a multidimensional array, like this:
Code:
DIM map(1 to mapWidth,1 to mapHeight)
FOR y=1 to mapHeight
FOR x=1 to mapWidth
READ tileNum
map(x,y)=tileNum
NEXT x
NEXT y
In this case, the mapHeight=4 and the mapWidth=5, so replace mapHeight and mapWidth with 4 and 5, respectively.
So you see, the DATA values just stand for tiles...you "tokenize" the map. 1 might stand for a solid block, 2 for treasure, 3 for an enemy...and so on.
BTW if you don't understand this, read up on Multidimensional arrays and DATA statements.
Meh, this was probably really confusing to you...I'm bad at explaining stuff like this. :roll:
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)