我试图让我的精灵显示出来。有人能帮忙吗?拜托,谢谢。
protected override void LoadContent()
{
demImg = Content.Load<Texture2D>("Images/Sprites/Demon");
demrect = new Rectangle[rows, cols];
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
demrect[r, c].Width = demImg.Width;
demrect[r, c].Width = demImg.Height;
demrect[r, c].X = 50 * c;
demrect[r, c].Y = 50 * r;
}
}
spriteBatch.Begin();
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
spriteBatch.Draw(demImg, demrect[r, c], Color.White);
}
}
}
当我运行程序时,唯一显示的是我的背景。