how make to make level with one string ?

the idea (surely not original) was to use one letter that rapresent a object.

since there are just 4 type of object -> Player§, Wall(W), Key(K), Enemy(E)

the string level should be :


string_level = "
WWWWWWWWWWWWWWWWW
W...K......KK.EEW
W......W...W..EEW
W....WWW...WWW.WW
W.....WWW.WW...WW
W..P...W..W.....W
WWWWWWWWWWWWWWWWW"

how should be the code?

PS: the string should be “cubic” but is not

WOW! :smiley: was exactly this!
yes the ground is a exception , maybe a big plane can solve the problem
the mirror of the -y is not a problem

maybe the translation between letter and names is more clear if written inside a dictionary

this should work well for my pac-man project :smiley:

this was also my first attempt to make some level, when i see the amount incredible of objects i thinked to this solution :wink:

Tanks , very well done :wink:

It would be better to type the letters in a notepad file.Then have the blender game engine read them.
Then you could copy and paste the letters from any information you copied from the internet.

Interesting, I’m currently playing around with double-nested lists to make a 3D-2D map generator (like Terarria).

An array is the best way to store the info, but writing it out like this is a good way to edit levels quickly.

To avoid the empty floor problem:
You need to define a base tile; an empty square. Then go through and get any letter that isn’t either an empty square or a wall which will be an object or prop.
Put those things in a separate list with their co-ordinates.

Add the walls and floors (using the base tile where a prop is present), then go back and add all the other props such as player, enemy, keys and such at the right locations.