Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef GRIDWORLD_H
- #define GRIDWORLD_H
- #include <string>
- #include <iostream>
- namespace gridworld {
- class Tile {
- //Knows if the player can walk here (i.e. not a wall)
- //Knows if something happens on this square
- //Model class
- public:
- //These really should be private, with getters and setters
- bool wall;
- bool event;
- std::string eventText;
- Tile(bool w, bool e, std::string eText);
- Tile(bool w);
- Tile();
- };
- class Map {
- //Handles map, character location, and knows what should happen at each map location
- //Model class
- public:
- Tile map[8][8]; // [0][0] is top left, [7][0] is top right, etc.
- int charX;
- int charY;
- Map();
- std::string possibleExits();
- bool legalExit(int x, int y);
- bool legalExit(char dir);
- void moveChar(char dir);
- bool finish() {
- return map[charX][charY].event;
- }
- std::string finishEvent();
- };
- class Display {
- //currently outputs what is happening and what exits are available
- //will display the current square and every adjacent square
- //View class
- public:
- Display() {
- }
- void exits(Map map);
- void finish(Map map);
- void intro();
- void quit();
- };
- class InputManager {
- //handles input, asks Model what should happen and acts on it
- //Control class
- public:
- InputManager() {
- }
- bool runTurn(Map map);
- };
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement