[SOLVED] Tiled map generator problems

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: [SOLVED] Tiled map generator problems

Post by bartbes »

If memory serves, that is correct.
User avatar
furi
Citizen
Posts: 73
Joined: Sat Feb 26, 2011 8:15 pm

Re: [SOLVED] Tiled map generator problems

Post by furi »

Code: Select all

for yy=1,mapy do
	y=hmr(yy,strlen);
	for xx=1,mapx/strlen do
		g=grids[string.sub(string.gsub(mapg,"\n",""),xx+y*(mapx/strlen),xx+y*(mapx/strlen))+0]
		gen=gen..g[muldown(yy,strlen)];
	end
	gen=gen.."\n";
end
This is the ending result, which works perfectly for me. I redid grids as a table with tables in them for each y, ie

Code: Select all

grids={
{
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"},
{
"########",
"#......#",
"#......#",
"#......#",
"#......#",
"#......#",
"#......#",
"########"}
}
strlen is the lengthxheight of the predefined gridspaces. It gives me the freedom of making it any squared size I want. :cool:
Just wanted to post it, in case if anyone wanted to know.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests