Advertisement
Cinestra

Project 3 StudentWorld.h Progress 2

Jun 2nd, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #ifndef STUDENTWORLD_H_
  2. #define STUDENTWORLD_H_
  3.  
  4. #include "GameWorld.h"
  5. #include "Board.h"
  6. #include <string>
  7.  
  8. #include "Actor.h"
  9. #include <vector>
  10.  
  11. // Students: Add code to this file, StudentWorld.cpp, Actor.h, and Actor.cpp
  12.  
  13. class StudentWorld : public GameWorld
  14. {
  15. public:
  16. StudentWorld(std::string assetPath);
  17. ~StudentWorld();
  18.  
  19. void add_actor(Actor* actor)
  20. {
  21. m_actors.push_back(actor);
  22. }
  23.  
  24. bool is_empty_square(int x, int y)
  25. {
  26. return m_board->getContentsOf(x/SPRITE_WIDTH, y/SPRITE_HEIGHT) == Board::empty;
  27. }
  28.  
  29. void get_players_on_square(std::set<Player*>& players_on_square, int x, int y);
  30. Actor* get_random_square(int x, int y);
  31. Player* get_other_player(Player* player)
  32. {
  33. return (player == m_peach ? m_yoshi : m_peach);
  34. }
  35.  
  36. virtual int init();
  37. virtual int move();
  38. virtual void cleanUp();
  39.  
  40. private:
  41. std::vector<Actor*> m_actors;
  42. Board* m_board;
  43. Player* m_peach;
  44. Player* m_yoshi;
  45. };
  46.  
  47. #endif // STUDENTWORLD_H_
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement