コード例 #1
0
 public override void Draw(Vector2 OFFSET)
 {
     if (!isdead)    //nếu chưa chết hẳn
     {
         if (triggeredSwift)
         {
             swiftaura.Draw(new Vector2(this.pos.X, this.pos.Y));
         }
         base.Draw(OFFSET);
         cursor.Draw(new Vector2(Global.mouse.newMousePos.X, Global.mouse.newMousePos.Y), new Vector2(25, 25));
     }
     if (GameGlobal.triggerinvinsible && !isdead)
     {
         spawncircle.Draw(new Vector2(this.pos.X, this.pos.Y));
     }
     for (int i = 0; i < life; i++)  //quản lí số mạng
     {
         herolife[i].Draw(new Vector2(this.pos.X - 600 + i * 50, this.pos.Y - 260));
     }
     if (GameGlobal.obtainnuclearbomb)
     {
         nuclearbomb.Draw(new Vector2(this.pos.X - 400, this.pos.Y - 245));
     }
 }
コード例 #2
0
ファイル: World.cs プロジェクト: Thangnguyen11/DOAN
        public virtual void Draw(Vector2 OFFSET)
        {
            bg.Draw();
            Ship.Draw(offset);

            if (delayspawnboss == 299)
            {
                Global.soundcontrol.PLaySound("BossWarningSound");
            }

            if (delayspawnboss <= 299 && delayspawnboss >= 10)
            {
                Global.spriteBatch.DrawString(Global.gamefont, "            WARNING     \n Get Out Of The Center", new Vector2(Ship.pos.X - 250, Ship.pos.Y - 250), Color.Red, 0, new Vector2(0, 0), 3.2f, new SpriteEffects(), 0);
            }

            if (orbspawn)
            {
                Random rand    = new Random();
                int    orbposx = rand.Next(300, 3700); //300 3700
                int    orbposy = rand.Next(300, 3700); //300 3700
                orbs.Add(new MysteryItem(new Vector2(orbposx, orbposy)));
                orbspawn = false;
            }

            if (Ship.currenthealth > 0)
            {
                healthbar.Draw(new Vector2(Ship.pos.X + (Ship.dims.X / 2) - Global.screenwidth / 2 + 50, Ship.pos.Y + (Ship.dims.Y / 2) - Global.screenheight / 2 + 20));
                manabar.Draw(new Vector2(Ship.pos.X + (Ship.dims.X / 2) - Global.screenwidth / 2 + 50, Ship.pos.Y + (Ship.dims.Y / 2) - Global.screenheight / 2 + 55));
            }

            #region Draw Loops
            for (int i = 0; i < orbs.Count; i++)
            {
                orbs[i].Draw();
            }
            for (int i = 0; i < projectiles.Count; i++)
            {
                projectiles[i].Draw(offset);
            }
            for (int i = 0; i < gunnerProjectiles.Count; i++)
            {
                gunnerProjectiles[i].Draw(offset);
            }
            for (int i = 0; i < spawnPoints.Count; i++)
            {
                spawnPoints[i].Draw(offset);
            }
            for (int i = 0; i < mobs.Count; i++)
            {
                mobs[i].Draw(offset);
            }
            for (int i = 0; i < listBOOM.Count; i++)
            {
                if (explosivetimer[i] <= 15)
                {
                    //Global.spriteBatch.DrawString(Global.gamefont, Ship.UnrealAttack.ToString(), listBOOM[i].pos + new Vector2(0,50), Color.Red);
                    listBOOM[i].Draw();
                }
            }
            #endregion
            #region Draw boss
            if (bosses.Count > 0)
            {
                if (bosses[0].isappear && !bosses[0].isdead)
                {
                    bosses[0].Draw(offset);
                }
                if (bosses[0].bossname == "fatboiz")
                {
                    for (int i = 0; i < fatboizProjectiles.Count; i++)
                    {
                        fatboizProjectiles[i].Draw(offset);
                    }
                }
                else if (bosses[0].bossname == "blitz")
                {
                    for (int i = 0; i < blitzHands.Count; i++)
                    {
                        blitzHands[i].Draw(offset);
                    }
                }
                else if (bosses[0].bossname == "cable")
                {
                }
                if (bosses[0].currenthealth > 0)
                {
                    bosshealthbar.Draw(new Vector2(Ship.pos.X + (Ship.dims.X / 2) - Global.screenwidth / 2 + 300, Ship.pos.Y + (Ship.dims.Y / 2) - Global.screenheight / 2 + 680));
                }
            }
            #endregion

            scoreimg.Draw(new Vector2(Ship.pos.X + 450, Ship.pos.Y - 300));
            Global.spriteBatch.DrawString(Global.gamefont, GameGlobal.highscrore.ToString(), new Vector2(Ship.pos.X + 535, Ship.pos.Y - 325), Color.CadetBlue, 0, new Vector2(0, 0), 4, new SpriteEffects(), 0);
            Global.spriteBatch.DrawString(Global.gamefont, ((int)Ship.currenthealth).ToString() + "/" + Ship.maxhealth.ToString(), new Vector2(Ship.pos.X, Ship.pos.Y - 337), Color.CadetBlue, 0, new Vector2(0, 0), 2, new SpriteEffects(), 0);
            //Global.spriteBatch.DrawString(Global.gamefont, "GameTime: " + GameGlobal.gametimepassed.ToString(), new Vector2(Ship.pos.X + 550, Ship.pos.Y - 250), Color.CadetBlue);

            Global.spriteBatch.DrawString(Global.gamefont, "Speed: " + Ship.speed.ToString(), new Vector2(Ship.pos.X - 620, Ship.pos.Y - 235), Color.CadetBlue);
            Global.spriteBatch.DrawString(Global.gamefont, "Attack: " + Ship.UnrealAttack.ToString(), new Vector2(Ship.pos.X - 620, Ship.pos.Y - 215), Color.CadetBlue);
            Global.spriteBatch.DrawString(Global.gamefont, "Crit Chance: " + Ship.critchance.ToString(), new Vector2(Ship.pos.X - 620, Ship.pos.Y - 195), Color.CadetBlue);

            if (GameGlobal.whattrigger != "")
            {
                Global.spriteBatch.DrawString(Global.gamefont, GameGlobal.whattrigger, new Vector2(Ship.pos.X - 50, Ship.pos.Y - 100), Color.White);
                lbltrigger--;
            }
            if (lbltrigger == 0)
            {
                GameGlobal.whattrigger = "";
            }



            if (Ship.isdead)
            {
                imageGameOver.Draw();
                Global.spriteBatch.DrawString(Global.gamefont, "                         \n PRESS R TO PLAY AGAIN  \n            ESC TO EXIT", new Vector2(Ship.pos.X - 250, Ship.pos.Y), Color.Red, 0, new Vector2(0, 0), 3.2f, new SpriteEffects(), 0);
            }

            if (checkpause && !Ship.isdead)
            {
                imagePause.Draw();
            }
        }
コード例 #3
0
ファイル: Bar.cs プロジェクト: Thangnguyen11/DOAN
 public virtual void Draw(Vector2 OFFSET)
 {
     healthbarbg.Draw(OFFSET, new Vector2(1, 1));
     healthbar.Draw(OFFSET, new Vector2(1, 1));
 }