説明なし

obstacle.cpp 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "obstacle.h"
  2. ///
  3. /// Default constructor. The properties of the obstacles are set as follows:
  4. /// * x_cone: x coordinates where the obstacle will be placed
  5. /// * y_cone: y coordinates where the obstacle will be placed
  6. ///
  7. Obstacle::Obstacle(QWidget *parent) :
  8. QWidget(parent)
  9. {
  10. x_obstacle=300;
  11. y_obstacle=250;
  12. name = ":/resources/cone.png" ;
  13. }
  14. ///
  15. /// Setter for the obstacle picture
  16. ///
  17. void Obstacle::setObs(string arg){
  18. if(arg == "cone") name = ":/resources/cone.png";
  19. else if (arg == "hole") name = ":/resources/hoyo.png";
  20. else if(arg == "monster") name = ":/resources/monster.png";
  21. else if(arg == "zombie") name = ":/resources/zombie.png";
  22. else if(arg == "it") name = ":/resources/it.png";
  23. else if(arg == "spongebob") name = ":/resources/spongebob.png";
  24. else if(arg == "patrick") name = ":/resources/patrick.png";
  25. }
  26. ///
  27. /// Getter for the obstacle picture
  28. ///
  29. string Obstacle::getObs(){
  30. return name;
  31. }
  32. ///
  33. /// Setter for the X coordinate
  34. ///
  35. void Obstacle::setXObstacle(int arg){
  36. x_obstacle = arg;
  37. }
  38. ///
  39. /// Setter for the Y coordinate
  40. ///
  41. void Obstacle::setYObstacle(int arg){
  42. y_obstacle = arg;
  43. }
  44. ///
  45. /// Getter for the X coordinate
  46. ///
  47. int Obstacle::getXObstacle(){
  48. return x_obstacle;
  49. }
  50. ///
  51. /// Getter for the Y coordinate
  52. ///
  53. int Obstacle::getYObstacle(){
  54. return y_obstacle;
  55. }