Exemplo n.º 1
0
 public SightBlock()
     : base("SightBlock", (uint)(Game.WindowWidth / PersistentData.sightGridWidth), (uint)(Game.WindowHeight / PersistentData.sightGridHeight), "sightblock.png")
 {
     ObjectManager.AddGameObject(this);
     die     = false;
     Opacity = 1.0f;
 }
Exemplo n.º 2
0
 //Functions
 public Particle(PointF pos, float timing, double size)
     : base("Particle", (uint)size, (uint)size, "particle.png", 3, 1, 3, 0)
 {
     ObjectManager.AddGameObject(this);
     this.Position = pos;
     this.zOrder   = 1;
     timer         = timing;
 }
Exemplo n.º 3
0
 public Finish(float posX, float posY)
     : base("Finish", 50, 86, "door.png")
 {
     ObjectManager.AddGameObject(this);
     Position.X = posX;
     Position.Y = posY + 16 + Height / 2;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(Width, Height);
 }
Exemplo n.º 4
0
        public override void Create()
        {
            base.Create();
            GameObject background = new GameObject("TitleScreenScreen", 800, 600, "titlescreen.png");

            ObjectManager.AddGameObject(background);
            SoundManager.AddBackgroundMusic("BGMusic", "FluffyJay1Theme.wav", true);
            SoundManager.PlayBackgroundMusic("BGMusic");
        }
Exemplo n.º 5
0
 public concussion()
     : base("concussion", 200, 200, "explosion.png", 9, 1, 9, 0.03f)
 {
     ObjectManager.AddGameObject(this);
     this.zOrder = 2;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(200);
     playerAffected = false;
 }
Exemplo n.º 6
0
 public HelperObject()
     : base("HelperObject", 0, 0, null)
 {
     ObjectManager.AddGameObject(this);
     bleedTimer = 0;
     bleedTicks = 0;
     xVel       = 0;
     yVel       = 0;
 }
Exemplo n.º 7
0
 public fragment(float xvel, float yvel)
     : base("fragment", 15, 15, "bullet1.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX = xvel;
     velocityY = yvel;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(7.5f);
     damage = 5.5f; //originally 5.5
 }
Exemplo n.º 8
0
 public bullet2(float xvel, float yvel)
     : base("bullet2", 15, 15, "bullet2.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX = xvel;
     velocityY = yvel;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(7.5f);
     damage = 3.5f;
 }
Exemplo n.º 9
0
 public nullfield()
     : base("nullfield", 600, 600, "nullfield.png")
 {
     ObjectManager.AddGameObject(this);
     this.zOrder  = 1;
     this.Opacity = 0;
     timer        = PersistentData.nullFieldLength;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(250);
 }
Exemplo n.º 10
0
 public MedKit(float posX, float posy)
     : base("MedKit", 50, 50, "MedKit.png")
 {
     ObjectManager.AddGameObject(this);
     Position.X  = posX;
     Position.Y  = posy + 8 + Height / 2;
     heal        = PersistentData.medKitHeal;
     this.zOrder = 1;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(Width, Height);
 }
Exemplo n.º 11
0
 public PickUp(float posX, float posy, string image)
     : base("PickUp", 20, 20, image)
 {
     ObjectManager.AddGameObject(this);
     Position.X  = posX;
     Position.Y  = posy + 8 + Height / 2;
     this.zOrder = 1;
     item        = image;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(Width, Height);
 }
Exemplo n.º 12
0
 public bullet1(float xvel, float yvel)
     : base("bullet1", 15, 15, "bullet1.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX = xvel;
     velocityY = yvel;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(7.5f);
     collidingWithNullField = false;
     damage = 8.5f;
 }
Exemplo n.º 13
0
 public bullet4(float xvel, float yvel)
     : base("bullet4", 15, 15, "bullet4.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX = xvel;
     velocityY = yvel;
     prevPosX  = Position.X;
     prevPosY  = Position.Y;
     CollisionData.CollisionEnabled = true;
     CollisionData.SetCollisionData(7.5f);
     damage      = 7.5f;
     bounceCount = PersistentData.bounceNum;
 }
Exemplo n.º 14
0
 public grenade1(float xvel, float yvel)
     : base("grenade1", 20, 20, "grenade1.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX   = xvel;
     velocityY   = yvel;
     prevPosX    = Position.X;
     prevPosY    = Position.Y;
     damage      = 40.0f;
     willDie     = false;
     timer       = 3.0f;
     this.zOrder = 1;
 }
Exemplo n.º 15
0
 public grenade2(float xvel, float yvel)
     : base("grenade2", 20, 20, "grenade2.png")
 {
     ObjectManager.AddGameObject(this);
     velocityX   = xvel;
     velocityY   = yvel;
     prevPosX    = Position.X;
     prevPosY    = Position.Y;
     damage      = 0.0f;
     willDie     = false;
     timer       = 3.0f;
     this.zOrder = 1;
     CollisionData.CollisionEnabled = false;
 }
Exemplo n.º 16
0
        public EnemyClass(float posX_, float posY_, float health_, int weapontype_)
            : base("Enemy", 0, 0, null)
        {
            ObjectManager.AddGameObject(this);
            body                = new GameObject("EnemyBody", 40, 80, "enemybody.png", 16, 2, 8, 0.1f);
            head                = new GameObject("EnemyHead", 40, 70, "enemyface.png", 2, 2, 1, 1.0f);
            gun                 = new GameObject("EnemyGun", 80, 40, "enemygun.png", 2, 2, 1, 1.0f);
            deadbody            = new GameObject("EnemyDeadBody", 100, 120, "enemydeath.png", 24, 2, 12, 0.1f);
            deadBodyFrameOffset = 0;
            deadBodyFrameNum    = 0;
            deadBodyFrameTime   = 0.1f;
            deadbody.Opacity    = 0;
            deathTimer          = 5.0f;
            body.ZOrder         = 1;
            head.ZOrder         = 1;
            gun.ZOrder          = 1;
            ObjectManager.AddGameObject(body);
            ObjectManager.AddGameObject(head);
            ObjectManager.AddGameObject(gun);
            ObjectManager.AddGameObject(deadbody);
            velX  = 0;
            velY  = 0;
            timer = -1.0f;

            bleedTimer = 0;
            bleedTicks = 0;

            isAffectedByConcussion = false;

            degrees     = 0;
            FrameOffset = 0;

            bodyFrameTime = 0.1f;
            bodyFrameNum  = 0;
            isOnGround    = false;
            health        = health_;
            prevHealth    = health;
            Position.X    = posX_;
            Position.Y    = posY_;
            weapontype    = weapontype_;
            body.CollisionData.CollisionEnabled = true;
            body.CollisionData.SetCollisionData(body.Width - 30, body.Height + 5);
            CollisionData.CollisionEnabled = true;
            CollisionData.SetCollisionData(body.Width - 30, (body.Height + 10) * 2);

            LOSWithPlayer   = false;
            isAwareOfPlayer = false;
        }
Exemplo n.º 17
0
        public BloodSpurt(int particleNum, PointF pos)
            : base("BloodSpurt", 0, 0, null)
        {
            ObjectManager.AddGameObject(this);
            rand = new Random();

            for (int particleCount = 0; particleCount < particleNum; particleCount++)
            {
                float mag = (float)rand.NextDouble() * (2 + (0.1f * particleNum));
                //float mag = 20.0f;
                float    temp = (float)rand.NextDouble() * 3;
                double   s    = (rand.NextDouble() * 0.75 * (particleNum + 15)) + 35;
                Particle p    = new Particle(pos, temp, s);
                Particle q    = new Particle(pos, temp + 0.05f, s - 10);

                /*
                 * //PointF point = PointInCircle(180, 200);
                 * //p.Position = point;
                 * //p.Position.X = (rand.Next((int)Game.WindowWidth)) - Game.WindowWidth / 2;
                 * //p.Position.Y = (rand.Next((int)Game.WindowHeight)) - Game.WindowHeight / 2;
                 */


                p.xvel = ((float)rand.NextDouble() - 0.5f);
                p.yvel = ((float)rand.NextDouble() - 0.5f);
                float xsquared = p.xvel * p.xvel;
                float ysquared = p.yvel * p.yvel;
                float length   = (float)Math.Sqrt(xsquared + ysquared);
                if (length != 0)
                {
                    p.xvel /= length;
                    p.yvel /= length;
                }
                float randNum = ((float)rand.NextDouble() * mag);
                p.xvel *= randNum;
                p.yvel *= randNum;
                p.yvel += 3;
                q.xvel  = p.xvel * 0.9f;
                q.yvel  = p.yvel * 0.9f;
            }
            this.IsDead = true;
        }
Exemplo n.º 18
0
        public override void Initialize()
        {
            base.Initialize();

            CurrentSelected = 0;

            Buttons = new Button[4];                                                   // holds all the A,B,C,D buttons

            Buttons[0]          = new Button("A", "AText1.png", "AText2.png", 47, 39); // A button
            Buttons[0].Position = new PointF(-600, 0);

            Buttons[1]          = new Button("B", "BText1.png", "BText2.png", 39, 36); // B button
            Buttons[1].Position = new PointF(-600, -60);

            Buttons[2]          = new Button("C", "CText1.png", "CText2.png", 45, 38); // C button
            Buttons[2].Position = new PointF(-600, -120);

            Buttons[3]          = new Button("D", "DText1.png", "DText2.png", 50, 38); // D button
            Buttons[3].Position = new PointF(-600, -180);

            foreach (Button b in Buttons)  // add all these buttons to the screen
            {
                ObjectManager.AddGameObject(b);
            }

            Game.LifeCounter.Visible = false;  // set all of the counters to not visible
            Game.DiskCounter.Visible = false;
            Game.RoomMessage.Visible = false;

            Game.Question.Visible = true;
            Game.OptionA.Visible  = true;
            Game.OptionB.Visible  = true;
            Game.OptionC.Visible  = true;
            Game.OptionD.Visible  = true;

            QuestionsCorrect = 0;
            CurrentQuestion  = Trivia.GetRandomQuestionAndAnswers();

            TriviaMusic.Play();  // play the music when in trivia
            MusicTimer = TriviaMusicDuration * (int)FrameRateController.FrameRate;
        }
Exemplo n.º 19
0
 void SightBlocks()
 {
     for (int i = 0; i < PersistentData.sightGridHeight; i++)
     {
         for (int p = 0; p < PersistentData.sightGridWidth; p++)
         {
             bool temp  = sb[p, i];
             bool temp2 = gb[p, i];
             if (g3 == null)
             {
                 if (temp == false)
                 {
                     GameObject sightblock;
                     sightblock            = new SightBlock();
                     sightblock.Position.X = (p * Game.WindowWidth / PersistentData.sightGridWidth) - ((Game.WindowWidth / 2) - ((Game.WindowWidth / PersistentData.sightGridWidth) / 2)) + Camera.Position.X;
                     sightblock.Position.Y = (i * Game.WindowHeight / PersistentData.sightGridHeight) - ((Game.WindowHeight / 2) - ((Game.WindowHeight / PersistentData.sightGridHeight) / 2)) + Camera.Position.Y;
                     sightblock.ZOrder     = 5;
                     ObjectManager.AddGameObject(sightblock);
                 }
             }
             else
             {
                 if (temp == false && temp2 == false)
                 {
                     GameObject sightblock;
                     sightblock            = new SightBlock();
                     sightblock.Position.X = (p * Game.WindowWidth / PersistentData.sightGridWidth) - ((Game.WindowWidth / 2) - ((Game.WindowWidth / PersistentData.sightGridWidth) / 2)) + Camera.Position.X;
                     sightblock.Position.Y = (i * Game.WindowHeight / PersistentData.sightGridHeight) - ((Game.WindowHeight / 2) - ((Game.WindowHeight / PersistentData.sightGridHeight) / 2)) + Camera.Position.Y;
                     sightblock.ZOrder     = 5;
                     ObjectManager.AddGameObject(sightblock);
                 }
             }
         }
     }
     edgeprotectors.Position = Camera.Position;
 }
