Skip to content

Instantly share code, notes, and snippets.

@rosswarren
Created March 13, 2011 02:44
Show Gist options
  • Save rosswarren/867822 to your computer and use it in GitHub Desktop.
Save rosswarren/867822 to your computer and use it in GitHub Desktop.
GraphicsDevice.Clear(Color.CornflowerBlue);
GraphicsDevice.Clear(Color.Black);
private int screenWidth;
private int screenHeight;
screenWidth = 800;
screenHeight = 600;
graphics.PreferredBackBufferWidth = screenWidth;
graphics.PreferredBackBufferHeight = screenHeight;
graphics.ApplyChanges();
public Bat(ContentManager content, Vector2 screenSize, bool side)
{
moveSpeed = 6;
points = 0;
texture = content.Load<Texture2D>("bat");
size = new Rectangle(0, 0, texture.Width, texture.Height);
if (side) position = new Vector2(30, screenSize.Y / 2 - size.Height / 2);
else position = new Vector2(screenSize.X - 30 - size.Width, screenSize.Y / 2 - size.Height / 2);
yHeight = (int)screenSize.Y;
}
private Vector2 position;
private int moveSpeed;
private Rectangle size;
private int points;
private int yHeight;
private Texture2D texture;
private Bat rightBat;
private Bat leftBat;
rightBat = new Bat(Content, new Vector2(screenWidth, screenHeight), false);
leftBat = new Bat(Content, new Vector2(screenWidth, screenHeight), true);
public void Draw(SpriteBatch batch)
{
batch.Draw(texture, position, Color.White);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment