Advertisement
CaptainLepidus

Villages

Apr 2nd, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. $xs=0;
  2. $ys=0;
  3. for(i=0;i<50;i=i+1)
  4. for(j=0;j<50;j=j+1)
  5. {
  6. $tile[i,j]=0;
  7. }
  8. $sql="SELECT * FROM villages WHERE x>=$xs and y>=$ys and x<$xs+50 and y<$ys+50";
  9. $result=mysql_query($sql);
  10. while($row=mysql_fetch_array($result))
  11. {
  12. $tile[$row["x"]-$xs,$row["y"]-$ys]=$row["id"];
  13. }
  14. echo "<table>";
  15. for(i=0;i<50;i=i+1)
  16. {
  17. echo "<tr>";
  18. for(j=0;j<50;j=j+1)
  19. {
  20. if ($tile[i,j]==0)
  21. {
  22. echo "<td>grass.png</td>";
  23. }
  24. else
  25. {
  26. echo "<td>village.png</td>";
  27. }
  28. }
  29. echo "</tr>";
  30. }
  31. echo "</table>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement