Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Character.h"
- #include "Entity.h"
- #include <string>
- Character::Character(int X, int Y, std::string sprite, int score):
- Entity(X, Y, sprite),
- m_score(score)
- {
- }
- void Character::move(Character::directions direction)
- {
- switch(direction)
- {
- case EAST:
- //implement moving east
- m_X++;
- break;
- case WEST:
- //implement moving west
- m_X--;
- break;
- case NORTH:
- //implement moving north
- m_Y--;
- break;
- case SOUTH:
- //implement moving south
- m_Y++;
- break;
- }
- }
- void Character::undoMove(Character::directions direction)
- {
- switch(direction)
- {
- case EAST:
- //implement undoing moving east
- m_X--;
- break;
- case WEST:
- //implement undoing moving west
- m_X++;
- break;
- case NORTH:
- //implement undoing moving north
- m_Y++;
- break;
- case SOUTH:
- //implement undoing moving south
- m_Y--;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement