Ejemplo n.º 1
0
        private static List<enemyShell> EnemyShoot(List<enemyShell> enemyShells, int shipX, int shipY, char enemyShellDesign, ConsoleColor color, bool goingDown = true)
        {
            enemyShell currentenemyShell = new enemyShell();

            currentenemyShell.x = shipX;
            currentenemyShell.y = shipY;
            currentenemyShell.enemyShellDesign = enemyShellDesign;
            currentenemyShell.color = color;
            currentenemyShell.goingDown = goingDown;
            enemyShells.Add(currentenemyShell);

            return enemyShells;
        }
Ejemplo n.º 2
0
        // Move the enemyshells udownward
        static List<enemyShell> UpdateEnemyShells(List<enemyShell> enemyShells)
        {
            // init the needed variables
            List<enemyShell> movedShells = new List<enemyShell>(enemyShells.Count);
            enemyShell currentShell = new enemyShell();

            // move each shell upwards/downwards
            for (int i = 0; i < enemyShells.Count; i++)
            {
                // if the shell has reached the end of the screen, skip this loop
                if (enemyShells[i].y == 0 || enemyShells[i].y == Console.BufferHeight)
                {
                    continue;
                }

                // add the appropriate values
                currentShell.enemyShellDesign = enemyShells[i].enemyShellDesign;
                currentShell.color = enemyShells[i].color;
                currentShell.x = enemyShells[i].x;
                currentShell.goingDown = enemyShells[i].goingDown;

                // move the shell down
                if (currentShell.goingDown)
                {
                    currentShell.y = enemyShells[i].y + 1;
                    currentShell.x = enemyShells[i].x + 1;
                }
                else
                {
                    currentShell.y = enemyShells[i].y - 1;
                }
             
                // add the current shell to the new list of moved shells
                movedShells.Add(currentShell);
            }

            // return the new list
            return movedShells;
        }
Ejemplo n.º 3
0
        // Move the enemyshells udownward
        static List<enemyShell> UpdateEnemyShells(List<enemyShell> enemyShells)
        {
            // init the needed variables
            List<enemyShell> movedShells = new List<enemyShell>(enemyShells.Count);
            enemyShell currentShell = new enemyShell();

            // move each shell upwards/downwards
            for (int i = 0; i < enemyShells.Count; i++)
            {
                // if the shell has reached the end of the screen, skip this loop
                if (enemyShells[i].y == 0 || enemyShells[i].y == Console.BufferHeight)
                {
                    continue;
                }

                // add the appropriate values
                currentShell.enemyShellDesign = enemyShells[i].enemyShellDesign;
                currentShell.color = enemyShells[i].color;
                currentShell.x = enemyShells[i].x;
                currentShell.goingDown = enemyShells[i].goingDown;

                // move the shell down
                if (currentShell.goingDown)
                {
                    currentShell.y = enemyShells[i].y + 1;
                    currentShell.x = enemyShells[i].x + 1;
                }
                else
                {
                    currentShell.y = enemyShells[i].y - 1;
                }

                // add the current shell to the new list of moved shells
                movedShells.Add(currentShell);
            }

            // return the new list
            return movedShells;
        }
Ejemplo n.º 4
0
        private static List<enemyShell> EnemyShoot(List<enemyShell> enemyShells, int shipX, int shipY, char enemyShellDesign, ConsoleColor color, bool goingDown = true)
        {
            enemyShell currentenemyShell = new enemyShell();

            currentenemyShell.x = shipX;
            currentenemyShell.y = shipY;
            currentenemyShell.enemyShellDesign = enemyShellDesign;
            currentenemyShell.color = color;
            currentenemyShell.goingDown = goingDown;
            enemyShells.Add(currentenemyShell);

            return enemyShells;
        }