I've been working on a map generator for an online game. I have almost everything worked out, except, when I increase the zoom on the image some of the lines aren't drawn. I have a feeling it has to do with my formula, but I might not be using imageline() right either.
My code:
if($cont)
{
$sx = $cx - $w/(2*$z);
$ex = $cx + $w/(2*$z);
for ($i = $sx; $i < $ex; $i++)
{
if($i % 100 == 0)
{
imageline($im, $i*$z-$sx, 0, $i*$z-$sx, $h-1,$black);
}
}
$sy = $cy - $h/(2*$z);
$ey = $cy + $h/(2*$z);
for ($i = $sy; $i < $ey; $i++)
{
if($i % 100 == 0)
{
imageline($im, 0,$i*$z-$sy, $w-1, $i*$z-$sy, $black);
}
}
}
$z is the zoom of the image and $i has no significance. $cx and $cy are the cords of the center of the map. Being that the map is 1000x1000, the default height and width of the image is 1000x1000.
I honestly don't see what I am doing wrong. Can I get any suggestions?