Example #1
0
        public void redrawTile(MapTile tile)
        {
            int left, top;

            left = tile.getX();
            top = tile.getY();

            Console.SetCursorPosition(left + _dx , top + _dy);
            Console.ForegroundColor = tile.getTileColor();
            Console.Write(tile.visual);
        }
Example #2
0
 public void draw(Object character)
 {
     if (!character.isSeen())
     {   
         //if tile is seen but object not draw tile
         floorTile = _tiles[character.getX() - _dx, character.getY() - _dy];
         if (floorTile.isSeen())
         {
             redrawTile(floorTile);
             Game.GC.Buffer.WriteToBuffer(character.getX(), character.getY(), floorTile.MapTileToCChar());
         }
         return;
     }
     //get tile under character
     int left = character.getOldLeft();
     int top = character.getOldTop();
     floorTile = _tiles[left - _dx, top - _dy];
     //draw previous tile if nothing is there
     if (floorTile._objects.Count == 0 && floorTile.isSeen())
     {   
         Console.ForegroundColor = floorTile.getTileColor();
         Console.SetCursorPosition(left, top);
         Console.Write(_tiles[left - _dx, top - _dy].visual);
         //Game.GC.Buffer.WriteToBuffer(left, top, _tiles[left - _dx, top - _dy].visual);
         Game.GC.Buffer.WriteToBuffer(left, top, floorTile.MapTileToCChar());
     }
     //draw character if has been seen and it's on tile that has been seen
     left = character.getX();
     top = character.getY();
     int oleft = character.getOldLeft();
     int otop = character.getOldTop();
     floorTile = _tiles[left - _dx, top - _dy];
     if (floorTile.isSeen())
     {
         //if (left != oleft || top != otop)
         //{
             CChar c = new CChar();
             character.showObject();
             c.c = character.getVisual();
             c.fc = character.getColor();
             //Game.GC.Buffer.WriteToBuffer(left, top, character.getVisual());
             Game.GC.Buffer.WriteToBuffer(left, top, c);
         //}
     }
     //set cursor under character
     Console.SetCursorPosition(character.getX(), character.getY());
 }