Changeset 10074 for code/branches/pickupsFS14/src/modules/jump/JumpEnemy.cc
- Timestamp:
- May 22, 2014, 3:05:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpEnemy.cc
r10050 r10074 56 56 RegisterObject(JumpEnemy); 57 57 58 this->figure_ = 0; 58 dead_ = false; 59 figure_ = 0; 60 width_ = 0.0; 61 height_ = 0.0; 62 setPosition(Vector3(0,0,0)); 63 setVelocity(Vector3(0,0,0)); 64 setAcceleration(Vector3(0,0,0)); 59 65 setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 60 this->setPosition(Vector3(0,0,0));61 this->setVelocity(Vector3(0,0,0));62 this->setAcceleration(Vector3(0,0,0));63 66 } 64 67 … … 82 85 { 83 86 SUPER(JumpEnemy, XMLPort, xmlelement, mode); 87 88 XMLPortParam(JumpEnemy, "height", setHeight, getHeight, xmlelement, mode); 89 XMLPortParam(JumpEnemy, "width", setWidth, getWidth, xmlelement, mode); 84 90 } 85 91 … … 116 122 117 123 124 // Interact with Figure 125 Vector3 enemyPosition = getPosition(); 126 127 if (figure_ != NULL) 128 { 129 Vector3 figurePosition = figure_->getPosition(); 130 if(figurePosition.x > enemyPosition.x-width_ && figurePosition.x < enemyPosition.x+width_ && figurePosition.z > enemyPosition.z-height_ && figurePosition.z < enemyPosition.z+height_) 131 { 132 touchFigure(); 133 } 134 } 118 135 } 119 136 … … 141 158 void JumpEnemy::touchFigure() 142 159 { 143 160 if (dead_ == false) 161 { 162 figure_->CollisionWithEnemy(this); 163 } 144 164 } 145 165 }
Note: See TracChangeset
for help on using the changeset viewer.