Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CMapTile
- {
- public:
- enum eMapTileType
- {
- E_UNKNOWN = 0,
- E_FREE,
- E_WALL,
- E_ALL
- };
- CMapTile();
- virtual ~CMapTile();
- uint8_t GetType();
- uint8_t IsBlocking();
- uint8_t GetSymbol();
- protected:
- uint8_t m_uiType;
- uint8_t m_uiBlocking;
- uint8_t m_uiSymbol;
- };
- #include "CMapTile.hpp"
- class CMap
- {
- public:
- CMap();
- void Init(const uint8_t& ruiWidth, const uint8_t& ruiHeight);
- void Generate();
- void Print();
- CMapTile GetTile(const uint8_t& ruiX, const uint8_t& ruiY) const;
- private:
- uint8_t m_uiWidth;
- uint8_t m_uiHeight;
- std::vector<CMapTile> m_vTiles;
- };
- // MapTile on the right blocking? - this is a call to CMap object
- // Is there any entity on the right? - this is a call to EntitiesManager object
- // Move player if both FALSE - move the player right
- class CMapTile
- {
- public:
- enum eMapTileType
- {
- E_UNKNOWN = 0,
- E_FREE,
- E_WALL,
- E_ALL
- };
- CMapTile();
- virtual ~CMapTile();
- uint8_t GetType();
- uint8_t IsBlocking();
- uint8_t GetSymbol();
- int GetEntityID();
- protected:
- uint8_t m_uiType;
- uint8_t m_uiBlocking;
- uint8_t m_uiSymbol;
- int m_iEntityID; // <<<<<<<-----
- };
- // Obtain tile to the right
- CMapTile *pTile = m_Map->GetTile(PlayerX+1,PlayerY);
- // Check if blocking
- if(pTile->IsBlocking() == false)
- {
- // Update Player Pos to Tile position
- pPlayer->SetPosition(pTile->GetPosX(), pTile->GetPosY());
- // Update Map Entity Id for this Tile
- _Tile->SetEntityId(pPlayer->GetID());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement