示例#1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            _spriteBatch.Begin();
            _spriteBatch.Draw(background, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, _scale, SpriteEffects.None, 0f);

            _spriteBatch.Draw(enemy.GetAsset(), new Vector2(enemy.GetxPosition(), enemy.GetyPosition()), null, Color.White, 0f, new Vector2(enemy.GetAsset().Width / 2, enemy.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(enemy.GetAsset(), new Vector2(enemy2.GetxPosition(), enemy2.GetyPosition()), null, Color.White, 0f, new Vector2(enemy2.GetAsset().Width / 2, enemy2.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(enemy.GetAsset(), new Vector2(enemy3.GetxPosition(), enemy3.GetyPosition()), null, Color.White, 0f, new Vector2(enemy3.GetAsset().Width / 2, enemy3.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(enemy.GetAsset(), new Vector2(enemy4.GetxPosition(), enemy4.GetyPosition()), null, Color.White, 0f, new Vector2(enemy4.GetAsset().Width / 2, enemy4.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(enemy.GetAsset(), new Vector2(enemy5.GetxPosition(), enemy5.GetyPosition()), null, Color.White, 0f, new Vector2(enemy5.GetAsset().Width / 2, enemy5.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(treasure.GetAsset(), new Vector2(treasure.GetxPosition(), treasure.GetyPosition()), null, Color.White, 0f, new Vector2(treasure.GetAsset().Width / 2, treasure.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.Draw(player.GetAsset(), new Vector2(player.GetxPosition(), player.GetyPosition()), null, Color.White, 0f, new Vector2(player.GetAsset().Width / 2, player.GetAsset().Height / 2), _scale, SpriteEffects.None, 0f);
            _spriteBatch.DrawString(levelText.GetText(), $"Level   {game.GetPlayerLevel()}", new Vector2(levelText.GetxPosition(), levelText.GetyPosition()), Color.White);
            _spriteBatch.End();

            base.Draw(gameTime);
        }