我是全新的,有一个问题.我在学校和家里做过锻炼,但我无法弄清楚该怎么做.
问题是我想在屏幕上的10个随机位置绘制一个精灵,而不使用特殊的精灵类.我的问题是他们被吸引后会再次消失.
解决了它,感谢所有的帮助!
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D turtleTexture;
int counter = 0;
Random randomera = new Random();
int x;
int y;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
/// <summary>
/// </summary>
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
turtleTexture = Content.Load<Texture2D>(@"Images/turtle_50x38");
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit(); …Run Code Online (Sandbox Code Playgroud)