player.hpp 943 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* This file is part of Invaders.
  2. *
  3. * Copyright (C) 2020 LCM.
  4. * You may use, distribute and modify Invaders under the terms of the
  5. * GPLv3 license, available at <https://www.gnu.org/licenses/\>.
  6. */
  7. #ifndef _player_
  8. #define _player_
  9. #include "game_object.hpp"
  10. #include "rocket.hpp"
  11. #include "definitions.hpp"
  12. #include <list>
  13. class player : public game_object
  14. {
  15. public:
  16. player(); //default constructor: creates a 8-long player in C/2,R
  17. player(int); //user-defined length constructor
  18. ~player() {}
  19. void next_pos(int command); //moves player according to command (WASD or arrow keys)
  20. void shoot(std::list<bullet> &); //adds a new bullet to the list
  21. void shootrkt(std::list<rocket> &);
  22. void set_commands(int* _commands);
  23. int weaponclass;
  24. int weaponclassrkt;
  25. int length;
  26. bool rocketlauncher; //when rocketlauncher is TRUE, player can shoot rockets.
  27. int commands[4];
  28. bool godmode;
  29. };
  30. #endif