public void Move(Car self, World world, Game game, Move move)
 {
     if (IsActivated)
     {
         if (this.step1)
         {
             if (self.EnginePower <= -1.0f)
             {
                 this.hack++;
                 if (this.hack >= 5)
                 {
                     this.step1 = false;
                     this.step2 = true;
                     this.hack = 0;
                 }
             }
         }
         else if (this.step2)
         {
             if (self.EnginePower >= 0.2f)
             {
                 this.step2 = false;
                 IsActivated = false;
                 this.lastUsedTick = world.Tick;
             }
         }
     }
 }
Beispiel #2
0
 public void PreMove(Car self, World world, Game game, Move move)
 {
     this.gameStarted = world.Tick > game.InitialFreezeDurationTicks;
     this.enemiesCars.Clear();
     this.enemiesCars.AddRange(world.Cars.Where(car => !car.IsTeammate));
     this.enemyBehind = false;
     this.enemyInFront = false;
 }
Beispiel #3
0
 public void PostMove(Car self, World world, Game game, Move move)
 {
     if (this.gameStarted)
     {
         move.IsThrowProjectile = this.enemyInFront;
         move.IsSpillOil = this.enemyBehind;
     }
 }
 public void Move(Car self, World world, Game game, Move move)
 {
     if (!BackMovingModule.IsActivated)
     {
         this.distance = MathHelper.Distance(new PointF((float)self.X, (float)self.Y), this.nextPoint);
         this.desiredAngle = self.GetAngleTo(this.nextPoint.X, this.nextPoint.Y);
     }
 }
 public void PreMove(Car self, World world, Game game, Move move)
 {
     if (!IsActivated && self.GetSpeed() < 0.75f
         && (this.IsFaceObstacle(self, world, game)
             || (self.EnginePower >= 0.5f && world.Tick > 190 && world.Tick > this.lastUsedTick + 60)))
     {
         IsActivated = true;
         this.step1 = true;
     }
 }
        /// <summary>
        /// Upon starting the game, show the initial startup screen
        /// and initialize the world.
        /// </summary>
        public AgCubio_View()
        {
            InitializeComponent();
            //Use this to prevent screen flickering when redrawing the world
            DoubleBuffered = true;

            Form1 start_game_popup = new Form1(this, false);
            start_game_popup.ShowDialog(this);

            world = new World();
        }
 public void PostMove(Car self, World world, Game game, Move move)
 {
     if (IsActivated)
     {
         move.WheelTurn = 0.0f;
         if (this.step1)
         {
             move.EnginePower = -1.0f;
         }
         else if (this.step2)
         {
             move.EnginePower = 1.0f;
         }
     }
 }
 public void PreMove(Car self, World world, Game game, Move move)
 {
     if (!BackMovingModule.IsActivated)
     {
         this.FindPath(self, world, game);
     }
 }
        private void BuildMap(World world, Game game)
        {
            int multiplier = (int)game.TrackTileSize / MyTileSize;
            map = new MyTileType[world.Width * multiplier, world.Height * multiplier];
            for (int i = 0; i < world.Width; i++)
            {
                for (int j = 0; j < world.Height; j++)
                {
                    switch (world.TilesXY[i][j])
                    {
                        case TileType.Empty:
                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.Unknown:
                            break;
                        case TileType.Crossroads:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                        map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                        map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                        map[(i + 1) * multiplier - k - 1, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            break;
                        case TileType.Horizontal:
                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                    map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.Vertical:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                    map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.BottomHeadedT:
                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                        map[(i + 1) * multiplier - k - 1, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            break;
                        case TileType.TopHeadedT:
                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                        map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                    }
                                }
                            }

                            break;
                        case TileType.LeftHeadedT:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                        map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            break;
                        case TileType.RightHeadedT:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                        map[(i + 1) * multiplier - k - 1, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            break;
                        case TileType.LeftTopCorner:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[(i + 1) * multiplier - k - 1, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 3 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 3 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.RightTopCorner:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                    }
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 3 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 3 / MyTileSize; l++)
                                {
                                    map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.LeftBottomCorner:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                    }
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 3 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 3 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            break;
                        case TileType.RightBottomCorner:
                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    if (k + 1 != (int)game.TrackTileMargin * 2 / MyTileSize
                                        || l + 1 != (int)game.TrackTileMargin * 2 / MyTileSize)
                                    {
                                        map[i * multiplier + k, j * multiplier + l] = MyTileType.Red;
                                    }
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 3 / MyTileSize; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 3 / MyTileSize; l++)
                                {
                                    map[(i + 1) * multiplier - k - 1, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < (int)game.TrackTileMargin * 2 / MyTileSize; k++)
                            {
                                for (int l = 0; l < multiplier; l++)
                                {
                                    map[(i + 1) * multiplier - k - 1, j * multiplier + l] = MyTileType.Red;
                                }
                            }

                            for (int k = 0; k < multiplier; k++)
                            {
                                for (int l = 0; l < (int)game.TrackTileMargin * 2 / MyTileSize; l++)
                                {
                                    map[i * multiplier + k, (j + 1) * multiplier - l - 1] = MyTileType.Red;
                                }
                            }

                            break;
                        default:
                            throw new NotImplementedException("NOOOOOOOOO!!!");
                    }
                }
            }
        }
Beispiel #10
0
        private void BuildIdealPath(Car self, Game game, World world)
        {
            int horLength = map.GetLength(0);
            int vertLength = map.GetLength(1);
            this.mapWithIdealPath = new MyRoadType[horLength, vertLength];
            int currentPositionX = (int)self.X / MyTileSize;
            int currentPositionY = (int)self.Y / MyTileSize;
            this.mapWithIdealPath[currentPositionX, currentPositionY] = MyRoadType.CurrentPosition;
            var nextWaypoint = this.GetNextWaypoint(self, game, world);
            this.mapWithIdealPath[nextWaypoint.X, nextWaypoint.Y] = MyRoadType.Destination;
            if (Math.Abs(currentPositionX - nextWaypoint.X) == Math.Abs(currentPositionY - nextWaypoint.Y))
            {
                int cursorX = currentPositionX;
                int cursorY = currentPositionY;
                int deltaX = nextWaypoint.X > currentPositionX ? 1 : -1;
                int deltaY = nextWaypoint.Y > currentPositionY ? 1 : -1;
                cursorX += deltaX;
                cursorY += deltaY;
                int counter = 500;
                while (this.mapWithIdealPath[cursorX,cursorY] != MyRoadType.Destination)
                {
                    counter--;
                    if (counter <= 0)
                    {
                        throw new InvalidOperationException("I'm IDIOT!");
                    }

                    this.mapWithIdealPath[cursorX,cursorY] = MyRoadType.IdealPath;
                    cursorX += deltaX;
                    cursorY += deltaY;
                }
            }
            else if (Math.Abs(currentPositionX - nextWaypoint.X) > Math.Abs(currentPositionY - nextWaypoint.Y))
            {
                int cursorX = currentPositionX;
                int deltaX = nextWaypoint.X > currentPositionX ? 1 : -1;
                float cursorY = currentPositionY + 0.5f;
                float deltaY = nextWaypoint.Y > currentPositionY
                                   ? Math.Abs(currentPositionY - nextWaypoint.Y)
                                     / (float)Math.Abs(currentPositionX - nextWaypoint.X)
                                   : -Math.Abs(currentPositionY - nextWaypoint.Y)
                                     / (float)Math.Abs(currentPositionX - nextWaypoint.X);
                cursorX += deltaX;
                cursorY += deltaY;
                int counter = 500;
                while (this.mapWithIdealPath[cursorX, (int)cursorY] != MyRoadType.Destination)
                {
                    counter--;
                    if (counter <= 0)
                    {
                        throw new InvalidOperationException("I'm IDIOT. I am!");
                    }

                    this.mapWithIdealPath[cursorX, (int)cursorY] = MyRoadType.IdealPath;
                    cursorX += deltaX;
                    cursorY += deltaY;
                }
            }
            else
            {
                float cursorX = currentPositionX + 0.5f;
                float deltaX = nextWaypoint.X > currentPositionX
                                   ? (float)Math.Abs(currentPositionX - nextWaypoint.X)
                                     / Math.Abs(currentPositionY - nextWaypoint.Y)
                                   : -(float)Math.Abs(currentPositionX - nextWaypoint.X)
                                     / Math.Abs(currentPositionY - nextWaypoint.Y);
                int cursorY = currentPositionY;
                int deltaY = nextWaypoint.Y > currentPositionY ? 1 : -1;
                cursorX += deltaX;
                cursorY += deltaY;
                int counter = 500;
                while (this.mapWithIdealPath[(int)cursorX, cursorY] != MyRoadType.Destination)
                {
                    counter--;
                    if (counter <= 0)
                    {
                        throw new InvalidOperationException("I'm IDIOT! Really");
                    }

                    this.mapWithIdealPath[(int)cursorX, cursorY] = MyRoadType.IdealPath;
                    cursorX += deltaX;
                    cursorY += deltaY;
                }
            }
        }
