Jump to content

Debugging Help (Movement Generator)


Q695

Recommended Posts

For some reason X, and Y are being rewritten (only option 1 is showing up but the other stuff is visible) when they're intrtnal to the function (subtracting 1).

<?php
function mapgen($x, $y){
global $con, $cx, $cy, $cz, $m_q, $m_w, $m_e, $m_a, $m_s, $m_d, $m_z, $m_x, $m_c;
$mx=$cx+$x;
$my=$cy+$y;

echo $x.",". $y;

$sql_m= "select * from map WHERE x=$mx AND y=$my AND z=$cz";
$result = mysql_query($sql_m, $con) or die ("can not generate result " . mysql_error());
$row_m = mysql_fetch_assoc($result);
//print_r($row_m);
//echo $mx . "," . $my;
if ($row_m)
{
echo "<img src='images/" . $row_m['img'] . "' alt='terain' height='20' width='20' />";

if ($x='-1' && $y='1')
{$m_q=1;}
else if($x='0' && $y='1')
{$m_w=1;}
else if($x='1' && $y='1')
{$m_e=1;}
else if($x='-1' && $y='0')
{$m_a=1;}
else if($x='0' && $y='0')
{$m_s=1;}
else if($x='1' && $y='0')
{$m_d=1;}
else if($x='-1' && $y='-1')
{$m_z=1;}
else if($x='0' && $y='-1')
{$m_x=1;}
else if($x='1' && $y='-1')
{$m_c=1;}
else
{
echo"error";
}

}
else
{
echo "<img src='images/clear.gif' height='20' width='20' alt='null'>";
}

}
?>

Edited by Q695
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.