Exemple #1
0
        public void Draw(SpriteBatch sB, string getText, float getTextSize, Vector2 getPos)
        {
            MousePos     = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 0, 0);
            CollisionBox = new Rectangle((int)getPos.X - SpriteAnim.Width / 2, (int)getPos.Y - SpriteAnim.Height / 2, SpriteAnim.Width, SpriteAnim.Height);

            SpriteAnim.Draw(sB, getPos);

            ButtonText.Draw(sB, getText, getPos, getTextSize, Color.White);
        }
Exemple #2
0
        public void Draw(SpriteBatch sB)
        {
            if (isAlive)
            {
                foreach (AnimSprite Burner in BackBurners)
                {
                    Burner.UpdateAnimation(0.3f);
                }
                BackBurners[0].Draw(sB, new Vector2(Position.X - 150, Position.Y + 65));
                BackBurners[1].Draw(sB, new Vector2(Position.X - 190, Position.Y + 55));
                BackBurners[2].Draw(sB, new Vector2(Position.X + 135, Position.Y + 65));
                BackBurners[3].Draw(sB, new Vector2(Position.X + 175, Position.Y + 55));

                Sprite.Draw(sB, Position);

                if (isEnabled)
                {
                    MainCannonTimer++;
                    if (MainCannonTimer <= 300)
                    {
                        MainCannonChargeUp.Width  += 1;
                        MainCannonChargeUp.Height += 1;
                    }
                    else if (MainCannonTimer >= 600)
                    {
                        MainCannonChargeUp.Width  = 128;
                        MainCannonChargeUp.Height = 128;
                    }

                    if (MainCannonTimer >= 300 && MainCannonTimer <= 600)
                    {
                        MainCannon.UpdateAnimation(0.4f);
                        MainCannon.Draw(sB, new Vector2(Turret[2].Position.X, Turret[2].Position.Y * 5));
                        MainCannonCollisionBox = new Rectangle((int)Turret[2].Position.X, (int)Turret[2].Position.Y * 2, 100, 650);
                    }
                    else if (MainCannonTimer >= 600)
                    {
                        MainCannonCollisionBox = Rectangle.Empty;
                        MainCannonTimer        = 0;
                    }
                }

                MainCannonChargeUp.UpdateAnimation(0.4f);
                MainCannonChargeUp.Draw(sB, new Vector2(Turret[2].Position.X, Turret[2].Position.Y + 70));

                for (int i = 0; i < 2; i++)
                {
                    Turret[i].Draw(sB);
                }
                Turret[2].Draw(sB);
            }
        }
Exemple #3
0
 public void Draw(SpriteBatch sB)
 {
     if (isAlive)
     {
         if (SpriteType == ESpriteType.ANIM)
         {
             SpriteAnim.Draw(sB, Position);
         }
         else
         {
             Sprite.Draw(sB, Position);
         }
     }
     else
     {
         Position = Vector2.Zero;
     }
 }
Exemple #4
0
        public void Draw(SpriteBatch sB)
        {
            if (isAlive)
            {
                for (int i = 0; i < BulletList.Count; i++)
                {
                    BulletList[i].Draw(sB);
                }

                if (SecondaryFireShot)
                {
                    gui.AltBarAmount = 0;

                    if (!SecondaryFireChargeUpAnim.AnimationFinnished)
                    {
                        PlayerAltSFXIns[0].Play();
                        SecondaryFireChargeUpAnim.Height += 3;
                        SecondaryFireChargeUpAnim.Width  += 3;
                        SecondaryFireChargeUpAnim.UpdateAnimation(0.5f);
                        SecondaryFireChargeUpAnim.Draw(sB, new Vector2(Position.X, Position.Y - 20));
                    }
                    else
                    {
                        if (!SecondaryFireAnim.AnimationFinnished)
                        {
                            PlayerAltSFXIns[1].Play();
                            SecondaryFireRect = new Rectangle((int)Position.X - SecondaryFireAnim.Width / 6, (int)Position.Y - SecondaryFireAnim.Height, ScreenSize.Width / 6, ScreenSize.Height);
                            SecondaryFireAnim.UpdateAnimation(0.5f);
                            SecondaryFireAnim.Draw(sB, new Vector2((int)Position.X, (int)Position.Y - SecondaryFireAnim.Height / 2));
                            //sB.Draw(CollisionBoxTexture, SecondaryFireRect, Color.White);
                        }
                        else
                        {
                            SecondaryFireRect = new Rectangle(-100, -100, 0, 0);
                            SecondaryFireShot = false;
                            SecondaryFireAnim.AnimationFinnished         = false;
                            SecondaryFireChargeUpAnim.AnimationFinnished = false;
                            SecondaryFireChargeUpAnim.Height             = 164;
                            SecondaryFireChargeUpAnim.Width = 164;
                        }
                    }
                }

                BackBurnerEffect.Draw(sB, new Vector2(Position.X, Position.Y + 22));
                Sprite.Draw(sB, Position);

                if (isImmune)
                {
                    ImmuneTimer++;
                    if (ImmuneTimer <= 300)
                    {
                        ShieldEffect.Draw(sB, Position, MathHelper.ToRadians(180));
                    }
                    else
                    {
                        ImmuneTimer = 301;
                        isImmune    = false;
                    }
                }

                CollisionBox = new Rectangle((int)Position.X - Sprite.Width / 4, (int)Position.Y - Sprite.Height / 2, Sprite.Width / 2, Sprite.Height);
            }
            else
            {
                CollisionBox = new Rectangle(-100, -100, 0, 0);
                for (int i = 0; i < BulletList.Count; i++)
                {
                    BulletList[i].CollisionBox = new Rectangle(-100, -100, 0, 0);
                }
            }

            if (GameMode.Controls == GameMode.EControls.Mouse)
            {
                Cursor.Draw(sB, new Vector2(GotoPos.X - 5, GotoPos.Y + 5));
            }
        }
Exemple #5
0
        public void Draw(SpriteBatch sB)
        {
            LifeTimer++;
            if (LifeTimer < 500 && isAlive)
            {
                isAlive = true;
            }
            else
            {
                LifeTimer = 501;
                isAlive   = false;
            }

            if (!isAlive)
            {
                CollectSFXIns.Volume = 0.3f;

                CollectSFXTimer++;
                if (CollectSFXTimer <= 1)
                {
                    CollectSFXIns.Play();
                }
                else
                {
                    CollectSFXTimer = 2;
                }
            }

            if (IsUp)
            {
                Position.Y += 3;
            }
            else
            {
                Position.Y -= 3;
            }
            if (IsLeft)
            {
                Position.X += 3;
            }
            else
            {
                Position.X -= 3;
            }

            if (Position.X >= 700)
            {
                IsLeft = false;
            }
            if (Position.X <= 0)
            {
                IsLeft = true;
            }
            if (Position.Y >= 700)
            {
                IsUp = false;
            }
            if (Position.Y <= 0)
            {
                IsUp = true;
            }

            if (SpriteType == ESpriteType.BASIC && isAlive)
            {
                Sprite.Draw(sB, Position);
                CollisionBox = new Rectangle((int)Position.X, (int)Position.Y, Sprite.Width, Sprite.Height);
            }
            else
            {
                CollisionBox = Rectangle.Empty;
            }

            if (SpriteType == ESpriteType.ANIM && isAlive)
            {
                CollisionBox = new Rectangle((int)Position.X - SpriteAnim.Width / 2, (int)Position.Y - SpriteAnim.Height / 2, SpriteAnim.Width, SpriteAnim.Height);
                SpriteAnim.UpdateAnimation(0.5f);
                SpriteAnim.Draw(sB, Position);
            }
            else
            {
                CollisionBox = Rectangle.Empty;
            }
        }
Exemple #6
0
        public void Draw(SpriteBatch sB)
        {
            if (isAlive)
            {
                switch (_spriteType)
                {
                case ESpriteType.BASIC:
                {
                    sprite.Draw(sB, Position, Rotation);
                    CollisionBox = new Rectangle((int)Position.X - sprite.Width / 2, (int)Position.Y - sprite.Height / 2, sprite.Width, sprite.Height);
                }; break;

                case ESpriteType.ANIM:
                {
                    SpriteAnim.Draw(sB, Position, Rotation);
                    CollisionBox = new Rectangle((int)Position.X - SpriteAnim.Width / 2, (int)Position.Y - SpriteAnim.Height / 2, SpriteAnim.Width, SpriteAnim.Height);
                }; break;
                }
                if (DebugMode)
                {
                    sB.Draw(CollisionBoxTexture, CollisionBox, Color.White);
                }

                if (!ShootAnim.AnimationFinnished)
                {
                    isShooting = true;
                }
                else
                {
                    isShooting = false;
                }

                if (isShooting)
                {
                    ShootAnim.UpdateAnimation(1f);
                    ShootAnim.Draw(sB, FirePosition, Rotation);
                }
            }
            else
            {
                CollisionBox.X      = -100;
                CollisionBox.Y      = -100;
                CollisionBox.Width  = 0;
                CollisionBox.Height = 0;

                if (!isRemoved)
                {
                    if (!ExplosionAnim.AnimationFinnished)
                    {
                        isExplosion = true;
                    }
                    else
                    {
                        isExplosion = false;
                    }

                    if (isExplosion)
                    {
                        Speed = 1f;
                        ExplosionAnim.UpdateAnimation(0.6f);
                        ExplosionAnim.Draw(sB, Position);
                    }
                }
            }
        }
Exemple #7
0
        public void Draw(SpriteBatch sB)
        {
            foreach (Bullet bullet in BulletList)
            {
                bullet.Draw(sB);
            }

            if (isWarpIn)
            {
                if (!WarpInEffect.AnimationFinnished)
                {
                    WarpInSFXIns.Play();
                    WarpInEffect.UpdateAnimation(0.4f);
                    WarpInEffect.Draw(sB, new Vector2(Position.X, Position.Y), MathHelper.ToRadians(270));
                }
            }

            if (isAlive)
            {
                switch (_spriteType)
                {
                case ESpriteType.BASIC:
                {
                    Sprite.Draw(sB, Position, Rotation);
                    CollisionBox = new Rectangle((int)Position.X - Sprite.Width / 2, (int)Position.Y - Sprite.Height / 2, Sprite.Width, Sprite.Height);
                }; break;

                case ESpriteType.ANIM:
                {
                    SpriteAnim.Draw(sB, Position, Rotation);
                    CollisionBox = new Rectangle((int)Position.X - SpriteAnim.Width / 2, (int)Position.Y - SpriteAnim.Height / 2, SpriteAnim.Width, SpriteAnim.Height);
                }; break;
                }

                if (DebugMode)
                {
                    sB.Draw(CollisionBoxTexture, CollisionBox, Color.White);
                }
            }
            else
            {
                CollisionBox.X      = -100;
                CollisionBox.Y      = -100;
                CollisionBox.Width  = 0;
                CollisionBox.Height = 0;

                if (!isRemoved)
                {
                    if (!ExplosionAnim.AnimationFinnished)
                    {
                        isExplosion = true;
                    }
                    else
                    {
                        isExplosion = false;
                    }

                    if (isExplosion)
                    {
                        ExplosionSFXIns.Play();
                        Speed = 0;
                        ExplosionAnim.UpdateAnimation(0.5f);
                        ExplosionAnim.Draw(sB, Position);
                        ShockWaveAnim.UpdateAnimation(0.5f);
                        ShockWaveAnim.Draw(sB, Position);
                        if (Score != 0)
                        {
                            DisplayScore.Draw(sB, Score.ToString(), Position, .5f, Color.White);
                        }
                    }
                }
            }
        }