Beispiel #11
0
        public void PostMove(Car self, World world, Game game, Move move)
        {
            if (!BackMovingModule.IsActivated)
            {
                float speed = self.GetSpeed();
                float angleDerivation = (float)Math.Abs(this.desiredAngle);
                SetCorrectAngles(self, move);
                if (self.RemainingNitroTicks > 0 && this.distance <= 2400)
                {
                    move.IsBrake = true;
                }

                else if (this.distance <= 1200)
                {
                    if (speed <= 10)
                    {
                        move.EnginePower = 0.5;
                    }
                    else if (speed <= 24 || self.EnginePower < 0.15)
                    {
                        move.EnginePower = -0.5;
                    }
                    else
                    {
                        move.IsBrake = true;
                    }
                }
                else
                {
                    if (angleDerivation <= 0.1f)
                    {
                        move.EnginePower = 1.0;
                        if (this.distance > 4000 && world.Tick > 180)
                        {
                            move.IsUseNitro = true;
                        }
                    }
                    else if (angleDerivation <= 0.5f)
                    {
                        move.EnginePower = 1.0;
                    }
                    else
                    {
                        if (speed <= 12)
                        {
                            move.EnginePower = 1.0;
                        }
                        else if (speed <= 22)
                        {
                            move.EnginePower = -0.15;
                        }
                        else
                        {
                            move.IsBrake = true;
                        }
                    }
                }

                if (self.EnginePower < 0.15)
                {
                    move.EnginePower = 0.25;
                }
            }
        }
Beispiel #12
0
        private Point GetNextWaypoint(Car self, Game game, World world)
        {
            var nextWayPoint = new PointF(
                (self.NextWaypointX + 0.5f) * (float)game.TrackTileSize,
                (self.NextWaypointY + 0.5f) * (float)game.TrackTileSize);
            float cornerTileOffset = 0.225f * (float)game.TrackTileSize;
            switch (world.TilesXY[self.NextWaypointX][self.NextWaypointY])
            {
                case TileType.LeftBottomCorner:
                    nextWayPoint.X += cornerTileOffset;
                    nextWayPoint.Y -= cornerTileOffset;
                    break;
                case TileType.LeftTopCorner:
                    nextWayPoint.X += cornerTileOffset;
                    nextWayPoint.Y += cornerTileOffset;
                    break;
                case TileType.RightBottomCorner:
                    nextWayPoint.X -= cornerTileOffset;
                    nextWayPoint.Y -= cornerTileOffset;
                    break;
                case TileType.RightTopCorner:
                    nextWayPoint.X -= cornerTileOffset;
                    nextWayPoint.Y += cornerTileOffset;
                    break;
                case TileType.BottomHeadedT:
                    nextWayPoint.Y += cornerTileOffset;
                    break;
                case TileType.TopHeadedT:
                    nextWayPoint.Y -= cornerTileOffset;
                    break;
                case TileType.LeftHeadedT:
                    nextWayPoint.X -= cornerTileOffset;
                    break;
                case TileType.RightHeadedT:
                    nextWayPoint.X += cornerTileOffset;
                    break;
            }

            return new Point((int)nextWayPoint.X / MyTileSize, (int)nextWayPoint.Y / MyTileSize);
        }
Beispiel #13
0
        private void FindPath(Car self, World world, Game game)
        {
            this.BuildMap(world, game);
            this.BuildIdealPath(self, game, world);
            int horLength = map.GetLength(0);
            int vertLength = map.GetLength(1);
            bool step34AreNecessary = false;
            for (int i = 0; i < horLength && !step34AreNecessary; i++)
            {
                for (int j = 0; j < vertLength; j++)
                {
                    if (this.mapWithIdealPath[i, j] == MyRoadType.IdealPath && map[i, j] == MyTileType.Red)
                    {
                        step34AreNecessary = true;
                        break;
                    }
                }
            }

            if (step34AreNecessary)
            {
                AvoidObstacles();
                BuildRealPath();
            }
            else
            {
                this.nextPoint = new PointF(
                    (self.NextWaypointX + 0.5f) * (float)game.TrackTileSize,
                    (self.NextWaypointY + 0.5f) * (float)game.TrackTileSize);
                bool nextPointFound = false;
                for (int i = 0; i < horLength && !nextPointFound; i++)
                {
                    for (int j = 0; j < vertLength; j++)
                    {
                        if (this.mapWithIdealPath[i, j] == MyRoadType.Destination)
                        {

                            this.nextPoint = new PointF((i + 0.5f) * MyTileSize, (j + 0.5f) * MyTileSize);
                            nextPointFound = true;
                            break;
                        }
                    }
                }
            }
        }
Beispiel #14
0
 public void Move(Car self, World world, Game game, Move move)
 {
     // TODO: Optimize - check my cooldown
     this.CalculateEnemiesBehind(self, game);
     this.CalculateEnemiesInFront(self, game);
 }
