Isometric grid coordinate problem

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
travispaxton
Prole
Posts: 3
Joined: Wed Apr 10, 2013 2:01 pm

Isometric grid coordinate problem

Post 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!
Attachments
src2.love
(1.64 KiB) Downloaded 95 times
travispaxton
Prole
Posts: 3
Joined: Wed Apr 10, 2013 2:01 pm

Re: Isometric grid coordinate problem

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest