示例#1
0
        public Form1()
        {
            InitializeComponent();

            g = this.CreateGraphics();

            blue   = new SolidBrush(Color.Blue);
            yellow = new SolidBrush(Color.Yellow);
            red    = new SolidBrush(Color.Red);
            white  = new SolidBrush(Color.White);
            green  = new SolidBrush(Color.Green);

            timer1.Enabled  = true;
            timer1.Interval = 10;
            timer2.Enabled  = true;
            timer2.Interval = 1;
            timer2.Enabled  = false;
            timer2.Interval = 1000;
            //draw.Space(0, 0, this.Width, this.Height);


            // ship = new SpaceShip(492, 325);
            star.Draw(x1 - 450, y1 - 190);
            star.Draw(x1 - 100, y1 - 240);
            star.Draw(x1 + 150, y1 - 200);
            star.Draw(x1 + 380, y1 - 25);
            star.Draw(x1 + 270, y1 + 100);
            star.Draw(x1 + 364, y1 + 270);
            star.Draw(x1 - 120, y1 + 200);
            star.Draw(x1 - 430, y1 + 210);


            bul = new Bullet();

            gun = new Gun(432, 325);

            asters.Draw(180, 200);
            asters.Draw(220, 450);
            asters.Draw(800, 170);
            asters.Draw(610, 510);


            label1.Text = "Level: 1 Score: 200  Live: ***";
        }
示例#2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();

            //игра
            Background.Draw(spriteBatch);
            Player.Draw(spriteBatch);
            _asteroid1.Draw(spriteBatch);
            _asteroid2.Draw(spriteBatch);
            _asteroid3.Draw(spriteBatch);
            _asteroid4.Draw(spriteBatch);
            _asteroid5.Draw(spriteBatch);
            _bonusHeals.Draw(spriteBatch);

            spriteBatch.End();
            base.Draw(gameTime);
        }