Beispiel #15
0
 public TurnPlan GetMovementPlan(World world)
 {
     LastMove     = _currentMove;
     _currentMove = _moveMethod(this, world);
     return(_currentMove);
 }
Beispiel #16
0
 public void Move(Car self, World world, Game game, Move move)
 {
     this.modules.ForEach(module => module.PreMove(self, world, game, move));
     this.modules.ForEach(module => module.Move(self, world, game, move));
     this.modules.ForEach(module => module.PostMove(self, world, game, move));
 }
        private bool IsFaceObstacle(Car self, World world, Game game)
        {
            List<PointF> checkPositions = new List<PointF>(3);
            double absOffset = game.CarWidth / 2 + 120;
            var xOffset = (float)(Math.Cos(self.Angle) * absOffset);
            var yOffset = (float)(Math.Sin(self.Angle) * absOffset);
            checkPositions.Add(new PointF((float)self.X + xOffset, (float)self.Y + yOffset));
            double absOffset1 = game.CarWidth / 2 + 10;
            var xOffset1 = (float)(Math.Cos(self.Angle) * absOffset1);
            var yOffset1 = (float)(Math.Sin(self.Angle) * absOffset1);
            checkPositions.Add(new PointF((float)self.X + xOffset1, (float)self.Y + yOffset1 + 65));
            double absOffset2 = game.CarWidth / 2 + 10;
            var xOffset2 = (float)(Math.Cos(self.Angle) * absOffset2);
            var yOffset2 = (float)(Math.Sin(self.Angle) * absOffset2);
            checkPositions.Add(new PointF((float)self.X + xOffset2, (float)self.Y + yOffset2 - 65));
            try
            {
                foreach (var checkPosition in checkPositions)
                {
                    int tileX = (int)checkPosition.X / (int)game.TrackTileSize;
                    int tileY = (int)checkPosition.Y / (int)game.TrackTileSize;
                    float checkX = checkPosition.X % (int)game.TrackTileSize;
                    float checkY = checkPosition.Y % (int)game.TrackTileSize;
                    var tileType = world.TilesXY[tileX][tileY];
                    switch (tileType)
                    {
                        case TileType.BottomHeadedT:
                            if (checkY < game.TrackTileMargin
                                || Math.Sqrt(
                                    checkX * checkX
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.Empty:
                            return true;
                        case TileType.LeftHeadedT:
                            if (checkX > game.TrackTileSize - game.TrackTileMargin
                                || Math.Sqrt(checkX * checkX + checkY * checkY) < game.TrackTileMargin
                                || Math.Sqrt(
                                    checkX * checkX
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.RightHeadedT:
                            if (checkX < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + checkY * checkY) < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.TopHeadedT:
                            if (checkY > game.TrackTileSize - game.TrackTileMargin
                                || Math.Sqrt(checkX * checkX + checkY * checkY) < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + checkY * checkY) < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.Crossroads:
                            if (Math.Sqrt(checkX * checkX + checkY * checkY) < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + checkY * checkY) < game.TrackTileMargin
                                || Math.Sqrt(
                                    checkX * checkX
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin
                                || Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.Vertical:
                            if (checkX < game.TrackTileMargin || checkX > game.TrackTileSize - game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.Horizontal:
                            if (checkY < game.TrackTileMargin || checkY > game.TrackTileSize - game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.LeftBottomCorner:
                            if (
                                Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + checkY * checkY) < game.TrackTileMargin
                                || checkY > game.TrackTileSize - game.TrackTileMargin || checkX < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.RightBottomCorner:
                            if (Math.Sqrt(checkX * checkX + checkY * checkY) < game.TrackTileMargin
                                || checkY > game.TrackTileSize - game.TrackTileMargin
                                || checkX > game.TrackTileSize - game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.RightTopCorner:
                            if (
                                Math.Sqrt(
                                    checkX * checkX
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin || checkY < game.TrackTileMargin
                                || checkX > game.TrackTileSize - game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        case TileType.LeftTopCorner:
                            if (
                                Math.Sqrt(
                                    ((int)game.TrackTileSize - checkX) * ((int)game.TrackTileSize - checkX)
                                    + ((int)game.TrackTileSize - checkY) * ((int)game.TrackTileSize - checkY))
                                < game.TrackTileMargin || checkY < game.TrackTileMargin || checkX < game.TrackTileMargin)
                            {
                                return true;
                            }

                            break;
                        default:
                            throw new NotImplementedException(":(");
                    }
                }
            }
            catch
            {
            }

            return false;
        }