Exemplo n.º 1
0
        void MoveShots()
        {
            for(int i = 0; i < bullets.Count; i++)
            {
                if (bullets[i].x >= 0 && bullets[i].y >= 0 && bullets[i].x <= 1900 && bullets[i].y <= 1000)
                {
                    bullets[i].x = bullets[i].x + bullets[i].dx;
                    bullets[i].y = bullets[i].y + bullets[i].dy;
                    Map.ContainerSetCoordinate(bullets[i].container, bullets[i].x, bullets[i].y);
                }

                else
                {
                    Map.ContainerErase(bullets[i].container);
                    bullets.RemoveAt(i);
                }
            }

            for (int i = 0; i < enemyBull.Count; i++)
            {
                if (enemyBull[i].x >= 0 && enemyBull[i].y >= 0 && enemyBull[i].x <= 1900 && enemyBull[i].y <= 1000)
                {
                    enemyBull[i].x = enemyBull[i].x + enemyBull[i].dx;
                    enemyBull[i].y = enemyBull[i].y + enemyBull[i].dy;
                    Map.ContainerSetCoordinate(enemyBull[i].container, enemyBull[i].x, enemyBull[i].y);
                }

                else
                {
                    Map.ContainerErase(enemyBull[i].container);
                    enemyBull.RemoveAt(i);
                }
            }
        }