I am working on Connect 4, and I ran into a strange error. If you change the size of the grid, the size of the pieces change to allow it to still fit snug. I have that down and working. But when I try to position these, I keep running into errors. I came up with a formula to find a scaled size, and now I try to make it so it positions it next to the old one by multiplying by using a for loop value -1. So, it looks like this.
Code: Select all
for i=1, 8 do
for h=1, 8 do
local piece=board[i][h]
if piece~=0 then
love.graphics.drawq(piece, size, 600*(1/selected*2)*(h-1), 600*(1/selected*2)*(i-1), 0, 1/selected*2, i/selected*2, 0, 0)
end
end
end
In theory, this should work. When I tried it, nothing appeared on the screen. This is obviously not a table error, because when I used this code,
Code: Select all
for i=1, 8 do
for h=1, 8 do
local piece=board[i][h]
if piece~=0 then
love.graphics.drawq(piece, size, 0, 0, 0, 1/selected*2, 1/selected*2, 0, 0) --Note to self, add positioning equation
end
end
end
it showed the image. Why won't this work? Oh, and yes, I do comment myself notes to self.
Here's a .love to play with.