Exemplo n.º 1
0
        public void setWall(int x, int y)
        {
            if (x >= 0 && x < width && y >= 0 && y < height)
            {
                tiles[x, y].canWalk     = false;
                tiles[x, y].transparent = false;
                tiles[x, y].tileID      = "wall";

                map.setProperties(x, y, false, false);
            }
        }
Exemplo n.º 2
0
        public void CreateFoVMap()
        {
            for (var row = 0; row < Rows; ++row)
            {
                for (var col = 0; col < Columns; ++col)
                {
                    var cell = this[row, col];
                    _fovMap.setProperties(col, row, cell.IsTransparent(), cell.IsWalkable());
                }
            }

            MapUpdated(_fovMap);
        }
Exemplo n.º 3
0
        public static int Main(string[] args)
        {
            TCODConsole.initRoot(100, 75, "my game", false);
            TCODMap map = new TCODMap(100, 75); // first, create a new map.  look under fov toolkit for more on this
            for (int x = 0; x < 100; x++)
            { // time to fill in our map details
                for (int y = 0; y < 75; y++)
                {
                    map.setProperties(x, y, true, true);
                    // i'm setting the entire map to walkable.  here is where you need to set the walkable status, based on the map generated
                }
            }
            TCODPath path = new TCODPath(map, 1.0f);
            // here we create the path object, using our map.  the diagonal movement cost here is set to 1.0f
            int creatureX = 25; // TCODRandom.getInstance().getInt(0, 99); // let's start our creature at a random point
            int creatureY = 25; //TCODRandom.getInstance().getInt(0, 74);
            int destinationX = 75; //TCODRandom.getInstance().getInt(0, 99); // and let's give our beast a random destination
            int destinationY = 50; // TCODRandom.getInstance().getInt(0, 74);
            path.compute(creatureX, creatureY, destinationX, destinationY); // now we compute the path
            while (!path.isEmpty())
            { // a little while loop that ends when the destination is reached

                TCODConsole.root.putCharEx(creatureX, creatureY, '@', TCODColor.white, TCODColor.black);
                TCODConsole.flush();
                // here is where we draw the creature on the screen.  we won't be overwriting anything, so he'll leave a trail
                path.walk(ref creatureX, ref creatureY, true);
                // here we walk the path.  by setting the last arg to true, we'll automatically recompute the path if the path is blocked
                TCODConsole.waitForKeypress(true);
                // a little something so that you can watch the movement in a action.  just click any key to move
            }

            return 0;
        }
Exemplo n.º 4
0
        public void BuildFOV(TCODMap viewmap, int xpos, int ypos)
        {
            float Distance;
            Point currentLoc = new Point(0, 0);
            Point playerLoc  = new Point(xpos, ypos);
            float intensity  = 0.0f;

            viewmap.clear(false, false);
            for (int x = 0; x < 300; x++)
            {
                for (int y = 0; y < 200; y++)
                {
                    viewmap.setProperties(x, y, this.Cells[x, y].Walkable, this.Cells[x, y].Walkable);
                }
            }
            viewmap.computeFov(xpos, ypos, 9, true, TCODFOVTypes.ShadowFov);

            for (int x = 0; x < 300; x++)
            {
                for (int y = 0; y < 200; y++)
                {
                    if (this.Cells[x, y].Visible == Visiblity.Visible)
                    {
                        this.Cells[x, y].Visible = Visiblity.Previously;
                    }
                    if (viewmap.isInFov(x, y))
                    {
                        this.Cells[x, y].Visible = Visiblity.Visible;
                    }
                    this.Cells[x, y].LightIntensity = 0.0f;
                }
            }

            for (int x = 0; x < 300; x++)
            {
                for (int y = 0; y < 200; y++)
                {
                    if (this.Cells[x, y].Visible == Visiblity.Visible)
                    {
                        currentLoc.Set(x, y);
                        Distance  = (float)currentLoc.Dist(playerLoc);
                        intensity = 0.5f - Distance / 12;
                        if (intensity < 0.0f)
                        {
                            intensity = 0.0f;
                        }
                        this.Cells[x, y].LightIntensity = intensity;
                    }

                    if (this.Cells[x, y].Visible == Visiblity.Visible)
                    {
                        this.Cells[x, y].Visible = Visiblity.Previously;
                    }
                    if (viewmap.isInFov(x, y))
                    {
                        this.Cells[x, y].Visible = Visiblity.Visible;
                    }
                }
            }
        }
Exemplo n.º 5
0
 private void generateTCODMap()
 {
     for (int y = 0; y < tcodMap.getHeight(); y++)
     {
         for (int x = 0; x < tcodMap.getWidth(); x++)
         {
             if (terrain[x, y] == 0)
             {
                 tcodMap.setProperties(x, y, true, true);
             }
             else
             {
                 tcodMap.setProperties(x, y, false, false);
             }
         }
     }
 }
Exemplo n.º 6
0
        public void OnPartialUpdate(int x, int y, bool walkable, bool visible)
        {
            _currentMap.setProperties(x, y, visible, walkable);

            if (_currentPath == null)
            {
                return;
            }

            _currentPath.Dispose();
            _currentPath = new TCODPath(_currentMap, 1.14f);
            ComputePath(_currentX, _currentY, _destX, _destY);
        }
Exemplo n.º 7
0
        public LightSource(Point Position, int Radius, TCODColor Colour, float Intensity, Map mapData)
        {
            float Distance;
            Point currentLoc       = new Point(0, 0);
            float workingIntensity = 0.0f;

            position  = new Point(Position);
            radius    = Radius;
            colour    = new TCODColor();
            colour    = Colour;
            intensity = Intensity;
            int mapSize = 1 + (Radius * 2);

            lightMap = new TCODMap(300, 200);
            lightMap.clear(false, false);

            //for (int dx = Position.X - Radius; dx <= Position.X + Radius; dx++)
            for (int dx = 0; dx < 300; dx++)
            {
                //for (int dy = Position.Y - Radius; dy <= Position.Y + Radius; dy++)
                for (int dy = 0; dy < 200; dy++)
                {
                    lightMap.setProperties(dx, dy, mapData.Cells[dx, dy].Walkable, mapData.Cells[dx, dy].Walkable);
                }
            }
            lightMap.computeFov(Position.X, Position.Y, Radius, true, TCODFOVTypes.ShadowFov);

            //for (int dx = Position.X - Radius; dx < Position.X + Radius; dx++)
            for (int dx = 0; dx < 300; dx++)
            {
                //for (int dy = Position.Y - Radius; dy <= Position.Y + Radius; dy++)
                for (int dy = 0; dy < 200; dy++)
                {
                    if (lightMap.isInFov(dx, dy))
                    {
                        currentLoc.Set(dx, dy);
                        Distance         = (float)currentLoc.Dist(Position);
                        workingIntensity = Intensity - Distance / 12;
                        if (workingIntensity < 0.0f)
                        {
                            workingIntensity = 0.0f;
                        }
                        mapData.Cells[dx, dy].AmbientLight       = workingIntensity;
                        mapData.Cells[dx, dy].AmbientLightColour = TCODColor.Interpolate(TCODColor.black, Colour, workingIntensity);
                    }
                }
            }
        }
Exemplo n.º 8
0
 public void load(Level level)
 {
     map   = new TCODMap(width, height);
     tiles = new Tile[width, height];
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             tiles[x, y].transparent = _transparent[tileIndex(x, y)];
             tiles[x, y].canWalk     = _canWalk[tileIndex(x, y)];
             tiles[x, y].explored    = _explored[tileIndex(x, y)];
             tiles[x, y].tileID      = _tileID[tileIndex(x, y)];
             map.setProperties(x, y, tiles[x, y].transparent, tiles[x, y].canWalk);
         }
     }
     this.level = level;
 }
Exemplo n.º 9
0
Arquivo: Area.cs Projeto: rezich/zday
        public void LoadFromFile(string file)
        {
            Point pos = new Point(0, 0);

            Width = 0;
            using (StreamReader r = new StreamReader(file)) {
                string line;
                while ((line = r.ReadLine()) != null)
                {
                    foreach (char c in line.ToCharArray().ToList <char>())
                    {
                        switch (c)
                        {
                        case '#':
                            Terrain.Add(new Terrain(pos, TerrainType.Wall));
                            break;

                        case '.':
                            Terrain.Add(new Terrain(pos, TerrainType.Floor));
                            break;
                        }
                        Width = Math.Max(Width, pos.X);
                        pos.X++;
                    }
                    pos.X = 0;
                    pos.Y++;
                }
            }
            Width++;
            Height = pos.Y;
            Map    = new TCODMap(Width, Height);
            foreach (Terrain t in Terrain)
            {
                Map.setProperties(t.Position.X, t.Position.Y, t.Transparent, !t.Solid);
            }
        }
Exemplo n.º 10
0
 public void SetCellProperties(int x, int y, bool isTransparent, bool isWalkable)
 {
     TCODMap.setProperties(x, y, isTransparent, isWalkable);
 }
Exemplo n.º 11
0
 public void LoadFromFile(string file)
 {
     Point pos = new Point(0, 0);
     Width = 0;
     using (StreamReader r = new StreamReader(file)) {
         string line;
         while ((line = r.ReadLine()) != null) {
             foreach (char c in line.ToCharArray().ToList<char>()) {
                 switch (c) {
                     case '#':
                         Terrain.Add(new Terrain(pos, TerrainType.Wall));
                         break;
                     case '.':
                         Terrain.Add(new Terrain(pos, TerrainType.Floor));
                         break;
                 }
                 Width = Math.Max(Width, pos.X);
                 pos.X++;
             }
             pos.X = 0;
             pos.Y++;
         }
     }
     Width++;
     Height = pos.Y;
     Map = new TCODMap(Width, Height);
     foreach (Terrain t in Terrain) {
         Map.setProperties(t.Position.X, t.Position.Y, t.Transparent, !t.Solid);
     }
 }
Exemplo n.º 12
0
        void render_fov(bool first, TCODKey key)
        {
            if (map == null)
            {
                // initialize the map for the fov toolkit
                map = new TCODMap(SAMPLE_SCREEN_WIDTH, SAMPLE_SCREEN_HEIGHT);
                for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                {
                    for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                    {
                        if (smap[y][x] == ' ')
                            map.setProperties(x, y, true, true);// ground
                        else if (smap[y][x] == '=')
                            map.setProperties(x, y, true, false); // window
                    }
                }
                // 1d noise used for the torch flickering
                map_noise = new TCODNoise(1);
            }

            if (first)
            {
                TCODSystem.setFps(30); // fps limited to 30
                // we draw the foreground only the first time.
                // during the player movement, only the @ is redrawn.
                // the rest impacts only the background color
                // draw the help text & player @
                sampleConsole.clear();
                sampleConsole.setForegroundColor(TCODColor.white);
                string prompt = "IJKL : move around\nT : torch fx " + (torch ? "off" : "on ") + " : light walls " + (light_walls ? "off" : "on ") + "\n+-: algo " + algo_names[(int)algonum];
                sampleConsole.print(1, 1, prompt);
                sampleConsole.setForegroundColor(TCODColor.black);
                sampleConsole.putChar(px, py, '@');
                // draw windows
                for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                {
                    for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                    {
                        if (smap[y][x] == '=')
                        {
                            sampleConsole.putChar(x, y, '=');
                        }
                    }
                }
            }

            if (recomputeFov)
            {
                // calculate the field of view from the player position
                recomputeFov = false;
                map.computeFov(px, py, torch ? (int)TORCH_RADIUS : 0, light_walls, algonum);
            }
            // torch position & intensity variation
            float dx = 0.0f, dy = 0.0f, di = 0.0f;
            if (torch)
            {
                // slightly change the perlin noise parameter
                torchx += 0.2f;
                // randomize the light position between -1.5 and 1.5
                float[] tdx = { torchx + 20.0f };
                dx = map_noise.getPerlinNoise(tdx) * 1.5f;
                tdx[0] += 30.0f;
                dy = map_noise.getPerlinNoise(tdx) * 1.5f;
                // randomize the light intensity between -0.2 and 0.2
                float[] torchxArray = { torchx };
                di = 0.2f * map_noise.getPerlinNoise(torchxArray);
            }

            // draw the dungeon
            for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
            {
                for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                {
                    bool visible = map.isInFov(x, y);
                    bool wall = (smap[y][x] == '#');
                    if (!visible)
                    {
                        sampleConsole.setCharBackground(x, y, (wall ? darkWall : darkGround), TCODBackgroundFlag.Set);
                    }
                    else
                    {
                        if (!torch)
                        {
                            sampleConsole.setCharBackground(x, y, wall ? lightWall : lightGround, TCODBackgroundFlag.Set);
                        }
                        else
                        {
                            // torch flickering fx
                            TCODColor baseColor = wall ? darkWall : darkGround;
                            TCODColor light = wall ? lightWall : lightGround;
                            // cell distance to torch (squared)
                            float r = (float)((x - px + dx) * (x - px + dx) + (y - py + dy) * (y - py + dy));
                            if (r < SQUARED_TORCH_RADIUS)
                            {
                                // l = 1.0 at player position, 0.0 at a radius of 10 cells
                                float l = (SQUARED_TORCH_RADIUS - r) / SQUARED_TORCH_RADIUS + di;
                                // clamp between 0 and 1
                                if (l < 0.0f)
                                    l = 0.0f;
                                else if (l > 1.0f)
                                    l = 1.0f;
                                // interpolate the color
                                baseColor = new TCODColor((byte)(baseColor.Red + (light.Red - baseColor.Red) * l),
                                                    (byte)(baseColor.Green + (light.Green - baseColor.Green) * l),
                                                    (byte)(baseColor.Blue + (light.Blue - baseColor.Blue) * l));
                            }
                            sampleConsole.setCharBackground(x, y, baseColor, TCODBackgroundFlag.Set);
                        }
                    }
                }
            }

            if (key.Character == 'I' || key.Character == 'i')
            {
                // player move north
                if (smap[py - 1][px] == ' ')
                {
                    sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                    py--;
                    sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                    recomputeFov = true;
                }
            }
            else if (key.Character == 'K' || key.Character == 'k')
            {
                // player move south
                if (smap[py + 1][px] == ' ')
                {
                    sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                    py++;
                    sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                    recomputeFov = true;
                }
            }
            else if (key.Character == 'J' || key.Character == 'j')
            {
                // player move west
                if (smap[py][px - 1] == ' ')
                {
                    sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                    px--;
                    sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                    recomputeFov = true;
                }
            }
            else if (key.Character == 'L' || key.Character == 'l')
            {
                // player move east
                if (smap[py][px + 1] == ' ')
                {
                    sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                    px++;
                    sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                    recomputeFov = true;
                }
            }
            else if (key.Character == 'T' || key.Character == 't')
            {
                // enable/disable the torch fx
                torch = !torch;
                sampleConsole.setForegroundColor(TCODColor.white);
                string prompt = "IJKL : move around\nT : torch fx " + (torch ? "off" : "on ") + " : light walls " + (light_walls ? "off" : "on ") + "\n+-: algo " + algo_names[(int)algonum];
                sampleConsole.print(1, 1, prompt);
                sampleConsole.setForegroundColor(TCODColor.black);
            }
            else if (key.Character == 'W' || key.Character == 'W')
            {
                light_walls = !light_walls;
                sampleConsole.setForegroundColor(TCODColor.white);
                string prompt = "IJKL : move around\nT : torch fx " + (torch ? "off" : "on ") + " : light walls " + (light_walls ? "off" : "on ") + "\n+-: algo " + algo_names[(int)algonum];
                sampleConsole.print(1, 1, prompt);
                sampleConsole.setForegroundColor(TCODColor.black);
                recomputeFov = true;
            }
            else if (key.Character == '+' || key.Character == '-')
            {
                algonum += key.Character == '+' ? 1 : -1;

                if (algonum >= TCODFOVTypes.RestrictiveFov)
                    algonum = TCODFOVTypes.RestrictiveFov;
                else if (algonum < 0)
                    algonum = TCODFOVTypes.BasicFov;

                sampleConsole.setForegroundColor(TCODColor.white);
                string prompt = "IJKL : move around\nT : torch fx " + (torch ? "off" : "on ") + " : light walls " + (light_walls ? "off" : "on ") + "\n+-: algo " + algo_names[(int)algonum];
                sampleConsole.print(1, 1, prompt);
                sampleConsole.setForegroundColor(TCODColor.black);
                recomputeFov = true;
            }
        }
Exemplo n.º 13
0
        void render_path(bool first, TCODKey key)
        {
            if (map == null)
            {
                // initialize the map
                map = new TCODMap(SAMPLE_SCREEN_WIDTH, SAMPLE_SCREEN_HEIGHT);
                for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                {
                    for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                    {
                        if (smap[y][x] == ' ')
                            map.setProperties(x, y, true, true);// ground
                        else if (smap[y][x] == '=')
                            map.setProperties(x, y, true, false); // window
                    }
                }
            }

            if (first)
            {
                TCODSystem.setFps(30); // fps limited to 30
                // we draw the foreground only the first time.
                // during the player movement, only the @ is redrawn.
                // the rest impacts only the background color
                // draw the help text & player @
                sampleConsole.clear();
                sampleConsole.setForegroundColor(TCODColor.white);
                sampleConsole.print(1, 1, "IJKL / mouse :\nmove destination\nTAB : A*/dijkstra");
                sampleConsole.print(1, 4, "Using : A*");
                sampleConsole.setForegroundColor(TCODColor.black);
                sampleConsole.putChar(px, py, '@');
                // draw windows
                for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                {
                    for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                    {
                        if (smap[y][x] == '=')
                        {
                            sampleConsole.putChar(x, y, '=');
                        }
                    }
                }
                recalculatePath = true;
            }

            if (recalculatePath)
            {
                if (usingAstar)
                {
                    if (AStrPath == null)
                        AStrPath = new TCODPath(map, 1.41f);

                    AStrPath.compute(px, py, dx, dy);
                }
                else
                {
                    if (DijkstraPath == null)
                        DijkstraPath = new TCODDijkstra(map, 1.41f);

                    dijkstraDist = 0.0f;
                    /* compute the distance grid */
                    DijkstraPath.compute(px, py);
                    /* get the maximum distance (needed for ground shading only) */
                    for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                    {
                        for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                        {
                            float d = DijkstraPath.getDistance(x, y);
                            if (d > dijkstraDist)
                                dijkstraDist = d;
                        }
                    }
                    // compute the path
                    DijkstraPath.setPath(dx, dy);
                }
                recalculatePath = false;
                busy = .2f;
            }

            // draw the dungeon
            for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
            {
                for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                {
                    bool wall = smap[y][x] == '#';
                    sampleConsole.setCharBackground(x, y, (wall ? darkWall : darkGround), TCODBackgroundFlag.Set);
                }
            }

            // draw the path
            if (usingAstar)
            {
                for (int i = 0; i < AStrPath.size(); i++)
                {
                    int x, y;
                    AStrPath.get(i, out x, out y);
                    sampleConsole.setCharBackground(x, y, lightGround, TCODBackgroundFlag.Set);
                }
            }
            else
            {
                for (int y = 0; y < SAMPLE_SCREEN_HEIGHT; y++)
                {
                    for (int x = 0; x < SAMPLE_SCREEN_WIDTH; x++)
                    {
                        bool wall = smap[y][x] == '#';
                        if (!wall)
                        {
                            float d = DijkstraPath.getDistance(x, y);
                            sampleConsole.setCharBackground(x, y, TCODColor.Interpolate(lightGround, darkGround, (float)0.9 * d / dijkstraDist), TCODBackgroundFlag.Set);
                        }
                    }
                }
                for (int i = 0; i < DijkstraPath.size(); i++)
                {
                    int x, y;
                    DijkstraPath.get(i, out x, out y);
                    sampleConsole.setCharBackground(x, y, lightGround, TCODBackgroundFlag.Set);
                }
            }

            // move the creature
            busy -= TCODSystem.getLastFrameLength();
            if (busy <= 0.0f)
            {
                busy += 0.2f;
                if (usingAstar)
                {
                    if (!AStrPath.isEmpty())
                    {
                        sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                        AStrPath.walk(ref px, ref py, true);
                        sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                    }
                }
                else
                {
                    if (!DijkstraPath.isEmpty())
                    {
                        sampleConsole.putChar(px, py, ' ', TCODBackgroundFlag.None);
                        DijkstraPath.walk(ref px, ref py);
                        sampleConsole.putChar(px, py, '@', TCODBackgroundFlag.None);
                        recalculatePath = true;
                    }
                }
            }

            if ((key.Character == 'I' || key.Character == 'i') && dy > 0)
            {
                // destination move north
                sampleConsole.putChar(dx, dy, oldChar, TCODBackgroundFlag.None);
                dy--;
                oldChar = sampleConsole.getChar(dx, dy);
                sampleConsole.putChar(dx, dy, '+', TCODBackgroundFlag.None);
                if (smap[dy][dx] == ' ')
                {
                    recalculatePath = true;
                }
            }
            else if ((key.Character == 'K' || key.Character == 'k') && dy < SAMPLE_SCREEN_HEIGHT - 1)
            {
                // destination move south
                sampleConsole.putChar(dx, dy, oldChar, TCODBackgroundFlag.None);
                dy++;
                oldChar = sampleConsole.getChar(dx, dy);
                sampleConsole.putChar(dx, dy, '+', TCODBackgroundFlag.None);
                if (smap[dy][dx] == ' ')
                {
                    recalculatePath = true;
                }
            }
            else if ((key.Character == 'J' || key.Character == 'j') && dx > 0)
            {
                // destination move west
                sampleConsole.putChar(dx, dy, oldChar, TCODBackgroundFlag.None);
                dx--;
                oldChar = sampleConsole.getChar(dx, dy);
                sampleConsole.putChar(dx, dy, '+', TCODBackgroundFlag.None);
                if (smap[dy][dx] == ' ')
                {
                    recalculatePath = true;
                }
            }
            else if ((key.Character == 'L' || key.Character == 'l') && dx < SAMPLE_SCREEN_WIDTH - 1)
            {
                // destination move east
                sampleConsole.putChar(dx, dy, oldChar, TCODBackgroundFlag.None);
                dx++;
                oldChar = sampleConsole.getChar(dx, dy);
                sampleConsole.putChar(dx, dy, '+', TCODBackgroundFlag.None);
                if (smap[dy][dx] == ' ')
                {
                    recalculatePath = true;
                }
            }
            else if (key.KeyCode ==  TCODKeyCode.Tab)
            {
                usingAstar = !usingAstar;
                sampleConsole.setForegroundColor(TCODColor.white);
                if (usingAstar)
                    sampleConsole.print(1, 4, "Using : A*      ");
                else
                    sampleConsole.print(1, 4, "Using : Dijkstra");
                sampleConsole.setForegroundColor(TCODColor.black);
                recalculatePath = true;
            }

            TCODMouseData mouse = TCODMouse.getStatus();
            int mx = mouse.CellX - SAMPLE_SCREEN_X;
            int my = mouse.CellY - SAMPLE_SCREEN_Y;

            if (mx >= 0 && mx < SAMPLE_SCREEN_WIDTH && my >= 0 && my < SAMPLE_SCREEN_HEIGHT && (dx != mx || dy != my))
            {
                sampleConsole.putChar(dx, dy, oldChar, TCODBackgroundFlag.None);
                dx = mx; dy = my;
                oldChar = sampleConsole.getChar(dx, dy);
                sampleConsole.putChar(dx, dy, '+', TCODBackgroundFlag.None);
                if (smap[dy][dx] == ' ')
                {
                    recalculatePath = true;
                }
            }
        }
Exemplo n.º 14
0
 public bool this[int x, int y]
 {
     get { return(!TCODMap.isWalkable(x, y)); }
     set { TCODMap.setProperties(x, y, !value, !value); }
 }