Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Power
- {
- Color color;
- Texture2D BlankTexture;
- int powerLevel;
- public int PowerLevel
- {
- get { return powerLevel; }
- set {
- if (value < 20) color = Color.Red;
- powerLevel = value > 100 ? 100 : value < 0 ? 0 : value; }
- }
- public Power(Texture2D texture)
- {
- BlankTexture = texture;
- powerLevel = 0;
- color = new Color(80,80,855);
- }
- public void Draw(SpriteBatch spritebatch, Vector2 position)
- {
- spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 5, (int)position.Y + 82, 100 + 6, 10 + 4), null, Color.Black);
- spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 6, (int)position.Y + 83, 100 + 4, 10 + 2), null, Color.White);
- spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 7, (int)position.Y + 84, 100 + 2, 10), null, Color.Black);
- spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 8, (int)position.Y + 85, powerLevel, 10 - 2), null, color);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment