- Timestamp:
- Dec 20, 2013, 1:41:49 AM (11 years ago)
- Branches:
- master
- Children:
- 6c9bcdd
- Parents:
- fef7c69
- Location:
- common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Game.cpp
rfef7c69 r402cf86 88 88 } 89 89 90 // returns true if the movement should be canceled 91 bool Game::processPlayerMovement(Player* p, FLOAT_POSITION oldPos) { 92 93 // check if the move needs to be canceled 94 switch(this->worldMap->getElement(p->pos.x/25, p->pos.y/25)) 95 { 96 case WorldMap::TERRAIN_NONE: 97 case WorldMap::TERRAIN_OCEAN: 98 case WorldMap::TERRAIN_ROCK: 99 { 100 p->pos = oldPos; 101 p->target.x = p->pos.x; 102 p->target.y = p->pos.y; 103 p->isChasing = false; 104 return true; 105 break; 106 } 107 default: 108 // if there are no obstacles, don't cancel movement 109 return false; 110 break; 111 } 112 } 113 90 114 void Game::setRedScore(int score) { 91 115 this->redScore = score; -
common/Game.h
rfef7c69 r402cf86 42 42 bool removePlayer(unsigned int id); 43 43 bool startPlayerMovement(unsigned int id, int x, int y); 44 bool processPlayerMovement(Player* p, FLOAT_POSITION oldPos); 45 44 46 void setBlueScore(int score); 45 47 void setRedScore(int score);
Note:
See TracChangeset
for help on using the changeset viewer.