Advertisement
Guest User

Untitled

a guest
Jun 20th, 2010
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1.         $counterX = 0;
  2.         $counterY = 0;
  3.         $y = $this->startY;
  4.         $x = $this->startX;
  5.        
  6.         for($height = 0;$height <= $this->displayHeight;$height++) {
  7.        
  8.             if($counterY %2 == 0) {
  9.                 $displayWidth = $this->displayWidth;
  10.  
  11.             }else {
  12.                 $displayWidth = $this->displayWidth-1;
  13.                 $this->startY += 1;
  14.             }
  15.             for($width = 0;$width < $displayWidth;$width++) {
  16.                 if(empty($this->mapTiles[$x][$y][0])) {
  17.                     $tile = 'black';
  18.                 }else {
  19.                     $tile = $this->mapTiles[$x][$y][0];
  20.                 }
  21.                 //echo 'X: '.$x.'/Y: '.$y.'<br/>';
  22.                 $this->jsonMapTiles[]= $tile;
  23.                 $this->mapPositions[] = 'X'.$x.'Y'.$y;
  24.                 $y--;
  25.                 $x++;
  26.                 $counterX++;
  27.               // echo 'Start Y :'.$this->startY.' Counter Y:'.($counterY %2).' Display Width:'.$displayWidth.'<br/>';
  28.  
  29.             }
  30.            
  31.             $y = $this->startY;
  32.             $x = $this->startX+1;
  33.             if($counterX % ($this->displayWidth*2-1)  == 0) {
  34.                 $this->startX += 1;
  35.             }
  36.             $counterY++;
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement