Page 1 of 1

Isometric grid coordinate problem

Posted: Fri Apr 12, 2013 4:30 am
by travispaxton
I'm trying to debug a grid coordinate issue I'm having. Given the attached .love file, the 21x21 grid should be perfectly centered in the window with cell 0,0 in the cross hair. Cell 0,0 is in the cross hair, which is correct, but the entire grid seems to be shifted 1 down and 1 to the right. I can't for the life of me figure out why, thanks!

Re: Isometric grid coordinate problem

Posted: Fri Apr 12, 2013 5:07 am
by travispaxton
I think I may have found a resolution. Since the draw happens from the top left of the image, I think I need to offset the draw as such:

Code: Select all

	for x = -20, 20 do
		for y = -20, 20 do
			a, b = get_coord(x, y)
			gr.draw(grass, a - 16, b - 8)
		end
	end