Exemple #1
0
        public void Update(GameTime timeSpan)
        {
            player.Update(timeSpan);
            skeleton1.Update(timeSpan);
            skeleton2.Update(timeSpan);
            skeleton3.Update(timeSpan);
            bat1.Update(timeSpan);
            bat2.Update(timeSpan);
            Collisions.CheckWallCollision(player, walls);

            if (Collisions.CollidesWith(player.bounds, skeleton1.bounds) ||
                Collisions.CollidesWith(player.bounds, skeleton2.bounds) ||
                Collisions.CollidesWith(player.bounds, skeleton3.bounds) ||
                Collisions.CollidesWith(player.bounds, bat1.bounds) ||
                Collisions.CollidesWith(player.bounds, bat2.bounds))
            {
                hurt.Play();
                player.bounds.X = 55;
                player.bounds.Y = 550;
                bat1.bounds.X   = 1200;
                bat1.bounds.Y   = 0;
                bat2.bounds.X   = 1200;
                bat2.bounds.Y   = 800;
                lives--;
            }

            if (Collisions.CollidesWith(player.bounds, ruby1.bounds))
            {
                if (!ruby1collected)
                {
                    ruby_collect.Play();
                }
                ruby1collected = true;
            }
            if (Collisions.CollidesWith(player.bounds, ruby2.bounds))
            {
                if (!ruby2collected)
                {
                    ruby_collect.Play();
                }
                ruby2collected = true;
            }
            if (Collisions.CollidesWith(player.bounds, ruby3.bounds))
            {
                if (!ruby3collected)
                {
                    ruby_collect.Play();
                }
                ruby3collected = true;
            }
            if (ruby1collected && ruby2collected && ruby3collected)
            {
                player.bounds.Height = 0;
                player.bounds.Width  = 0;
                game.level           = 2;
            }
        }
Exemple #2
0
        public void Update(GameTime timeSpan)
        {
            player.Update(timeSpan);
            skeleton1.Update(timeSpan);
            skeleton2.Update(timeSpan);
            dragon.Update(timeSpan);
            Collisions.CheckWallCollision(player, walls);

            if (Collisions.CollidesWith(player.bounds, skeleton1.bounds) ||
                Collisions.CollidesWith(player.bounds, skeleton2.bounds) ||
                Collisions.CollidesWith(player.bounds, dragon.bounds))
            {
                hurt.Play();
                player.bounds.X = 55;
                player.bounds.Y = 550;
                lives--;
            }
            if (dragon.fireballloaded)
            {
                if (Collisions.CollidesWith(player.bounds, dragon.fireball.bounds))
                {
                    hurt.Play();
                    player.bounds.X = 55;
                    player.bounds.Y = 550;
                    lives--;
                }
            }
            if (dragon.fireball2loaded)
            {
                if (Collisions.CollidesWith(player.bounds, dragon.fireball2.bounds))
                {
                    hurt.Play();
                    player.bounds.X = 55;
                    player.bounds.Y = 550;
                    lives--;
                }
            }

            if (Collisions.CollidesWith(player.bounds, ruby1.bounds))
            {
                if (!ruby1collected)
                {
                    ruby_collect.Play();
                    dragon.level++;
                }
                ruby1collected = true;
            }
            if (Collisions.CollidesWith(player.bounds, ruby2.bounds))
            {
                if (!ruby2collected)
                {
                    ruby_collect.Play();
                    dragon.level++;
                }
                ruby2collected = true;
            }
            if (Collisions.CollidesWith(player.bounds, ruby3.bounds))
            {
                if (!ruby3collected)
                {
                    ruby_collect.Play();
                    dragon.level++;
                }
                ruby3collected = true;
            }
            if (ruby1collected && ruby2collected && ruby3collected)
            {
                game.level = 3;
            }
        }