コード例 #1
0
ファイル: Player.cs プロジェクト: siderisltd/Telerik-Academy
        private void shurAnimTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (this.flyingShurs.Count > 0)
            {
                foreach (var shuriken in this.flyingShurs)
                {
                    // check if shuriken hits the enemy
                    if (shuriken.col + shuriken.objectWidth / 2 == Game.Enemy.col &&
                        (shuriken.row + 3 >= Game.Enemy.row && shuriken.row + 3 <= Game.Enemy.row + Game.Enemy.objectHight))
                    {
                        shuriken.Color = ConsoleColor.Black;
                        shuriken.Draw();
                        this.flyingShurs.Remove(shuriken);
                        Game.EnemyHealth--;
                        Game.UpdateEnemyHealth();
                        Game.Enemy.fireballThrowTimer.Interval -= 200;
                        if (Game.EnemyHealth <= 0)
                        {
                            Game.Level++;
                        }
                    }
                    // else  if shuriken reaches the end of screen , remove it
                    else if (shuriken.col > 250)
                    {
                        shuriken.Color = ConsoleColor.Black;
                        shuriken.Draw();
                        this.flyingShurs.Remove(shuriken);
                    }

                    shuriken.Move(Directions.Right, 5);
                }
            }
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: siderisltd/Telerik-Academy
        private static List <GameObject> ninjaStars     = new List <GameObject>(); //the ninja stars currently available

        public static void ConstructPlayField()
        {
            Console.CursorVisible = false;
            GameObject building = new GameObject("building.txt", 1, 24);

            building.Color = ConsoleColor.DarkGray;
            building.Draw();
            GameObject enemyHealth = new GameObject("EnemyHealth.txt", 200, 3);

            enemyHealth.Color = ConsoleColor.Red;
            enemyHealth.Draw();
            GameObject ninjaStars = new GameObject("NinjaStars.txt", 10, 3);

            ninjaStars.Color = ConsoleColor.Green;
            ninjaStars.Draw();
            GameObject buildingStrength = new GameObject("BuildingStrength.txt", 90, 3);

            buildingStrength.Color = ConsoleColor.Yellow;
            buildingStrength.Draw();
            Sounds.MainTheme.PlayLooping();
            UpdateBuildingStrength();
            UpdateEnemyHealth();
            UpdateNinjaStars();
            Player.Color           = ConsoleColor.DarkGreen;
            Player.TopConstraint   = 20;
            Player.LeftConstraint  = 63;
            Player.RightConstraint = 100;
            Player.Draw();
        }
コード例 #3
0
        public static void Intro()
        {
            GameObject introScreen = new GameObject("introScreen.txt", 1, 1);

            introScreen.Draw();
            Console.ReadKey();
        }
コード例 #4
0
        public static void GameLose()
        {
            GameObject Lose = new GameObject("Lose.txt", 1, 1);

            Lose.Draw();
            var key = Console.ReadKey();
        }
コード例 #5
0
        public static void GameWin()
        {
            GameObject Win = new GameObject("Win.txt", 1, 1);

            Win.Draw();
            var key = Console.ReadKey();
        }
コード例 #6
0
        public static void SplashScreenLevel3()
        {
            GameObject ScreenLevel3 = new GameObject("ScreenLevel3.txt", 1, 1);

            ScreenLevel3.Draw();
            var key = Console.ReadKey();
        }
コード例 #7
0
ファイル: Enemy.cs プロジェクト: siderisltd/Telerik-Academy
 public void ThrowFiraballs()
 {
     fireball       = new GameObject("fireball.txt", this.col - 30, this.row);
     fireball.Color = ConsoleColor.DarkYellow;
     fireball.Draw();
     fireballs.Add(fireball);
 }
コード例 #8
0
ファイル: Enemy.cs プロジェクト: KostaDinkov/TelerikAcademy
 public void ThrowFiraballs()
 {
     fireball = new GameObject("fireball.txt", this.col - 30, (this.row+10));
     fireball.Color = ConsoleColor.DarkYellow;
     fireball.Draw();
     fireballs.Add(fireball);
     Sounds.PlayFireballThrow();
 }
コード例 #9
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
        public static void Spash(string name, int time = 5000)
        {
            GameObject splashscreen = new GameObject(name, 1, 1);

            splashscreen.Draw();
            Thread.Sleep(time);
            Console.ReadKey();
        }
コード例 #10
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
        public static void Win()
        {
            Console.Clear();
            Sounds.GameWinSound.Play();
            GameObject gameWin = new GameObject("win_new.txt", 1, 1);

            gameWin.Color = ConsoleColor.Red;
            gameWin.Draw();
            Thread.Sleep(5000);
        }
コード例 #11
0
ファイル: Game.cs プロジェクト: siderisltd/Telerik-Academy
        public static void GameOver()
        {
            Thread.Sleep(500);
            Console.Clear();
            GameObject gameOverText = new GameObject("GameOver.txt", 30, 40);

            gameOverText.Color = ConsoleColor.Red;
            gameOverText.Draw();

            Sounds.MainTheme.Stop();
            Sounds.GameOverSound.Play();
        }
コード例 #12
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
        public static void GameOver()
        {
            Thread.Sleep(500);
            Console.Clear();
            GameObject gameOverText = new GameObject("GameOver_new.txt", 1, 1);

            gameOverText.Color = ConsoleColor.Red;
            gameOverText.Draw();


            Sounds.GameOverSound.Play();
        }
コード例 #13
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
        private static List<GameObject> ninjaStars = new List<GameObject>(); //the ninja stars currently available

        #endregion Fields

        #region Methods

        public static void ConstructPlayField()
        {
            Console.CursorVisible = false;
            GameObject building = new GameObject("building.txt", 1, 24);
            building.Color = ConsoleColor.DarkGray;
            building.Draw();
            GameObject enemyHealth = new GameObject("EnemyHealth.txt", 200, 3);
            enemyHealth.Color = ConsoleColor.Red;
            enemyHealth.Draw();
            GameObject ninjaStars = new GameObject("NinjaStars.txt", 10, 3);
            ninjaStars.Color = ConsoleColor.Green;
            ninjaStars.Draw();
            GameObject buildingStrength = new GameObject("BuildingStrength.txt", 90, 3);
            buildingStrength.Color = ConsoleColor.Yellow;
            buildingStrength.Draw();
            UpdateBuildingStrength();
            UpdateEnemyHealth();
            UpdateNinjaStars();
            Player.Color = ConsoleColor.DarkGreen;
            Player.TopConstraint = 20;
            Player.LeftConstraint = 63;
            Player.RightConstraint = 100;
            Player.Draw();
        }
コード例 #14
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
        public static void GameOver()
        {
            Thread.Sleep(500);
            Console.Clear();
            GameObject gameOverText = new GameObject("GameOver_new.txt", 1, 1);
            gameOverText.Color = ConsoleColor.Red;
            gameOverText.Draw();

            Sounds.GameOverSound.Play();
        }
コード例 #15
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
 public static void Win()
 {
     Console.Clear();
     Sounds.GameWinSound.Play();
     GameObject gameWin = new GameObject("win_new.txt", 1, 1);
     gameWin.Color = ConsoleColor.Red;
     gameWin.Draw();
     Thread.Sleep(5000);
 }
コード例 #16
0
ファイル: Game.cs プロジェクト: KostaDinkov/TelerikAcademy
 public static void Spash(string name, int time = 5000)
 {
     GameObject splashscreen = new GameObject(name, 1, 1);
     splashscreen.Draw();
     Thread.Sleep(time);
     Console.ReadKey();
 }