Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- using System;
- namespace Breakout
- {
- public class Paddle : Game
- {
- public float velocity;
- public float acceleration;
- float speed;
- int score;
- int lives;
- int width;
- int height;
- public Vector2 position = new Vector2(0, 0);
- public int direction;
- // bool left;
- // bool right;
- Rectangle screenBounds;
- public Paddle(float speed, int lives, int width, int height, Rectangle screenBounds)
- {
- this.speed = speed;
- this.lives = lives;
- this.width = width;
- this.height = height;
- this.screenBounds = screenBounds;
- }
- public void Update(GameTime gameTime)
- {
- //MouseState mouse = Mouse.GetState();
- var delta = (float)gameTime.ElapsedGameTime.TotalSeconds * 600;
- /*left = Keyboard.GetState().IsKeyDown(Keys.A);
- right = (Keyboard.GetState().IsKeyDown(Keys.D));
- // Input
- if (!left && !right) direction = 0;
- else if (left && !right) direction = -1;
- else if (right && !left) direction = 1;*/
- // Movement
- //this.position.X = mouse.X;
- }
- // Death method
- public void Die()
- {
- if (lives > 0) lives--;
- }
- // Return # of lives
- public int Lives()
- {
- return lives;
- }
- // Calculate score
- public void Score(int points)
- {
- score += points;
- }
- // Return the score
- public int GetScore()
- {
- return score;
- }
- public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color)
- {
- // Draw a rectangle of int width by int height
- C3.MonoGame.Primitives2D.FillRectangle(spriteBatch, position, new Vector2(width, height), color);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement