コード例 #1
0
        public void Draw(SpriteBatch sprite)
        {
            if (explosionTimer > 0)
            {
                sprite.Draw(turretPic, turretPosition, null, Color.White, turretAngle, turretOrigin, 1.0f, SpriteEffects.None, 0.0f);
                sprite.Draw(tankPic, tankPosition, Color.White);
            }

            if (showPreviousShotLine)
            {
                TankGame.spriteBatch.Draw(previousShotLine, previousShotPosition, Color.White);
            }

            if (bullet.type != BulletType.NullBullet)
            {
                bullet.Draw();
            }
        }
コード例 #2
0
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black); //фон
     foreach (BaseObject obj in objs)
     {
         obj.Draw(Buffer.Graphics);
     }
     foreach (BaseObject obj in asteroids)
     {
         obj.Draw(Buffer.Graphics);
     }
     bullet?.Draw(Buffer.Graphics);
     ship.Draw(Buffer.Graphics);
     if (ship != null)
     {
         Buffer.Graphics.DrawString($"Energy: {ship.Energy}", SystemFonts.DefaultFont, Brushes.White, 0, 0);
     }
     Buffer.Render(); //перерисование
 }