MisterEpic

Player.cpp

Apr 6th, 2012
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include "Paddle.h"
  2. #include "HumanPaddle.h"
  3. #include "ComputerPaddle.h"
  4. #include "Player.h"
  5. #include "Human.h"
  6. #include "Computer.h"
  7. #include "Ball.h"
  8.  
  9. #include <SFML/Graphics.hpp>
  10. #include <SFML/Audio.hpp>
  11.  
  12. using namespace sf;
  13.  
  14. Human::Human(RenderWindow * App, int playerID) : Player (App, playerID)
  15. {
  16.     this->paddle = new HumanPaddle(App, playerID);
  17. }
  18.  
  19. Computer::Computer(RenderWindow * App, int playerID, Ball * ball) : Player (App, playerID)
  20. {
  21.     this->paddle = new ComputerPaddle(App, playerID, ball);
  22. }
  23.  
  24. void Player::gainPoint(Sound * ScoreSound)
  25. {
  26.     if (score + 1 <= 99)
  27.         score++;
  28.     ScoreSound->Play();
  29. }
  30.  
  31. void Player::refresh()
  32. {
  33.     paddle->refresh();
  34. }
  35.  
  36. Sprite Player::getPaddleSprite()
  37. {
  38.     return paddle->getSprite();
  39. }
  40.  
  41. Sprite * Player::getPaddleSpriteP()
  42. {
  43.     return paddle->getSpriteP();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment