Example #1
0
        public bool Move(Coord movePos, ref BattleMap map)
        {
            if (isAlive && Math.Pow((movePos.x - pos.x), 2) + Math.Pow((movePos.y - pos.y), 2) <= Math.Pow(speed, 2))
            {
                Console.SetCursorPosition(39 + pos.x * 5, 2 + pos.y * 3);
                map.GetLandscape(pos.x * 5, pos.y * 3).Print();
                Console.SetCursorPosition(39 + pos.x * 5, 2 + pos.y * 3);
                Console.Write('_');

                Console.SetCursorPosition(40 + pos.x * 5, 2 + pos.y * 3);
                map.GetLandscape(pos.x * 5 + 1, pos.y * 3).Print();
                Console.SetCursorPosition(38 + pos.x * 5, 2 + pos.y * 3);
                map.GetLandscape(pos.x * 5 == 0 ? 0 : pos.x * 5 - 1, pos.y * 3).Print();


                Console.SetCursorPosition(38 + pos.x * 5, 3 + pos.y * 3);
                map.GetLandscape(pos.x * 5 == 0? 0 : pos.x * 5 - 1, pos.y * 3 + 1).Print();
                Console.SetCursorPosition(39 + pos.x * 5, 3 + pos.y * 3);
                map.GetLandscape(pos.x * 5, pos.y * 3 + 1).Print();
                Console.SetCursorPosition(40 + pos.x * 5, 3 + pos.y * 3);
                map.GetLandscape(pos.x * 5 + 1, pos.y * 3 + 1).Print();
                Console.SetCursorPosition(41 + pos.x * 5, 3 + pos.y * 3);
                map.GetLandscape(pos.x * 5 + 2, pos.y * 3 + 1).Print();

                SingleLogBattle.log.LogNewLine(name + '(' + number + ')' + " move from (" + pos.x + ", " + pos.y + ") to ("
                                               + movePos.x + ", " + movePos.y + ").");

                pos = movePos;
                return(true);
            }
            return(false);
        }
Example #2
0
 public BattleModule(BattleMap.LandscapeTypes type)
 {
     mapPrintPos.x = 37;
     mapPrintPos.y = 1;
     map           = new BattleMap();
     map.GenerateLandscape(type);
     arrow     = new ArrowBattle();
     isRunning = true;
 }
Example #3
0
        public void ClearColorBeforeMove(ref BattleMap map)
        {
            Console.SetCursorPosition(38 + pos.x * 5, 2 + pos.y * 3);
            map.GetLandscape(pos.x * 5 == 0 ? 0 : pos.x * 5 - 1, pos.y * 3).Print();
            Console.SetCursorPosition(40 + pos.x * 5, 2 + pos.y * 3);
            map.GetLandscape(pos.x * 5 + 1, pos.y * 3).Print();

            Console.SetCursorPosition(38 + pos.x * 5, 3 + pos.y * 3);
            map.GetLandscape(pos.x * 5 == 0 ? 0 : pos.x * 5 - 1, pos.y * 3 + 1).Print();
            Console.SetCursorPosition(39 + pos.x * 5, 3 + pos.y * 3);
            map.GetLandscape(pos.x * 5, pos.y * 3 + 1).Print();
            Console.SetCursorPosition(40 + pos.x * 5, 3 + pos.y * 3);
            map.GetLandscape(pos.x * 5 + 1, pos.y * 3 + 1).Print();
            Console.SetCursorPosition(41 + pos.x * 5, 3 + pos.y * 3);
            map.GetLandscape(pos.x * 5 + 2, pos.y * 3 + 1).Print();
        }