Jump to content

Recommended Posts

compass size=132X132

 

How do I make this compass work properly:

<?php
function d_button($dx, $dy){
?>
<form method="post">
<input type="hidden" name="dir_x" value="<?php echo $dx;?>">
<input type="hidden" name="dir_y" value="<?php echo $dy;?>">
<input type="image" height="44px" width="44px" onclick="submit();" src="images/invisible.gif">
</form>
<?php
}

function direction(){
?>
<table border="0" cellpadding="0" cellspacing="0" width="132px" height="132px" background="images/compas.gif">
<tr>
	<td><?php d_button(-1, 1);?></td>
	<td><?php d_button(0, 1);?></td>
	<td><?php d_button(1, 1);?></td>
</tr>
<tr>
	<td><?php d_button(-1, 0);?></td>
	<td width="44px"><td>
	<td><?php d_button(1, 0);?></td>
</tr>
<tr>
	<td><?php d_button(-1, -1);?></td>
	<td><?php d_button(0, -1);?></td>
	<td><?php d_button(1, -1);?></td>
</tr>
</table>

<?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/151287-solved-game-compas-spacing/
Share on other sites

Try:

<table border="0" cellpadding="0" cellspacing="0" width="132px" height="132px" background="images/compas.gif">
   <tr>
      <td width="33%" height="44px"><?php d_button(-1, 1);?></td>
      <td width="33%"><?php d_button(0, 1);?></td>
      <td width="33%"><?php d_button(1, 1);?></td>
   </tr>
   <tr>
      <td height="44px"><?php d_button(-1, 0);?></td>
      <td> </td>
      <td><?php d_button(1, 0);?></td>
   </tr>
   <tr>
      <td height="44px"><?php d_button(-1, -1);?></td>
      <td><?php d_button(0, -1);?></td>
      <td><?php d_button(1, -1);?></td>
   </tr>
</table>

or use css like:

<table border="0" cellpadding="0" cellspacing="0" class="compas">
   <tr>
      <td><?php d_button(-1, 1);?></td>
      <td><?php d_button(0, 1);?></td>
      <td><?php d_button(1, 1);?></td>
   </tr>
   <tr>
      <td><?php d_button(-1, 0);?></td>
      <td> </td>
      <td><?php d_button(1, 0);?></td>
   </tr>
   <tr>
      <td><?php d_button(-1, -1);?></td>
      <td><?php d_button(0, -1);?></td>
      <td><?php d_button(1, -1);?></td>
   </tr>
</table>

and add this within the head tags (<head></head>):

<style>
table.compas {
background:url(images/compas.gif);
}
table.compas td {
width:44px;
height:44px;
text-align:center;
vertical-align:middle;
}
</style>

 

The css version will likely be more stable and its easier to maintain if you know css.

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.