Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3. using Microsoft.Xna.Framework.Input;
  4. using System;
  5.  
  6. namespace Breakout
  7. {
  8. public class Paddle : Game
  9. {
  10. public float velocity;
  11. public float acceleration;
  12. float speed;
  13. int score;
  14. int lives;
  15.  
  16. int width;
  17. int height;
  18.  
  19. public Vector2 position = new Vector2(0, 0);
  20. public int direction;
  21.  
  22. // bool left;
  23. // bool right;
  24.  
  25. Rectangle screenBounds;
  26.  
  27.  
  28. public Paddle(float speed, int lives, int width, int height, Rectangle screenBounds)
  29. {
  30. this.speed = speed;
  31. this.lives = lives;
  32. this.width = width;
  33. this.height = height;
  34. this.screenBounds = screenBounds;
  35. }
  36.  
  37. public void Update(GameTime gameTime)
  38. {
  39. //MouseState mouse = Mouse.GetState();
  40. var delta = (float)gameTime.ElapsedGameTime.TotalSeconds * 600;
  41. /*left = Keyboard.GetState().IsKeyDown(Keys.A);
  42. right = (Keyboard.GetState().IsKeyDown(Keys.D));
  43. // Input
  44. if (!left && !right) direction = 0;
  45. else if (left && !right) direction = -1;
  46. else if (right && !left) direction = 1;*/
  47.  
  48. // Movement
  49. //this.position.X = mouse.X;
  50. }
  51.  
  52. // Death method
  53. public void Die()
  54. {
  55. if (lives > 0) lives--;
  56. }
  57.  
  58. // Return # of lives
  59. public int Lives()
  60. {
  61. return lives;
  62. }
  63.  
  64. // Calculate score
  65. public void Score(int points)
  66. {
  67. score += points;
  68. }
  69.  
  70. // Return the score
  71. public int GetScore()
  72. {
  73. return score;
  74. }
  75.  
  76. public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color)
  77. {
  78. // Draw a rectangle of int width by int height
  79. C3.MonoGame.Primitives2D.FillRectangle(spriteBatch, position, new Vector2(width, height), color);
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement