Advertisement
zCool

Character.cpp

May 20th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include "Character.h"
  2. #include "Entity.h"
  3. #include <string>
  4.  
  5.  
  6. Character::Character(int X, int Y, std::string sprite, int score):
  7. Entity(X, Y, sprite),
  8. m_score(score)
  9. {
  10. }
  11.  
  12. void Character::move(Character::directions direction)
  13. {
  14.     switch(direction)
  15.     {
  16.     case EAST:
  17.       //implement moving east
  18.         m_X++;
  19.         break;
  20.     case WEST:
  21.       //implement moving west
  22.         m_X--;
  23.         break;
  24.     case NORTH:
  25.       //implement moving north
  26.         m_Y--;
  27.         break;
  28.     case SOUTH:
  29.       //implement moving south
  30.         m_Y++;
  31.         break;
  32.     }
  33.  
  34. }
  35.  
  36. void Character::undoMove(Character::directions direction)
  37. {
  38.     switch(direction)
  39.     {
  40.     case EAST:
  41.       //implement undoing moving east
  42.         m_X--;
  43.         break;
  44.     case WEST:
  45.       //implement undoing moving west
  46.         m_X++;
  47.         break;
  48.     case NORTH:
  49.       //implement undoing moving north
  50.         m_Y++;
  51.         break;
  52.     case SOUTH:
  53.       //implement undoing moving south
  54.         m_Y--;
  55.         break;
  56.     }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement