Exemple #1
0
 public override string ToString()
 {
     return
         ("Demon1 = " + FeatherStrings.TraceString(Demon1.ToString()) +
          ", Demon2 = " + FeatherStrings.TraceString(Demon2.ToString()) +
          ", Demon3 = " + FeatherStrings.TraceString(Demon3 == null ? "(null)" : Demon3.ToString()));
 }
Exemple #2
0
        protected override void Update(GameTime gameTime)
        {
            theTime   = gameTime.TotalGameTime.Seconds;
            TotalTime = "Total Time: " + theTime.ToString() + " Difficulty: " + difficulty.ToString();
            base.Update(gameTime);
            input = Keyboard.GetState();
            if (input.IsKeyDown(Keys.Space))
            {
                Sara.Handle_Sara_Fireball(Sara, saraFireball);
            }
            Sara.HandleMovement(input, gameTime, Sara, Barriers);
            Dragon.Handle_Dragon(gameTime, dragonFireball);

            health_timer += (float)gameTime.ElapsedGameTime.TotalSeconds;

            foreach (AnimatedSprite fireball in Fireballs)
            {
                fireball.Update(gameTime);
                if (fireball.alive == true)
                {
                    fireball.alive = fireball.Check_Barriers(fireball, Barriers);
                    if (fireball.name == "Sara_Fireball")
                    {
                        foreach (Enemy enemy in Enemies)
                        {
                            fireball.HandleCollision(fireball, enemy);
                        }
                        foreach (AnimatedSprite Fireball in Fireballs)
                        {
                            if (Fireball.name != "Sara_Fireball")
                            {
                                fireball.HandleCollision(fireball, Fireball);
                            }
                        }
                    }
                }
                if (fireball.alive == false && fireball.name == "Sorc_Fireball")
                {
                    if (Sorcerer.alive)
                    {
                        fireball.alive = true;
                    }
                    fireball.position = new Vector2(Sorcerer.position.X + Sorcerer.width, 530);
                }
                else if (fireball.alive == false && fireball.name == "Dragon_Fireball")
                {
                    fireball.position = new Vector2(Dragon.position.X - (dragonFireball.width), Dragon.position.Y + 10);
                }
                if (fireball.name != "Sara_Fireball")
                {
                    fireball.position.X += fireball.speed;
                }
                else
                {
                    if (fireball.Animation == "Up" || fireball.Animation == "Down")
                    {
                        fireball.position.Y += fireball.speed;
                    }
                    else
                    {
                        fireball.position.X += fireball.speed;
                    }
                }
                if (health_timer > health_interval)
                {
                    if (Sara.HandleCollision(Sara, fireball))
                    {
                        fireball.alive = false;
                        {
                            health_bar.Update_Health(health_bar, Sara);
                            health_timer = 0;
                        }
                    }
                }
            }
            foreach (Enemy enemy in Enemies)
            {
                if (enemy.alive == true)
                {
                    enemy.Update(gameTime);
                    if (enemy.name == "Demon")
                    {
                        enemy.CheckSprint(Sara);
                    }
                    enemy.MoveEnemy();
                    if (health_timer > health_interval)
                    {
                        if (Sara.HandleCollision(Sara, enemy))
                        {
                            health_bar.Update_Health(health_bar, Sara);
                            health_timer = 0;
                        }
                    }
                }
            }



            beach.Update(gameTime);
            if (Sara.alive == false || Dragon.alive == false)
            {
                Sara.Set_Health_Damage(300, 1);
                Demon.Set_Health_Damage(10000, 150);
                Demon1.Set_Health_Damage(10000, 150);
                Demon2.Set_Health_Damage(10000, 150);
                Sorcerer.Set_Health_Damage(3, 100);
                Dragon.Set_Health_Damage(15, 300);
                health_bar.Update_Health(health_bar, Sara);
                if (Dragon.alive == false)
                {
                    foreach (Enemy enemy in Enemies)
                    {
                        enemy.speed += 0.1f;
                    }
                    Sara.speed += 0.1f;
                    difficulty += 1;
                }
                foreach (Enemy enemy in Enemies)
                {
                    enemy.alive = true;
                }

                Sara.position = new Vector2(30, 690);
                Sara.alive    = true;
            }
        }