Bullet.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * one room arena
  3. * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include <SFML/Graphics.hpp>
  19. using namespace sf;
  20. class Map;
  21. class Player;
  22. class Bullet: public RectangleShape
  23. {
  24. public:
  25. Bullet(Vector2f position, float angle, int strength);
  26. void registerMap(Map* map);
  27. void registerSelf(Player* player);
  28. void update(float delta);
  29. bool isDead() const;
  30. bool isExplosive() const;
  31. void setColor(Color color);
  32. void madeByPlayer();
  33. protected:
  34. bool _explosive;
  35. float _speed;
  36. private:
  37. Map* _map;
  38. Player* _self;
  39. bool _dead;
  40. int _strength;
  41. bool _madeByPlayer;
  42. };
  43. class RectBullet: public Bullet
  44. {
  45. public:
  46. RectBullet(Vector2f position, float angle, int strength);
  47. };
  48. class NukeBullet: public Bullet
  49. {
  50. public:
  51. NukeBullet(Vector2f position, float angle, int strength);
  52. private:
  53. Texture _badlyAllocatedTexture;
  54. };