0

Would someone please help me learn how to create a 2d map using python with arrays or something ?
I have been trying to find out for days and haven't found anything.

I found this on the internet...

self.map = (
"::::::XXXXXXXXXXXXXX",
"::::::..::::XX::::::",
"::Z:+:XX::::..::M:::",
"::::::XXX.XXXX::::::",
"XXX.XXXXX.XXXXXX.XXX",
"XXX.XXX/:::::XXX....",
"XXX.XXX::&:::XXX.XXX",
"XXX....::::M:XXX.XXX",
"XXX.XXX:::>::X&::::X",
"XXX.XXX@:::::X:::::X",
"XXX.XXXXXX.XXX::Z::X",
"XXX.XXXXXX.XXX:::::X",
"X::R:::XX:::XXXX.XXX",
"X:::::&XX:M:.....XXX",
"XX.XXXXXX:::XXXX.XXX",
"XX.XXXXXX.XXXXXX.XXX",
"X:::::::::::::M::::X",
".::/:M:/:::B:::::::.",
"X::::::::::::::::::X",
"XXXXXXXXXXXXXXXXXXXX",
)

Looks good to me but I DON'T KNOW HOW TO HAVE MY PROGRAM READ IT AND PLACE 2D TILES IN THE SPACES OF EACH SYMBOL :(

Please help!

Oh yeah, I am using python with PYGAME libraries

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by woooee
0

Not sure what you are asking but try this and see if it helps any. You have to test each individual character and replace the ones that match your criteria.

for line in self.map:                      ## one line at a time
     spaces=""                             ## move each character over one space
     for character in line:                ## print each character in each line
          print spaces, character
          spaces += " "
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.