Expansion.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "Expansion.h"
  2. Expansion::Expansion(SDL_Surface *screen, Collisions *gestionnaireCollisons, Sounderer *mediaPlayer, SDL_Surface* apparence)
  3. : Power(screen, gestionnaireCollisons, mediaPlayer, apparence)
  4. {
  5. }///Constructeur
  6. Expansion::~Expansion()
  7. {
  8. }///Destructeur
  9. void Expansion::usePower(int orientation, int &x, int &y, int const &ID)
  10. {
  11. //[0] Bruitage
  12. m_mediaPlayer->play("Expansion");
  13. //[1] Paramètres
  14. int portee(5);
  15. int const posX(x);
  16. int const posY(y);
  17. //[2] Epandage
  18. if (orientation==HAUT || orientation==BAS)
  19. {//Epandage horizontal
  20. for (int i(-portee); i <= portee; i++)
  21. m_gestionnaireCollisions->ajouter(posX+i, posY, ID);
  22. }
  23. else
  24. {//Epandage vertical
  25. for (int i(-portee); i <= portee; i++)
  26. m_gestionnaireCollisions->ajouter(posX, posY+i, ID);
  27. }
  28. //[END]
  29. m_used = true;
  30. }///usePower
  31. void Expansion::postMortemPower(int const &x, int const &y, int const &ID)
  32. {
  33. //[0] Bruitage
  34. m_mediaPlayer->play("Expansion");
  35. //[1] Etalage
  36. for (int i(0); i<3; i++)
  37. for (int j(0); j<3;j++)
  38. m_gestionnaireCollisions->ajouter(x-1+i, y-1+j, ID);
  39. //[END]
  40. m_used = true;
  41. }///postMortemPower