- Timestamp:
- May 22, 2014, 3:05:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpProjectile.cc
r10050 r10074 56 56 RegisterObject(JumpProjectile); 57 57 58 this->figure_ = 0;58 figure_ = 0; 59 59 60 this->registerVariables();60 registerVariables(); 61 61 62 this->setPosition(Vector3(0,0,0));63 this->setVelocity(Vector3(0,0,0));64 this->setAcceleration(Vector3(0,0,0));62 setPosition(Vector3(0,0,0)); 63 setVelocity(Vector3(0,0,250.0)); 64 setAcceleration(Vector3(0,0,0)); 65 65 } 66 66 … … 108 108 SUPER(JumpProjectile, tick, dt); 109 109 110 Vector3 p latformPosition = this->getPosition();110 Vector3 projectilePosition = getPosition(); 111 111 112 if (figure_ != NULL) 113 { 114 Vector3 figurePosition = figure_->getPosition(); 115 Vector3 figureVelocity = figure_->getVelocity(); 112 for (ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it) 113 { 114 Vector3 enemyPosition = it->getPosition(); 115 float enemyWidth = it->getWidth(); 116 float enemyHeight = it->getHeight(); 116 117 117 if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-10 && figurePosition.x < platformPosition.x+10 && figurePosition.z > platformPosition.z-4 && figurePosition.z < platformPosition.z+4)118 119 touchFigure();120 121 118 if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight) 119 { 120 it->dead_ = true; 121 } 122 } 122 123 } 123 124 … … 128 129 An array (of size 2) of weak pointers, to be set as the new bats. 129 130 */ 130 void JumpProjectile::setFigure(WeakPtr<JumpFigure> newFigure)131 void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure) 131 132 { 132 figure_ = newFigure; 133 } 134 135 void JumpProjectile::accelerateFigure() 136 { 137 138 } 139 140 void JumpProjectile::touchFigure() 141 { 142 133 figure_ = figure; 143 134 } 144 135 }
Note: See TracChangeset
for help on using the changeset viewer.