Created
March 13, 2011 02:44
-
-
Save rosswarren/867822 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GraphicsDevice.Clear(Color.CornflowerBlue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GraphicsDevice.Clear(Color.Black); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int screenWidth; | |
private int screenHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
screenWidth = 800; | |
screenHeight = 600; | |
graphics.PreferredBackBufferWidth = screenWidth; | |
graphics.PreferredBackBufferHeight = screenHeight; | |
graphics.ApplyChanges(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Vector2 position; | |
private int moveSpeed; | |
private Rectangle size; | |
private int points; | |
private int yHeight; | |
private Texture2D texture; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Bat rightBat; | |
private Bat leftBat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rightBat = new Bat(Content, new Vector2(screenWidth, screenHeight), false); | |
leftBat = new Bat(Content, new Vector2(screenWidth, screenHeight), true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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