Exemplo n.º 1
0
 public static void PlayerAttacksEnemy(Pokemon pokemon)
 {
     if (Player.Health > 0)
     {
         if (pokemon.Defense - Player.AttackPower * 2 < 0)
             pokemon.Health += pokemon.Defense - Player.AttackPower * 2;
         else
             if (Game1.DebugMode == true)
                 Debug.WriteLine("Deine Angriffskraft ist zu niedrig um Schaden zu verursachen.");
     }
 }
Exemplo n.º 2
0
 public static void EnemyAttacksPlayer(Pokemon pokemon)
 {
     if (pokemon.Health > 0)
     {
         if (Player.Defense - pokemon.AttackPower * 2 < 0)
         {
             if (Player.Health + Player.Defense - pokemon.AttackPower * 2 > 0)
                 Player.Health += Player.Defense - pokemon.AttackPower * 2;
             else
                 Player.Health = 0;
         }
         else
             if(Game1.DebugMode == true)
                 Debug.WriteLine("Die Angriffskraft des Gegners ist zu niedrig um Schaden zu verursachen.");
     }
 }
Exemplo n.º 3
0
 public static void Fight(Pokemon pokemon)
 {
     // Fight between Player and any Enemy
     if (Player.Init >= pokemon.Init)
     {
         while (Player.Health > 0 && pokemon.Health > 0)
         {
             PlayerAttacksEnemy(pokemon);
             EnemyAttacksPlayer(pokemon);
         }
         if (Player.Health < 1)
         {
             Player.Death();
         }
         else
         {
             Player.Xp += pokemon.AttackPower * pokemon.Defense;
             GameManager.Destroy(pokemon);
             CollisionManager.Destroy(pokemon.collider);
         }
     }
     else if (Player.Init < pokemon.Init)
     {
         while (Player.Health > 0 && pokemon.Health > 0)
         {
             EnemyAttacksPlayer(pokemon);
             PlayerAttacksEnemy(pokemon);
         }
         if (Player.Health < 1)
         {
             Player.Death();
         }
         else
         {
             Player.Xp += pokemon.AttackPower * pokemon.Defense;
             GameManager.Destroy(pokemon);
             CollisionManager.Destroy(pokemon.collider);
         }
     }
     Player.CheckAndDoLvlUp();
 }
Exemplo n.º 4
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameManager.Content = this.Content;

            Map map = new Map();
            map.LoadMapFromImage(Content.Load<Texture2D>("Map"));
            GameManager.AddGameObject(map);

            player = new Player(new Vector2(17, 12));
            GameManager.AddGameObject(player);

            playerAnimation = new SpriteAnimation("player", Content.Load<Texture2D>("playerMovement"), Content.RootDirectory + "/playerMovement.xml");

            player.SpriteAnimation = playerAnimation;
            player.SpriteAnimation.FrameDelay = 200;

            camera.SetTarget(player);

            // UI
            healthBar = new UILabel(Fonts.Arial, new Vector2(camera.X, camera.Y), ("HP: " + Player.Health.ToString() + ""), 0.5f, Color.Black);
            DialogBox = new UITexture(new Vector2(camera.X, camera.Y), Color.White, "800x120_gray");

            //Pokemons
            bisasam = new Pokemon(new Vector2( 3, 3 ), "Bisasam", "bisasam1", 120, 5, 10, 0, 2, "plant", true);
            bisasam = new Pokemon(new Vector2(31, 9 ), "Bisasam", "bisasam2", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(32, 9 ), "Bisasam", "bisasam3", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(32, 10 ), "Bisasam", "bisasam4", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(31, 10), "Bisasam", "bisasam5", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(30, 9 ), "Bisasam", "bisasam6", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(30, 10), "Bisasam", "bisasam7", 20, 5, 5, 0, 2, "plant", false);
            bisasam = new Pokemon(new Vector2(14, 19), "Bisasam", "bisasam8", 20, 5, 5, 0, 2, "plant", false);

            //Items
            potion = new Potion(new Vector2(1, 1), Content.RootDirectory + "/items.xml", "PotionRed");
            potion2 = new Potion(new Vector2(30, 12), Content.RootDirectory + "/items.xml", "PotionRed");
        }