Changeset 6054f1e in network-game for common/Player.cpp


Ignore:
Timestamp:
Jan 7, 2014, 1:07:36 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
d05c484
Parents:
eb2ad4f
Message:

Moved damagePlayer to the Player class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Player.cpp

    reb2ad4f r6054f1e  
    206206}
    207207
     208void Player::takeDamage(int damage) {
     209   this->health -= damage;
     210   if (this->health < 0)
     211      this->health = 0;
     212   if (this->health == 0) {
     213      cout << "Player died" << endl;
     214      this->isDead = true;
     215      this->timeDied = getCurrentMillis();
     216   }
     217}
     218
    208219bool Player::updateTarget(map<unsigned int, Player*>& mapPlayers) {
    209220   if (this->isChasing) {
Note: See TracChangeset for help on using the changeset viewer.