Пример #1
0
 public void Handle_and_CheckWeaponCollision(TitleObject gameObject)
 {
     if (gameObject.isAlive)
     {
         foreach (KeyValuePair <int, WeaponObject[]> entry in mainPlayer.weaponDict)
         {
             foreach (WeaponObject w in entry.Value)
             {
                 if (w.isAlive && w.isSolid)
                 {
                     if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height))
                     {
                         w.isAlive = false;
                         gameObject.HP--;
                         if (gameObject.HP == 0)
                         {
                             // Game.Components.Remove(gameObject);
                             //  gameObject.Dispose();
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
        public Level2Screen(Game game, SpriteBatch sB) : base(game, sB)
        {
            isActive    = true;
            isCompleted = false;
            timeCounter = 0;

            mainPlayer = GameFlowManager.player1;

            int maxHP = 20;

            canyouseemeTitle           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/canyouseemeV1"));
            canyouseemeTitle.position  = new Vector2(400, 100);
            canyouseemeTitle.initialHP = maxHP;
            canyouseemeTitle.HP        = maxHP;

            IPreadytolearnTitle           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/IPreadytolearn"));
            IPreadytolearnTitle.position  = new Vector2(600, 300);
            IPreadytolearnTitle.initialHP = maxHP;
            IPreadytolearnTitle.HP        = maxHP;

            lvl2warning1           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/lv2warning1"));
            lvl2warning1.position  = new Vector2(100 + lvl2warning1.texture.Width / 2, 100 + lvl2warning1.texture.Height / 2);
            lvl2warning1.initialHP = maxHP;
            lvl2warning1.HP        = maxHP;

            keepafloat           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/keepafloat"));
            keepafloat.position  = new Vector2(300 + lvl2warning1.texture.Width / 2, 100 + lvl2warning1.texture.Height / 2);
            keepafloat.initialHP = maxHP;
            keepafloat.HP        = maxHP;

            letsstartthelearning           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/letsstartthelearning"));
            letsstartthelearning.position  = new Vector2(200 + lvl2warning1.texture.Width / 2, 100 + lvl2warning1.texture.Height / 2);
            letsstartthelearning.initialHP = maxHP;
            letsstartthelearning.HP        = maxHP;

            forscience           = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/forscience"));
            forscience.position  = new Vector2(200 + lvl2warning1.texture.Width / 2, 200 + lvl2warning1.texture.Height / 2);
            forscience.initialHP = maxHP;
            forscience.HP        = maxHP;

            apertureascii          = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/Level2/apertureasciiV3"));
            apertureascii.position = new Vector2(10 + apertureascii.texture.Width / 2, 50 + lvl2warning1.texture.Height / 2);


            spriteFont1 = Game.Content.Load <SpriteFont>("Fonts/SF1");


            totalAngularVelocity = 0;

            PE1 = new ParticleEngine(sB, Game.Content.Load <Texture2D>("Sprites/goatV1"), 2);
        }
Пример #3
0
        public Level1Screen(Game game, SpriteBatch sB) : base(game, sB)
        {
            spriteFont1        = Game.Content.Load <SpriteFont>("Fonts/SF1");
            isActive           = true;
            isCompleted        = false;
            isintroComplete    = false;
            istutorialComplete = false;
            ismovingComplete   = false;

            isPlayerLaunched = false;

            screenRectangle = new Rectangle(0, 0, Game1.screenWidth, Game1.screenHeight);

            // set up level content
            iTitle = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/InfinitelyV2"));
            iTitle.targetPosition = new Vector2(650, 150);
            iTitle.position       = -10f * iTitle.targetPosition;

            iiTitle                = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/ImprobableV2"));
            iiTitle.position       = GenerateRandomPositionOutside();
            iiTitle.rotation       = 0f;
            iiTitle.targetPosition = new Vector2(450, 350);
            iiTitle.targetRotation = 20f * (float)Math.PI;


            iiiTitle = new TitleObject(game, sB, Game.Content.Load <Texture2D>("Sprites/IncertitudeV1"));
            iiiTitle.targetPosition = new Vector2(600, 500);
            iiiTitle.position       = -iiiTitle.targetPosition;
            iiiTitle.initialShake   = 1f;

            Game.Components.Add(iTitle);
            Game.Components.Add(iiTitle);
            Game.Components.Add(iiiTitle);

            mainPlayer = GameFlowManager.player1;

            mainPlayer.isControllable  = false;
            mainPlayer.isMoveable      = false;
            mainPlayer.activeTextureID = 1;

            timeCount = 0;

            wall_smack   = Game.Content.Load <SoundEffect>("SoundEffects/smack-1");
            toilet_flush = Game.Content.Load <SoundEffect>("SoundEffects/toilet-flush-2");

            SoundEffect.MasterVolume = 0.08f;
            toilet_flush.Play();

            toj = Game.Content.Load <Texture2D>("Sprites/TOJstamp");
        }
Пример #4
0
        public Level1Screen(Game game, SpriteBatch sB)
            : base(game, sB)
        {
            spriteFont1 = Game.Content.Load<SpriteFont>("Fonts/SF1");
            isActive = true;
            isCompleted = false;
            isintroComplete = false;
            istutorialComplete = false;
            ismovingComplete = false;

            isPlayerLaunched = false;

            screenRectangle = new Rectangle(0, 0, Game1.screenWidth,Game1.screenHeight);

            // set up level content
            iTitle = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/InfinitelyV2"));
            iTitle.targetPosition = new Vector2(650, 150);
            iTitle.position = -10f*iTitle.targetPosition;

            iiTitle = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/ImprobableV2"));
            iiTitle.position = GenerateRandomPositionOutside();
            iiTitle.rotation = 0f;
            iiTitle.targetPosition = new Vector2(450, 350);
            iiTitle.targetRotation = 20f * (float)Math.PI;

            iiiTitle = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/IncertitudeV1"));
            iiiTitle.targetPosition = new Vector2(600, 500);
            iiiTitle.position = -iiiTitle.targetPosition;
            iiiTitle.initialShake = 1f;

            Game.Components.Add(iTitle);
            Game.Components.Add(iiTitle);
            Game.Components.Add(iiiTitle);

            mainPlayer = GameFlowManager.player1;

            mainPlayer.isControllable = false;
            mainPlayer.isMoveable = false;
            mainPlayer.activeTextureID = 1;

            timeCount = 0;

            wall_smack = Game.Content.Load<SoundEffect>("SoundEffects/smack-1");
            toilet_flush = Game.Content.Load<SoundEffect>("SoundEffects/toilet-flush-2");

            SoundEffect.MasterVolume = 0.08f;
            toilet_flush.Play();

            toj = Game.Content.Load<Texture2D>("Sprites/TOJstamp");
        }
Пример #5
0
        public Level2Screen(Game game, SpriteBatch sB)
            : base(game, sB)
        {
            isActive = true;
            isCompleted = false;
            timeCounter = 0;

            mainPlayer = GameFlowManager.player1;

            int maxHP = 20;

            canyouseemeTitle = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/canyouseemeV1"));
            canyouseemeTitle.position = new Vector2(400, 100);
            canyouseemeTitle.initialHP = maxHP;
            canyouseemeTitle.HP = maxHP;

            IPreadytolearnTitle = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/IPreadytolearn"));
            IPreadytolearnTitle.position = new Vector2(600, 300);
            IPreadytolearnTitle.initialHP = maxHP;
            IPreadytolearnTitle.HP = maxHP;

            lvl2warning1 = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/lv2warning1"));
            lvl2warning1.position = new Vector2(100 + lvl2warning1.texture.Width/2, 100 + lvl2warning1.texture.Height/2);
            lvl2warning1.initialHP = maxHP;
            lvl2warning1.HP = maxHP;

            keepafloat = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/keepafloat"));
            keepafloat.position = new Vector2(300 + lvl2warning1.texture.Width / 2, 100 + lvl2warning1.texture.Height / 2);
            keepafloat.initialHP = maxHP;
            keepafloat.HP = maxHP;

            letsstartthelearning = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/letsstartthelearning"));
            letsstartthelearning.position = new Vector2(200 + lvl2warning1.texture.Width / 2, 100 + lvl2warning1.texture.Height / 2);
            letsstartthelearning.initialHP = maxHP;
            letsstartthelearning.HP = maxHP;

            forscience = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/forscience"));
            forscience.position = new Vector2(200 + lvl2warning1.texture.Width / 2, 200 + lvl2warning1.texture.Height / 2);
            forscience.initialHP = maxHP;
            forscience.HP = maxHP;

            apertureascii = new TitleObject(game, sB, Game.Content.Load<Texture2D>("Sprites/Level2/apertureasciiV3"));
            apertureascii.position = new Vector2(10+ apertureascii.texture.Width / 2, 50 + lvl2warning1.texture.Height / 2);

            spriteFont1 = Game.Content.Load<SpriteFont>("Fonts/SF1");

            totalAngularVelocity = 0;

            PE1 = new ParticleEngine(sB, Game.Content.Load<Texture2D>("Sprites/goatV1"),2);
        }
Пример #6
0
 public void Handle_and_CheckWeaponCollision(TitleObject gameObject)
 {
     if (gameObject.isAlive)
     {
         foreach (KeyValuePair<int, WeaponObject[]> entry in mainPlayer.weaponDict)
         {
             foreach (WeaponObject w in entry.Value)
             {
                 if (w.isAlive && w.isSolid)
                 {
                     if (gameObject.CheckCollision(w.position, w.texture.Width, w.texture.Height))
                     {
                         w.isAlive = false;
                         gameObject.HP--;
                         if (gameObject.HP == 0)
                         {
                            // Game.Components.Remove(gameObject);
                           //  gameObject.Dispose();
                         }
                     }
                 }
             }
         }
     }
 }