- Timestamp:
- Jun 11, 2013, 1:24:09 AM (12 years ago)
- Branches:
- master
- Children:
- 5b1e31e
- Parents:
- 11d21ee
- Location:
- common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
r11d21ee rff2133a 191 191 return moving; 192 192 } 193 194 void Player::updateTarget(map<unsigned int, Player>& mapPlayers) { 195 if (this->isChasing) { 196 this->target.x = mapPlayers[this->targetPlayer].pos.x; 197 this->target.y = mapPlayers[this->targetPlayer].pos.y; 198 199 if (posDistance(this->pos, this->target.toFloat()) <= this->range) { 200 this->target.x = this->pos.x; 201 this->target.y = this->pos.y; 202 203 this->isChasing = false; 204 this->isAttacking = true; 205 this->timeAttackStarted = getCurrentMillis(); 206 } 207 } 208 } -
common/Player.h
r11d21ee rff2133a 12 12 13 13 #include <string> 14 #include <map> 14 15 15 16 #include "Common.h" … … 46 47 void deserialize(char* buffer); 47 48 49 void updateTarget(map<unsigned int, Player>& mapPlayers); 48 50 bool move(WorldMap *map); 49 51 50 void takeFlag(int flag, WorldMap *map);51 void dropFlag(int flag, WorldMap *map);52 void takeFlag(int flag, WorldMap* map); 53 void dropFlag(int flag, WorldMap* map); 52 54 53 55 int id; -
common/Projectile.cpp
r11d21ee rff2133a 72 72 73 73 bool Projectile::move(map<unsigned int, Player>& mapPlayers) { 74 // if the current target logs off, this method will run into problems 75 76 //cout << "Inside projectile move" << endl; 77 74 78 unsigned long long curTime = getCurrentMillis(); 75 79 Player targetP = mapPlayers[target]; … … 85 89 float dist = sqrt(pow(targetP.pos.x-pos.x, 2) + pow(targetP.pos.y-pos.y, 2)); 86 90 91 //cout << "About to finish projectile move" << endl; 92 87 93 if (dist <= pixels) { 88 94 pos.x = targetP.pos.x;
Note:
See TracChangeset
for help on using the changeset viewer.