Exemplo n.º 20
0
        public override void Update()
        {
            base.Update();

            MusicTimer--;
            if (MusicTimer == 0)
            {
                MusicTimer = TriviaMusicDuration * (int)FrameRateController.FrameRate;
                TriviaMusic.Play();
            }

            Game.Question.Text = CurrentQuestion[0];

            Game.OptionA.Text = CurrentQuestion[1];
            Game.OptionB.Text = CurrentQuestion[2];
            Game.OptionC.Text = CurrentQuestion[3];
            Game.OptionD.Text = CurrentQuestion[4];

            if (InputManager.IsKeyTriggered(Keys.Enter) || (Player1.IsAPressed && CanPressA))  // when an option is chosen
            {
                CanPressA = false;
                string Selection = "";
                switch (CurrentSelected)
                {
                case 0:
                    Selection = "A";
                    break;

                case 1:
                    Selection = "B";
                    break;

                case 2:
                    Selection = "C";
                    break;

                case 3:
                    Selection = "D";
                    break;
                }
                if (Selection == CurrentQuestion[5]) // if it is the correct answer
                {
                    QuestionsCorrect++;              // increment questions
                    Correct.Play();                  // play the right sound
                }
                else
                {
                    Wrong.Play();          // play the wrong sound
                }
                if (QuestionsCorrect == 3) // when 3 questions have been answered
                {
                    ToAddTo.Ammo += 20;

                    Game.LifeCounter.Visible = true;
                    Game.DiskCounter.Visible = true;

                    Game.Question.Visible = false;
                    Game.OptionA.Visible  = false;
                    Game.OptionB.Visible  = false;
                    Game.OptionC.Visible  = false;
                    Game.OptionD.Visible  = false;
                    foreach (GameObject g in ToReadd)
                    {
                        ObjectManager.AddGameObject(g);
                    }
                    foreach (Button b in Buttons)
                    {
                        ObjectManager.RemoveGameObject(b);
                    }
                    GameStateManager.SetCurrentStateNoInitialize(LevelToReturnTo);
                }
                CurrentQuestion = Trivia.GetRandomQuestionAndAnswers();
            }
        }
Exemplo n.º 21
0
        //Functions
        public override void Create()
        {
            //WHEN MAKING A NEW LEVEL, MAKE SURE TO UPDATE THE BRUSHING IN:
            //BULLETS 1-4
            //GRENADES 1-4
            //ENEMY
            //FRAGMENT
            //PARTICLE
            //ALSO MAKE THE PLAYER RESPAWN BACK IN THE SAME LEVEL
            //DA FONT FOR DA BACKGROUND IS MACROPSIA BRK
            base.Create();
            playerVelX = 0;
            playerVelY = 0;
            GameObject background = new GameObject("Level2Background", 1600, 600, "Level2Background.png");// <----------------------CHANGE THIS AS WELL

            background.Position.X += background.Width / 2;
            background.Position.Y -= background.Height / 2;
            ObjectManager.AddGameObject(background);
            background.ZOrder = -1;

            canGoRight = true;
            canGoLeft  = true;
            isWalking  = false;

            weapon1Cooldown = 0;
            weapon2Cooldown = 0;
            weapon3Cooldown = 0;
            weapon4Cooldown = 0;

            PersistentData.Health = 100;

            /////////////////////////////////////////////////////////////////////////////
            PersistentData.Level = 2;
            playerPosX           = 75;
            playerPosY           = -575;
            new EnemyClass(520, -375, 50, 2);
            new EnemyClass(100, -275, 50, 1);
            new EnemyClass(1000, -575, 50, 1);
            new EnemyClass(1075, -125, 50, 2);
            new EnemyClass(1405, -425, 50, 1);

            new MedKit(425, -125);
            new MedKit(1050, -575);

            new PickUp(700, -575, "bullet2.png");
            new Finish(1475, -575);

            SoundManager.AddBackgroundMusic("BGMusic", "InTheWind.wav", true);
            SoundManager.PlayBackgroundMusic("BGMusic");
            /////////////////////////////////////////////////////////////////////////////
            GameObject start = new GameObject("Start", 50, 86, "doorstart.png");

            start.Position.X = playerPosX;
            start.Position.Y = playerPosY + 16 + start.Height / 2;
            ObjectManager.AddGameObject(start);
            new HUD();
            body              = new GameObject("PlayerBody", 40, 80, "playerbody.png", 16, 2, 8, 0.1f);
            head              = new GameObject("PlayerHead", 40, 70, "playerface.png", 2, 2, 1, 1.0f);
            gun               = new GameObject("PlayerGun", 80, 40, "playergun.png", 2, 2, 1, 1.0f);
            deadbody          = new GameObject("DeadBody", 100, 120, "playerdeath.png", 24, 2, 12, 0.1f);
            deadBodyFrameTime = 0.1f;
            deadBodyFrameNum  = 0;
            deathTimer        = 3;
            body.ZOrder       = 1;
            head.ZOrder       = 1;
            gun.ZOrder        = 1;
            body.CollisionData.CollisionEnabled = true;
            body.CollisionData.SetCollisionData(body.Width - 30, body.Height + 5);
            edgeprotectors        = new GameObject("EdgeProtectors", 800, 600, "edgeprotectors.png");
            edgeprotectors.ZOrder = 4;
            ObjectManager.AddGameObject(body);
            ObjectManager.AddGameObject(head);
            ObjectManager.AddGameObject(gun);
            ObjectManager.AddGameObject(deadbody);
            new HelperObject();
            deadbody.Opacity = 0;
            ObjectManager.AddGameObject(edgeprotectors);

            playerBodyFrameNum  = 0;
            playerBodyFrameTime = 0.1f;

            for (int i = 0; i < PersistentData.sightGridHeight; i++)
            {
                for (int p = 0; p < PersistentData.sightGridWidth; p++)
                {
                    sb[p, i] = true;
                    gb[p, i] = true;
                }
            }

            movementSpeed = PersistentData.movementSpeed;
        }
Exemplo n.º 22
0
        public HUD()
            : base("HUD", 0, 0, null)
        {
            ObjectManager.AddGameObject(this);
            healthbar        = new GameObject("healthbar", 300, 20, "sightblock.png");
            healthbar.ZOrder = 10;
            ObjectManager.AddGameObject(healthbar);
            cursor        = new GameObject("Crosshairs", 40, 40, "Crosshairs.png");
            cursor.ZOrder = 11;
            ObjectManager.AddGameObject(cursor);
            InputManager.ShowCursor = false;
            healthbackground        = new GameObject("healthbackground", healthbar.Width, healthbar.Height, "sightblock.png");
            healthbackground.SetModulationColor(0.3f, 0.1f, 0.1f, 1);
            healthbackground.ZOrder = 9;
            ObjectManager.AddGameObject(healthbackground);

            iconRowY        = -200;
            bullet1IconPosX = -300;
            bullet2IconPosX = -250;
            bullet3IconPosX = -200;
            bullet4IconPosX = -150;

            grenade1IconPosX = 150;
            grenade2IconPosX = 200;
            grenade3IconPosX = 250;
            grenade4IconPosX = 300;

            bullet1Icon = new GameObject("bullet1Icon", 50, 50, "bullet1Icon.png");
            bullet2Icon = new GameObject("bullet2Icon", 50, 50, "bullet2Icon.png");
            bullet3Icon = new GameObject("bullet3Icon", 50, 50, "bullet3Icon.png");
            bullet4Icon = new GameObject("bullet4Icon", 50, 50, "bullet4Icon.png");

            grenade1Icon = new GameObject("grenade1Icon", 50, 50, "grenade1Icon.png");
            grenade2Icon = new GameObject("grenade2Icon", 50, 50, "grenade2Icon.png");
            grenade3Icon = new GameObject("grenade3Icon", 50, 50, "grenade3Icon.png");
            grenade4Icon = new GameObject("grenade4Icon", 50, 50, "grenade4Icon.png");

            bullet1Cooldown = new GameObject("bullet1Cooldown", 50, 50, "sightblock.png");
            bullet2Cooldown = new GameObject("bullet2Cooldown", 50, 50, "sightblock.png");
            bullet3Cooldown = new GameObject("bullet3Cooldown", 50, 50, "sightblock.png");
            bullet4Cooldown = new GameObject("bullet4Cooldown", 50, 50, "sightblock.png");

            grenade1Cooldown = new GameObject("grenade1Cooldown", 50, 50, "sightblock.png");
            grenade2Cooldown = new GameObject("grenade2Cooldown", 50, 50, "sightblock.png");
            grenade3Cooldown = new GameObject("grenade3Cooldown", 50, 50, "sightblock.png");
            grenade4Cooldown = new GameObject("grenade4Cooldown", 50, 50, "sightblock.png");

            selection = new GameObject("selection", 50, 50, "selection.png");

            bullet1Icon.ZOrder = 10;
            bullet2Icon.ZOrder = 10;
            bullet3Icon.ZOrder = 10;
            bullet4Icon.ZOrder = 10;

            grenade1Icon.ZOrder = 10;
            grenade2Icon.ZOrder = 10;
            grenade3Icon.ZOrder = 10;
            grenade4Icon.ZOrder = 10;

            bullet1Cooldown.ZOrder = 10;
            bullet2Cooldown.ZOrder = 10;
            bullet3Cooldown.ZOrder = 10;
            bullet4Cooldown.ZOrder = 10;

            grenade1Cooldown.ZOrder = 10;
            grenade2Cooldown.ZOrder = 10;
            grenade3Cooldown.ZOrder = 10;
            grenade4Cooldown.ZOrder = 10;

            bullet1Cooldown.Opacity = 0.6f;
            bullet2Cooldown.Opacity = 0.6f;
            bullet3Cooldown.Opacity = 0.6f;
            bullet4Cooldown.Opacity = 0.6f;

            grenade1Cooldown.Opacity = 0.6f;
            grenade2Cooldown.Opacity = 0.6f;
            grenade3Cooldown.Opacity = 0.6f;
            grenade4Cooldown.Opacity = 0.6f;

            selection.ZOrder = 10;

            ObjectManager.AddGameObject(bullet1Icon);
            ObjectManager.AddGameObject(bullet2Icon);
            ObjectManager.AddGameObject(bullet3Icon);
            ObjectManager.AddGameObject(bullet4Icon);

            ObjectManager.AddGameObject(grenade1Icon);
            ObjectManager.AddGameObject(grenade2Icon);
            ObjectManager.AddGameObject(grenade3Icon);
            ObjectManager.AddGameObject(grenade4Icon);

            ObjectManager.AddGameObject(bullet1Cooldown);
            ObjectManager.AddGameObject(bullet2Cooldown);
            ObjectManager.AddGameObject(bullet3Cooldown);
            ObjectManager.AddGameObject(bullet4Cooldown);

            ObjectManager.AddGameObject(grenade1Cooldown);
            ObjectManager.AddGameObject(grenade2Cooldown);
            ObjectManager.AddGameObject(grenade3Cooldown);
            ObjectManager.AddGameObject(grenade4Cooldown);

            ObjectManager.AddGameObject(selection);
        }
Exemplo n.º 23
0
 public explosion()
     : base("explosion", 200, 200, "explosion.png", 9, 1, 9, 0.03f)
 {
     ObjectManager.AddGameObject(this);
     this.zOrder = 2;
 }