Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8169 in orxonox.OLD


Ignore:
Timestamp:
Jun 6, 2006, 2:05:33 AM (18 years ago)
Author:
patrick
Message:

cr: using a new damage structure for dealing damage. working

Location:
branches/cr/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/lib/collision_reaction/cr_object_damage.cc

    r8168 r8169  
    6060  // the collision damage been dealed by the entity
    6161  if( collision->isEntityACollide()) {
    62     damage = collision->getEntityB()->getHealthMax();
     62    damage = collision->getEntityB()->getDamage();
    6363    collision->getEntityA()->decreaseHealth(damage);
    6464  }
     
    6666
    6767  if( collision->isEntityBCollide()) {
    68     damage = collision->getEntityA()->getHealthMax();
     68    damage = collision->getEntityA()->getDamage();
    6969    collision->getEntityB()->decreaseHealth(damage);
    7070  }
  • branches/cr/src/world_entities/projectiles/projectile.cc

    r7460 r8169  
    3838  this->target = NULL;
    3939  this->removeNode();
     40
     41  /* character attributes */
     42  this->setHealth(1.0f);
     43  this->setDamage(100.0f); // default damage of a projectile set to 100.0 damage points
    4044
    4145  this->explosionBuffer = NULL;
  • branches/cr/src/world_entities/world_entity.cc

    r8168 r8169  
    6161  this->healthMax = 1.0f;
    6262  this->health = 1.0f;
     63  this->damage = 0.0f; // no damage dealt by a default entity
    6364  this->scaling = 1.0f;
    6465
  • branches/cr/src/world_entities/world_entity.h

    r8106 r8169  
    106106
    107107  /* --- Character Attribute Block --- */
     108  /** @returns the damage dealt by this world entity */
     109  float getDamage() const { return this->damage; }
     110  /** sets the damage dealt to @param damage damage per second */
     111  void setDamage(float damage) { this->damage = damage; }
    108112  /** @returns the Energy of the entity */
    109113  float getHealth() const { return this->health; };
     
    142146private:
    143147  /// TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
     148  float                   damage;             //!< the damage dealt to other objects by colliding.
    144149  float                   health;             //!< The Energy of this Entity, if the Entity has any energy at all.
    145150  float                   healthMax;          //!< The Maximal energy this entity can take.
Note: See TracChangeset for help on using the changeset viewer.